Replies: 1 comment
|
I should probably change the service file to use the docker-compose.sh but have not yet. EDIT |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Any comments welcome. There is definitely room for improvement.
I'm doing this inside a semi-air-gapped environment, so we need to copy things in by hand
and the usual repositories won't work. I'm using podman instead of Docker.
Install docker-compose plugin (Please use the latest version)
wget "https://download.docker.com/linux/rhel/9/x86_64/stable/Packages/docker-compose-plugin-5.0.2-1.el9.x86_64.rpm"
scp username@desktop.example.edu:/home/username/docker-compose-plugin-5.0.2-1.el9.x86_64.rpm .
dnf install docker-compose-plugin-5.0.2-1.el9.x86_64.rpm
Here's my script to create a podman service account and make sure it uses "pasta" networking.
This is the default after podman 5.x. On Rocky Linux useradd populates subuid/subgid automatically.
podmansa.sh:
------------------------------------------------------- END FILE
su - podman
systemctl --user enable --now podman.service
# The podman service is required to use "podman compose" functionality
# the user systemd podman.service should now be persistent
# I also created a systemd --user service to run this compose stack
# ~/.config/systemd/user/ciso-assistant.service:
------------------------------------- END FILE
# systemctl --user daemon-reload
# systemctl --user enable --now ciso-assistant.service
# Do this AFTER you configure things by hand, as the docker-compose.sh
# script is what populates the password into the .env file
git clone https://github.com/intuitem/ciso-assistant-community.git
dnf install s-nail postfix
cd ciso-assistant-community
As I can't pull the container images directly, pull and save them outside the environment
podman pull ghcr.io/intuitem/ciso-assistant-community/backend:latest
podman pull ghcr.io/intuitem/ciso-assistant-community/frontend:latest
podman pull docker.io/library/postgres:16-alpine
podman pull docker.io/library/caddy:2.10.0
podman save -o backend.tar ghcr.io/intuitem/ciso-assistant-community/backend:latest
podman save -o frontend.tar ghcr.io/intuitem/ciso-assistant-community/frontend:latest
podman save -o postgres.tar docker.io/library/postgres:16-alpine
podman save -o caddy.tar docker.io/library/caddy:2.10.0
copy in and load the images on the "secure" vm
for img in *.tar; do podman load -i "$img"; done
replace docker-compose.sh and docker-compose.yml with these ones. I made the shell script idempotent,
and changed the compose stack to use postgresql, also containerized, and enabled email
(configuring postfix is outside the scope of this guide) I'm using podman secrets for the password,
but in the end just stuck the variable in the shell script into a secure ".env" file. Should fix later.
For now you can follow along and do
echo "YourStrongPassword" | podman secret create db_pass -
For the DJANGO_SECRET_KEY you can generate a good key with
openssl rand -base64 48
I also tell this to never try to update the images, as it can't anyway.
To get to the postfix MTA outside the container stack I use
"host.containers.internal" for the email server. I also had to configure postfix/main.cf
to listen globally (inet_interfaces = all) and accept unauthenticated relay from the Podman subnet
(mynetworks appended with 127.0.0.0/8 and 10.0.0.0/8).
and set an appropriate "relayhost = yourmailserver.edu" in main.cf
Firewalld configured with a rich rule to permanently allow TCP Port 25 traffic explicitly from the 10.0.0.0/8 source block.
I'm using an InCommon cert with the cert chain for this, but had to move the last cert to the beginning of the PEM file
to get Caddy to recognize that the key was correct for this cert/chain file.
Appended the :Z,U flags to all local volume mounts. :Z automatically provisions a private SELinux context, and :U
recursively chowns the directory to match the container's user namespace.
If you'd like to set passwords for users and securely share them out-of-band, you can do so like this
podman exec -it backend poetry run python manage.py changepassword <username>
Here's the Config files:
docker-compose.sh:
---------------------------------------- END FILE
docker-compose.yml:
------------------------------------------------------- END FILE
All reactions