Update to work with Podman

This commit is contained in:
2025-01-23 11:32:13 +00:00
parent 86fb2ac593
commit b16db665e5
5 changed files with 99 additions and 274 deletions

3
.gitignore vendored
View File

@@ -58,7 +58,6 @@ cover/
# Django stuff: # Django stuff:
*.log *.log
local_settings.py
db.sqlite3 db.sqlite3
db.sqlite3-journal db.sqlite3-journal
@@ -156,3 +155,5 @@ cython_debug/
.bash_history .bash_history
.python_history .python_history
.vscode/ .vscode/
stack.env

View File

@@ -2,17 +2,17 @@
FROM python:3 FROM python:3
ARG OPERATION ARG OPERATION
RUN useradd -d /code pathogen RUN useradd -d /code xf
RUN mkdir -p /code RUN mkdir -p /code
RUN chown -R pathogen:pathogen /code RUN chown -R xf:xf /code
RUN mkdir -p /conf/static RUN mkdir -p /conf/static
RUN chown -R pathogen:pathogen /conf RUN chown -R xf:xf /conf
RUN mkdir /venv RUN mkdir /venv
RUN chown pathogen:pathogen /venv RUN chown xf:xf /venv
USER pathogen USER xf
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
WORKDIR /code WORKDIR /code

View File

@@ -8,7 +8,7 @@ stop:
docker-compose -f docker-compose.prod.yml --env-file=stack.env down docker-compose -f docker-compose.prod.yml --env-file=stack.env down
log: log:
docker-compose -f docker-compose.prod.yml --env-file=stack.env logs -f docker-compose -f docker-compose.prod.yml --env-file=stack.env logs -f --names
migrate: migrate:
docker-compose -f docker-compose.prod.yml --env-file=stack.env run --rm app sh -c ". /venv/bin/activate && python manage.py migrate" docker-compose -f docker-compose.prod.yml --env-file=stack.env run --rm app sh -c ". /venv/bin/activate && python manage.py migrate"

View File

@@ -2,7 +2,7 @@ version: "2.2"
services: services:
app: app:
image: pathogen/neptune:latest image: xf/neptune:latest
container_name: neptune container_name: neptune
build: build:
context: . context: .
@@ -11,9 +11,11 @@ services:
volumes: volumes:
- ${PORTAINER_GIT_DIR}:/code - ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini - ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py #- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3 - ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT} - type: bind
source: /code/run
target: /var/run
# env_file: # env_file:
# - stack.env # - stack.env
environment: environment:
@@ -96,13 +98,14 @@ services:
condition: service_started condition: service_started
collectstatic: collectstatic:
condition: service_started condition: service_started
networks: # networks:
- default # - default
- xf # - xf
- db # - db
network_mode: host
processing: processing:
image: pathogen/neptune:latest image: xf/neptune:latest
container_name: processing_neptune container_name: processing_neptune
build: build:
context: . context: .
@@ -112,9 +115,11 @@ services:
volumes: volumes:
- ${PORTAINER_GIT_DIR}:/code - ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini - ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py #- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3 - ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT} - type: bind
source: /code/run
target: /var/run
environment: environment:
# General application settings # General application settings
APP_PORT: "${APP_PORT}" APP_PORT: "${APP_PORT}"
@@ -197,13 +202,14 @@ services:
condition: service_started condition: service_started
collectstatic: collectstatic:
condition: service_started condition: service_started
networks: # networks:
- default # - default
- xf # - xf
- db # - db
network_mode: host
scheduling: scheduling:
image: pathogen/neptune:latest image: xf/neptune:latest
container_name: scheduling_neptune container_name: scheduling_neptune
build: build:
context: . context: .
@@ -213,9 +219,11 @@ services:
volumes: volumes:
- ${PORTAINER_GIT_DIR}:/code - ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini - ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py #- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3 - ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT} - type: bind
source: /code/run
target: /var/run
environment: environment:
# General application settings # General application settings
APP_PORT: "${APP_PORT}" APP_PORT: "${APP_PORT}"
@@ -298,13 +306,14 @@ services:
condition: service_started condition: service_started
collectstatic: collectstatic:
condition: service_started condition: service_started
networks: # networks:
- default # - default
- xf # - xf
- db # - db
network_mode: host
migration: migration:
image: pathogen/neptune:latest image: xf/neptune:latest
container_name: migration_neptune container_name: migration_neptune
build: build:
context: . context: .
@@ -313,9 +322,11 @@ services:
command: sh -c '. /venv/bin/activate && python manage.py migrate --noinput' command: sh -c '. /venv/bin/activate && python manage.py migrate --noinput'
volumes: volumes:
- ${PORTAINER_GIT_DIR}:/code - ${PORTAINER_GIT_DIR}:/code
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py #- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3 - ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT} - type: bind
source: /code/run
target: /var/run
environment: environment:
# General application settings # General application settings
APP_PORT: "${APP_PORT}" APP_PORT: "${APP_PORT}"
@@ -394,13 +405,14 @@ services:
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
networks: # networks:
- default # - default
- xf # - xf
- db # - db
network_mode: host
collectstatic: collectstatic:
image: pathogen/neptune:latest image: xf/neptune:latest
container_name: collectstatic_neptune container_name: collectstatic_neptune
build: build:
context: . context: .
@@ -409,9 +421,11 @@ services:
command: sh -c '. /venv/bin/activate && python manage.py collectstatic --noinput' command: sh -c '. /venv/bin/activate && python manage.py collectstatic --noinput'
volumes: volumes:
- ${PORTAINER_GIT_DIR}:/code - ${PORTAINER_GIT_DIR}:/code
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py #- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3 - ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT} - type: bind
source: /code/run
target: /var/run
# volumes_from: # volumes_from:
# - tmp # - tmp
environment: environment:
@@ -490,33 +504,34 @@ services:
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
networks: # networks:
- default # - default
- xf # - xf
- db # - db
network_mode: host
nginx: # nginx:
image: nginx:latest # image: nginx:latest
container_name: nginx_neptune # container_name: nginx_neptune
ports: # ports:
- ${APP_PORT}:9999 # - ${APP_PORT}:9999
ulimits: # ulimits:
nproc: 65535 # nproc: 65535
nofile: # nofile:
soft: 65535 # soft: 65535
hard: 65535 # hard: 65535
volumes: # volumes:
- ${PORTAINER_GIT_DIR}:/code # - ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/nginx/conf.d/${OPERATION}.conf:/etc/nginx/conf.d/default.conf # - ${PORTAINER_GIT_DIR}/docker/nginx/conf.d/${OPERATION}.conf:/etc/nginx/conf.d/default.conf
- neptune_static:${STATIC_ROOT} # - neptune_static:${STATIC_ROOT}
# volumes_from: # # volumes_from:
# - tmp # # - tmp
networks: # networks:
- default # - default
- xf # - xf
depends_on: # depends_on:
app: # app:
condition: service_started # condition: service_started
# tmp: # tmp:
# image: busybox # image: busybox
@@ -529,14 +544,17 @@ services:
image: redis image: redis
container_name: redis_neptune container_name: redis_neptune
command: redis-server /etc/redis.conf command: redis-server /etc/redis.conf
ulimits: # ulimits:
nproc: 65535 # nproc: 65535
nofile: # nofile:
soft: 65535 # soft: 65535
hard: 65535 # hard: 65535
volumes: volumes:
- ${PORTAINER_GIT_DIR}/docker/redis.conf:/etc/redis.conf - ${PORTAINER_GIT_DIR}/docker/redis.conf:/etc/redis.conf
- neptune_redis_data:/data - neptune_redis_data:/data
- type: bind
source: /code/run
target: /var/run
# volumes_from: # volumes_from:
# - tmp # - tmp
healthcheck: healthcheck:
@@ -544,18 +562,18 @@ services:
interval: 2s interval: 2s
timeout: 2s timeout: 2s
retries: 15 retries: 15
networks: # networks:
- default # - default
- xf # - xf
networks: # networks:
default: # default:
driver: bridge # driver: bridge
xf: # xf:
external: true # external: true
db: # db:
external: true # external: true
volumes: volumes:
neptune_static: {} # neptune_static: {}
neptune_redis_data: {} neptune_redis_data: {}

View File

@@ -1,194 +0,0 @@
version: "2.2"
services:
app:
image: pathogen/neptune:latest
container_name: neptune
build:
context: .
args:
OPERATION: ${OPERATION}
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT}
env_file:
- stack.env
volumes_from:
- tmp
depends_on:
redis:
condition: service_healthy
migration:
condition: service_started
collectstatic:
condition: service_started
networks:
- default
- pathogen
- elastic
processing:
image: pathogen/neptune:latest
container_name: processing_neptune
build:
context: .
args:
OPERATION: ${OPERATION}
command: sh -c '. /venv/bin/activate && python manage.py processing'
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT}
env_file:
- stack.env
volumes_from:
- tmp
depends_on:
redis:
condition: service_healthy
migration:
condition: service_started
collectstatic:
condition: service_started
networks:
- default
- pathogen
- elastic
scheduling:
image: pathogen/neptune:latest
container_name: scheduling_neptune
build:
context: .
args:
OPERATION: ${OPERATION}
command: sh -c '. /venv/bin/activate && python manage.py scheduling'
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT}
env_file:
- stack.env
volumes_from:
- tmp
depends_on:
redis:
condition: service_healthy
migration:
condition: service_started
collectstatic:
condition: service_started
networks:
- default
- pathogen
- elastic
migration:
image: pathogen/neptune:latest
container_name: migration_neptune
build:
context: .
args:
OPERATION: ${OPERATION}
command: sh -c '. /venv/bin/activate && python manage.py migrate --noinput'
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT}
volumes_from:
- tmp
depends_on:
redis:
condition: service_healthy
collectstatic:
image: pathogen/neptune:latest
container_name: collectstatic_neptune
build:
context: .
args:
OPERATION: ${OPERATION}
command: sh -c '. /venv/bin/activate && python manage.py collectstatic --noinput'
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/conf/db.sqlite3
- neptune_static:${STATIC_ROOT}
volumes_from:
- tmp
env_file:
- stack.env
depends_on:
redis:
condition: service_healthy
nginx:
image: nginx:latest
container_name: nginx_neptune
ports:
- ${APP_PORT}:9999
ulimits:
nproc: 65535
nofile:
soft: 65535
hard: 65535
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/nginx/conf.d/${OPERATION}.conf:/etc/nginx/conf.d/default.conf
- neptune_static:${STATIC_ROOT}
volumes_from:
- tmp
networks:
- default
- pathogen
depends_on:
app:
condition: service_started
tmp:
image: busybox
container_name: tmp_neptune
command: chmod -R 777 /var/run/socks
volumes:
- /var/run/socks
redis:
image: redis
container_name: redis_neptune
command: redis-server /etc/redis.conf
ulimits:
nproc: 65535
nofile:
soft: 65535
hard: 65535
volumes:
- ${PORTAINER_GIT_DIR}/docker/redis.conf:/etc/redis.conf
volumes_from:
- tmp
healthcheck:
test: "redis-cli -s /var/run/socks/redis.sock ping"
interval: 2s
timeout: 2s
retries: 15
networks:
- default
- pathogen
networks:
default:
driver: bridge
pathogen:
external: true
elastic:
external: true
volumes:
neptune_static: {}