Skip to content

Commit 2bb8622

Browse files
committed
checkpoint
1 parent d3c35d9 commit 2bb8622

File tree

41 files changed

+2385
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2385
-0
lines changed

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-ast
7+
- id: check-builtin-literals
8+
- id: check-docstring-first
9+
- id: check-executables-have-shebangs
10+
- id: check-json
11+
- id: check-merge-conflict
12+
- id: check-symlinks
13+
- id: check-yaml
14+
args:
15+
- --allow-multiple-documents
16+
- id: destroyed-symlinks
17+
- id: end-of-file-fixer
18+
- id: mixed-line-ending
19+
args:
20+
- --fix=lf
21+
- id: detect-private-key
22+
- id: check-toml
23+
- id: pretty-format-json
24+
args:
25+
- --autofix
26+
- id: trailing-whitespace
27+
28+
- repo: https://github.com/pre-commit/mirrors-prettier
29+
rev: v4.0.0-alpha.8
30+
hooks:
31+
- id: prettier

podman-kube/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Run Copr infra with podman kube play
2+
3+
Run COPR infrastructure locally using `podman kube play` with Kubernetes manifests.
4+
5+
## Quick Start
6+
7+
```bash
8+
# Run with dev packages
9+
just up
10+
11+
# Run with local source code (for development)
12+
just up-local
13+
```
14+
15+
## Usage
16+
17+
See the manual from just:
18+
19+
```bash
20+
just --list
21+
```
22+
23+
## Modes
24+
25+
| Mode | Command | Description |
26+
| --------- | -------------------- | --------------------------------------- |
27+
| `dev` | `just up` | Uses `@copr/copr-dev` packages (main) |
28+
| `release` | `just build release` | Uses Fedora packages only |
29+
| `local` | `just up-local` | Mounts repo source code for development |
30+
31+
### Local Development Mode
32+
33+
`just up-local` mounts the repository at `/opt/copr` inside containers with appropriate `PYTHONPATH` settings. Edit code locally, then restart the service:
34+
35+
```bash
36+
# Edit frontend code...
37+
vim ../frontend/coprs_frontend/coprs/views/misc.py
38+
39+
# Restart frontend to pick up changes
40+
just restart frontend
41+
```
42+
43+
## Access Points
44+
45+
After starting, the following services are available:
46+
47+
| Service | URL |
48+
| --------------- | --------------------- |
49+
| Frontend | http://localhost:5000 |
50+
| DistGit | http://localhost:5001 |
51+
| Backend Results | http://localhost:5002 |
52+
| Resalloc WebUI | http://localhost:5005 |
53+
| Database | localhost:5009 |
54+
55+
## Host Entries (optional)
56+
57+
To make internal URLs work in your browser, add to `/etc/hosts`:
58+
59+
```
60+
127.0.0.1 frontend backend-httpd distgit keygen resalloc
61+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM registry.fedoraproject.org/fedora:43
2+
LABEL maintainer="copr-devel@lists.fedorahosted.org"
3+
LABEL description="COPR Backend HTTPD - serves build results"
4+
5+
RUN dnf install -y nginx && dnf clean all
6+
7+
COPY files/nginx.conf /etc/nginx/conf.d/default.conf
8+
9+
RUN mkdir -p /var/lib/copr/public_html/results && \
10+
chown -R nginx:nginx /var/lib/copr
11+
12+
EXPOSE 5002
13+
14+
CMD ["nginx", "-g", "daemon off;"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
server {
2+
listen 5002;
3+
listen [::]:5002;
4+
server_tokens off;
5+
access_log /dev/stdout;
6+
error_log /dev/stdout;
7+
8+
server_name localhost;
9+
charset utf-8;
10+
11+
root /var/lib/copr/public_html/;
12+
default_type text/plain;
13+
14+
location / {
15+
port_in_redirect off;
16+
autoindex on;
17+
}
18+
19+
location ~* .*\.gz$ {
20+
add_header Content-Encoding gzip;
21+
}
22+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM registry.fedoraproject.org/fedora:43
2+
LABEL maintainer="copr-devel@lists.fedorahosted.org"
3+
LABEL description="COPR Backend services"
4+
5+
ARG ADDITIONAL_COPR_REPOSITORIES="@copr/copr-dev"
6+
7+
ENV LANG=en_US.UTF-8
8+
ENV PYTHONPATH="/usr/share/copr/"
9+
ENV TERM=linux
10+
11+
RUN set -ex ; \
12+
test -z "${ADDITIONAL_COPR_REPOSITORIES}" \
13+
|| dnf -y install dnf-plugins-core \
14+
&& for repo in $ADDITIONAL_COPR_REPOSITORIES ; do dnf -y copr enable $repo; done ; \
15+
dnf -y update && \
16+
dnf -y install htop \
17+
make \
18+
wget \
19+
net-tools \
20+
iputils \
21+
vim \
22+
git \
23+
sudo \
24+
openssh-server \
25+
resalloc \
26+
psmisc \
27+
nginx \
28+
findutils \
29+
tini \
30+
pulp-cli \
31+
rng-tools \
32+
expect \
33+
&& dnf -y install copr-backend \
34+
&& dnf clean all
35+
36+
RUN setcap cap_net_raw,cap_net_admin+p /usr/bin/ping
37+
38+
RUN ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -q
39+
40+
RUN echo 'root:passwd' | chpasswd && chmod 700 /root /root/.ssh
41+
42+
RUN set -x ; \
43+
echo 'copr:passwd' | chpasswd && \
44+
echo 'copr ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers && \
45+
mkdir -p /home/copr/.ssh && chmod 700 /home/copr /home/copr/.ssh && \
46+
ssh-keygen -f /home/copr/.ssh/id_rsa -N '' -q -C copr@localhost && \
47+
touch /home/copr/.ssh/authorized_keys && chmod 600 /home/copr/.ssh/authorized_keys && \
48+
cat /home/copr/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys && \
49+
cat /home/copr/.ssh/id_rsa.pub >> /home/copr/.ssh/authorized_keys && \
50+
chown copr:copr -R /home/copr
51+
52+
RUN usermod -a -G mock copr
53+
54+
COPY files/ /
55+
56+
RUN chmod 700 /root && \
57+
chmod 700 /home/copr && \
58+
chmod 400 /home/copr/.ssh/id_rsa && \
59+
chmod 600 /home/copr/.ssh/id_rsa.pub && \
60+
chown -R copr:copr /home/copr
61+
62+
RUN chmod 0755 /usr/bin/sign
63+
64+
RUN chown copr:root /etc/sign.conf && \
65+
chmod 0660 /etc/sign.conf
66+
67+
RUN mkdir -p /var/lock/copr-backend && \
68+
chown copr:copr /var/lock/copr-backend
69+
70+
# Entropy for GPG key generation
71+
RUN rngd -r /dev/urandom || true
72+
73+
USER copr
74+
75+
ENTRYPOINT ["/usr/bin/tini", "--"]
76+
CMD ["/run-backend"]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[backend]
2+
3+
build_user=root
4+
5+
# URL where results are visible
6+
results_baseurl=http://backend-httpd:5002/results/
7+
8+
# Frontend URL
9+
frontend_base_url=http://frontend:5000
10+
11+
# Backend authentication (must match frontend config)
12+
frontend_auth=1234
13+
14+
# DistGit URL
15+
dist_git_url=http://distgit:5001/cgit
16+
17+
# Results directory
18+
destdir=/var/lib/copr/public_html/results
19+
20+
# Queue polling interval (seconds)
21+
sleeptime=30
22+
23+
# Resalloc connection
24+
resalloc_connection=http://resalloc:49100
25+
26+
# Package signing
27+
do_sign=true
28+
keygen_host=keygen:5003
29+
30+
# Build pruning
31+
prune_days=14
32+
33+
# Redis
34+
redis_host=redis
35+
redis_port=6379
36+
37+
# Pulp (optional)
38+
# pulp_content_url=http://pulp:80/pulp/content
39+
40+
[builder]
41+
timeout=3600
42+
builder_perl=True
43+
44+
[ssh]
45+
builder_config=/home/copr/.ssh/builder_config
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SSH config for connecting to builders
2+
Host *
3+
StrictHostKeyChecking no
4+
UserKnownHostsFile /dev/null
5+
IdentityFile /home/copr/.ssh/id_rsa
6+
User root
7+
ConnectTimeout 30
8+
9+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Parse arguments for sign host configuration
5+
option_variable() {
6+
opt=$1
7+
opt=${1##--}
8+
opt=${opt##-}
9+
opt=${opt//-/_}
10+
option_variable_result=opt_$opt
11+
}
12+
13+
opt_sign_user=$(id -u)
14+
opt_sign_host=keygen-signd
15+
16+
ARGS=$(getopt -o "" -l "sign-user:,sign-host:" -n "getopt" -- "$@") || exit 1
17+
eval set -- "$ARGS"
18+
19+
while true; do
20+
case $1 in
21+
--sign-host|--sign-user)
22+
option_variable "$1"
23+
eval "$option_variable_result=\$2"
24+
shift 2
25+
;;
26+
--) shift; break;;
27+
*) echo "programmer mistake ($1)" >&2; exit 1;;
28+
esac
29+
done
30+
31+
# Configure sign client
32+
cat >/etc/sign.conf <<EOF
33+
server: $opt_sign_host
34+
allowuser: $opt_sign_user
35+
allow-unprivileged-ports: true
36+
EOF
37+
38+
# Execute the command
39+
exec "$@"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM registry.fedoraproject.org/fedora:43
2+
LABEL maintainer="copr-devel@lists.fedorahosted.org"
3+
LABEL description="COPR Builder - RPM build worker"
4+
5+
ARG ADDITIONAL_COPR_REPOSITORIES="@copr/copr-dev"
6+
7+
ENV TERM=linux
8+
9+
RUN set -ex ; \
10+
test -z "${ADDITIONAL_COPR_REPOSITORIES}" \
11+
|| dnf -y install dnf-plugins-core \
12+
&& for repo in $ADDITIONAL_COPR_REPOSITORIES ; do dnf -y copr enable $repo; done ; \
13+
dnf -y update && \
14+
dnf -y install htop \
15+
which \
16+
wget \
17+
vim \
18+
openssh-server \
19+
fedora-packager \
20+
mock \
21+
mock-lvm \
22+
createrepo \
23+
yum-utils \
24+
rsync \
25+
openssh-clients \
26+
rpm \
27+
glib2 \
28+
ca-certificates \
29+
scl-utils-build \
30+
ethtool \
31+
&& dnf -y install copr-builder \
32+
&& dnf clean all
33+
34+
COPY files/ /
35+
36+
RUN ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -q
37+
38+
RUN echo 'root:passwd' | chpasswd && \
39+
chmod 700 /root /root/.ssh && \
40+
touch /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys
41+
42+
RUN echo 'config_opts["use_nspawn"] = False' >> /etc/mock/site-defaults.cfg
43+
44+
EXPOSE 22
45+
46+
CMD ["/usr/sbin/sshd", "-D"]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[main]
2+
frontend_url = http://frontend:5000
3+
enabled_source_protocols = https ftps
4+
5+
[distgit0]
6+
distgit_hostname_pattern = src.fedoraproject.org
7+
distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
8+
distgit_clone_url = https://src.fedoraproject.org/%(module)s
9+
10+
[distgit1]
11+
distgit_hostname_pattern = copr-dist-git.fedorainfracloud.org
12+
distgit_lookaside_url = http://copr-dist-git.fedorainfracloud.org/repo/pkgs/%(ns2)s/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
13+
distgit_clone_url = http://copr-dist-git.fedorainfracloud.org/git/%(module)s
14+
15+
[distgit2]
16+
distgit_hostname_pattern = pkgs.fedoraproject.org
17+
distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
18+
distgit_clone_url = git://pkgs.fedoraproject.org/%(module)s
19+
20+
[distgit3]
21+
distgit_hostname_pattern = src.stg.fedoraproject.org
22+
distgit_lookaside_url = https://src.stg.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
23+
distgit_clone_url = https://src.stg.fedoraproject.org/%(module)s
24+
25+
[distgit4]
26+
distgit_hostname_pattern = distgit
27+
distgit_lookaside_url = http://distgit:5001/repo/pkgs/%(ns2)s/%(ns1)s/%(name)s/%(filename)s/%(hash)s/%(filename)s
28+
distgit_clone_url = http://distgit:5001/git/%(module)s

0 commit comments

Comments
 (0)