From 31fa3d44c5328e7e872409447b0444636680312a Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Fri, 16 Dec 2022 22:12:15 +0100 Subject: [PATCH] Add some server scripts --- .../contrib/server/docker-compose.yml | 20 +++++++++++++++++++ .../contrib/server/update | 8 ++++++++ 2 files changed, 28 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/contrib/server/docker-compose.yml create mode 100644 {{cookiecutter.project_slug}}/contrib/server/update diff --git a/{{cookiecutter.project_slug}}/contrib/server/docker-compose.yml b/{{cookiecutter.project_slug}}/contrib/server/docker-compose.yml new file mode 100644 index 0000000..db9aa62 --- /dev/null +++ b/{{cookiecutter.project_slug}}/contrib/server/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2.4' +services: + django: + image: crocmagnon/{{cookiecutter.project_slug}} + env_file: + - .env + volumes: + - ./db:/app/db + - ./data:/app/data + networks: + - frontend + user: 1000:1000 + restart: always + init: true + tty: true + mem_limit: 512m + +networks: + frontend: + external: true diff --git a/{{cookiecutter.project_slug}}/contrib/server/update b/{{cookiecutter.project_slug}}/contrib/server/update new file mode 100644 index 0000000..6b1d752 --- /dev/null +++ b/{{cookiecutter.project_slug}}/contrib/server/update @@ -0,0 +1,8 @@ +#!/bin/bash +set -euxo pipefail +pushd /mnt/data/{{cookiecutter.project_slug}} +docker compose --ansi never pull --quiet +docker compose --ansi never up -d +docker compose exec django python manage.py migrate +popd +docker image prune -f