Skip to content

Commit c728efc

Browse files
committed
get container images closer to fedora-ansible config part 1
1 parent 2bb8622 commit c728efc

File tree

11 files changed

+329
-271
lines changed

11 files changed

+329
-271
lines changed

podman-kube/README.md

Lines changed: 64 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@ Run COPR infrastructure locally using `podman kube play` with Kubernetes manifes
55
## Quick Start
66

77
```bash
8-
# Run with dev packages
9-
just up
10-
11-
# Run with local source code (for development)
12-
just up-local
8+
just up # Start with dev packages
9+
just up-local # Start with local source code mounted
1310
```
1411

1512
## Usage
1613

17-
See the manual from just:
18-
1914
```bash
20-
just --list
15+
just help # Show all commands
2116
```
2217

2318
## Modes
@@ -28,22 +23,16 @@ just --list
2823
| `release` | `just build release` | Uses Fedora packages only |
2924
| `local` | `just up-local` | Mounts repo source code for development |
3025

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:
26+
### Local Development
3427

3528
```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
29+
just up-local # Start with source mounted at /opt/copr
30+
vim ../frontend/coprs_frontend/ # Edit code
31+
just restart frontend # Pick up changes
4132
```
4233

4334
## Access Points
4435

45-
After starting, the following services are available:
46-
4736
| Service | URL |
4837
| --------------- | --------------------- |
4938
| Frontend | http://localhost:5000 |
@@ -54,8 +43,64 @@ After starting, the following services are available:
5443

5544
## Host Entries (optional)
5645

57-
To make internal URLs work in your browser, add to `/etc/hosts`:
46+
Add to `/etc/hosts` for internal URL resolution:
5847

5948
```
6049
127.0.0.1 frontend backend-httpd distgit keygen resalloc
6150
```
51+
52+
## Architecture
53+
54+
```
55+
┌─────────────────────────────────────────────────────────────────┐
56+
│ localhost │
57+
├──────────┬──────────┬──────────┬──────────┬──────────┬─────────┤
58+
│ :5000 │ :5001 │ :5002 │ :5005 │ :5009 │ │
59+
│ Frontend │ DistGit │ Results │ Resalloc │ Database │ Redis │
60+
└────┬─────┴────┬─────┴────┬─────┴────┬─────┴────┬─────┴────┬────┘
61+
│ │ │ │ │ │
62+
└──────────┴──────────┴──────────┴──────────┴──────────┘
63+
64+
┌─────────┴─────────┐
65+
│ Backend Workers │
66+
│ (log/build/action)│
67+
└─────────┬─────────┘
68+
69+
┌─────────┴─────────┐
70+
│ Builder │
71+
│ (mock builds) │
72+
└───────────────────┘
73+
```
74+
75+
## Future Improvements
76+
77+
Potential enhancements for this infrastructure:
78+
79+
### Short-term
80+
81+
- [ ] Kustomize overlays for dev/staging/prod
82+
- [ ] Resource limits (CPU/memory) in manifests
83+
- [ ] Readiness/liveness probes for all services
84+
- [ ] Secrets management (not hardcoded passwords)
85+
- [ ] Network policies for service isolation
86+
87+
### Medium-term
88+
89+
- [ ] Helm chart for parameterized deployment
90+
- [ ] CI/CD pipeline to build and push images to registry
91+
- [ ] OpenShift-compatible manifests (Routes, DeploymentConfigs)
92+
- [ ] Horizontal pod autoscaling configs
93+
- [ ] Prometheus metrics endpoints
94+
95+
### Long-term
96+
97+
- [ ] Multi-node deployment support
98+
- [ ] External database/redis support
99+
- [ ] S3-compatible storage for results
100+
- [ ] Pulp integration for content management
101+
- [ ] GitOps workflow with ArgoCD/Flux
102+
103+
## Requirements
104+
105+
- podman
106+
- just (`dnf install just`)
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
FROM registry.fedoraproject.org/fedora:43
2-
LABEL maintainer="copr-devel@lists.fedorahosted.org"
3-
LABEL description="COPR Backend HTTPD - serves build results"
42

5-
RUN dnf install -y nginx && dnf clean all
3+
LABEL maintainer="copr-devel@lists.fedorahosted.org" \
4+
description="COPR Backend HTTPD - serves build results" \
5+
6+
ENV LANG=en_US.UTF-8
7+
8+
RUN --mount=type=cache,target=/var/cache/dnf \
9+
dnf -y install nginx && \
10+
dnf clean all
611

712
COPY files/nginx.conf /etc/nginx/conf.d/default.conf
813

914
RUN mkdir -p /var/lib/copr/public_html/results && \
1015
chown -R nginx:nginx /var/lib/copr
1116

17+
USER nginx
1218
EXPOSE 5002
19+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \
20+
CMD curl -sf http://localhost:5002/ || exit 1
1321

1422
CMD ["nginx", "-g", "daemon off;"]
Lines changed: 44 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,67 @@
11
FROM registry.fedoraproject.org/fedora:43
2-
LABEL maintainer="copr-devel@lists.fedorahosted.org"
3-
LABEL description="COPR Backend services"
2+
3+
LABEL maintainer="copr-devel@lists.fedorahosted.org" \
4+
description="COPR Backend services" \
45

56
ARG ADDITIONAL_COPR_REPOSITORIES="@copr/copr-dev"
67

7-
ENV LANG=en_US.UTF-8
8-
ENV PYTHONPATH="/usr/share/copr/"
9-
ENV TERM=linux
8+
ENV LANG=en_US.UTF-8 \
9+
PYTHONPATH=/usr/share/copr/ \
10+
TERM=linux
1011

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 ; \
12+
RUN --mount=type=cache,target=/var/cache/dnf \
13+
set -ex && \
14+
if [ -n "${ADDITIONAL_COPR_REPOSITORIES}" ]; then \
15+
dnf -y install dnf-plugins-core && \
16+
for repo in $ADDITIONAL_COPR_REPOSITORIES; do dnf -y copr enable $repo; done; \
17+
fi && \
1518
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 \
19+
dnf -y install \
20+
copr-backend \
21+
expect \
22+
findutils \
23+
git \
24+
iputils \
25+
openssh-server \
26+
psmisc \
27+
pulp-cli \
28+
resalloc \
29+
rng-tools \
30+
sudo \
31+
tini \
3432
&& dnf clean all
3533

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 ; \
34+
RUN set -ex && \
35+
setcap cap_net_raw,cap_net_admin+p /usr/bin/ping && \
36+
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -q && \
37+
echo 'root:passwd' | chpasswd && \
38+
chmod 700 /root /root/.ssh && \
4339
echo 'copr:passwd' | chpasswd && \
4440
echo 'copr ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers && \
45-
mkdir -p /home/copr/.ssh && chmod 700 /home/copr /home/copr/.ssh && \
41+
mkdir -p /home/copr/.ssh && \
42+
chmod 700 /home/copr /home/copr/.ssh && \
4643
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 && \
44+
touch /home/copr/.ssh/authorized_keys && \
45+
chmod 600 /home/copr/.ssh/authorized_keys && \
4846
cat /home/copr/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys && \
4947
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
48+
chown -R copr:copr /home/copr && \
49+
usermod -a -G mock copr && \
50+
mkdir -p /var/lock/copr-backend && \
51+
chown copr:copr /var/lock/copr-backend && \
52+
rngd -r /dev/urandom || true
5353

5454
COPY files/ /
5555

56-
RUN chmod 700 /root && \
57-
chmod 700 /home/copr && \
56+
RUN set -ex && \
57+
chmod 700 /root /home/copr && \
5858
chmod 400 /home/copr/.ssh/id_rsa && \
5959
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 && \
60+
chown -R copr:copr /home/copr && \
61+
chmod 0755 /usr/bin/sign && \
62+
chown copr:root /etc/sign.conf && \
6563
chmod 0660 /etc/sign.conf
6664

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-
7365
USER copr
74-
7566
ENTRYPOINT ["/usr/bin/tini", "--"]
7667
CMD ["/run-backend"]
Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
11
FROM registry.fedoraproject.org/fedora:43
2-
LABEL maintainer="copr-devel@lists.fedorahosted.org"
3-
LABEL description="COPR Builder - RPM build worker"
2+
3+
LABEL maintainer="copr-devel@lists.fedorahosted.org" \
4+
description="COPR Builder - RPM build worker" \
45

56
ARG ADDITIONAL_COPR_REPOSITORIES="@copr/copr-dev"
67

7-
ENV TERM=linux
8+
ENV LANG=en_US.UTF-8 \
9+
TERM=linux
810

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 ; \
11+
RUN --mount=type=cache,target=/var/cache/dnf \
12+
set -ex && \
13+
if [ -n "${ADDITIONAL_COPR_REPOSITORIES}" ]; then \
14+
dnf -y install dnf-plugins-core && \
15+
for repo in $ADDITIONAL_COPR_REPOSITORIES; do dnf -y copr enable $repo; done; \
16+
fi && \
1317
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 \
18+
dnf -y install \
19+
ca-certificates \
20+
copr-builder \
21+
createrepo \
22+
fedora-packager \
23+
mock \
24+
mock-lvm \
25+
openssh-clients \
26+
openssh-server \
27+
rsync \
28+
yum-utils \
3229
&& dnf clean all
3330

3431
COPY files/ /
3532

36-
RUN ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -q
37-
38-
RUN echo 'root:passwd' | chpasswd && \
33+
RUN set -ex && \
34+
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -q && \
35+
echo 'root:passwd' | chpasswd && \
3936
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
37+
touch /root/.ssh/authorized_keys && \
38+
chmod 600 /root/.ssh/authorized_keys && \
39+
echo 'config_opts["use_nspawn"] = False' >> /etc/mock/site-defaults.cfg
4340

4441
EXPOSE 22
45-
4642
CMD ["/usr/sbin/sshd", "-D"]
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
FROM registry.fedoraproject.org/fedora:43
2-
LABEL maintainer="copr-devel@lists.fedorahosted.org"
3-
LABEL description="PostgreSQL database for COPR"
42

5-
RUN dnf install -y postgresql-server postgresql && dnf clean all
3+
LABEL maintainer="copr-devel@lists.fedorahosted.org" \
4+
description="PostgreSQL database for COPR" \
5+
6+
ENV LANG=en_US.UTF-8
7+
8+
RUN --mount=type=cache,target=/var/cache/dnf \
9+
dnf -y install postgresql-server postgresql && \
10+
dnf clean all
611

712
RUN mkdir -p /var/lib/pgsql/data /var/run/postgresql && \
813
chown -R postgres:postgres /var/lib/pgsql /var/run/postgresql
914

1015
COPY files/init-db.sh /usr/local/bin/init-db.sh
1116
RUN chmod +x /usr/local/bin/init-db.sh
1217

18+
USER postgres
1319
EXPOSE 5432
20+
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s \
21+
CMD pg_isready -U postgres || exit 1
1422

15-
USER postgres
1623
CMD ["/usr/local/bin/init-db.sh"]

0 commit comments

Comments
 (0)