Compare commits
No commits in common. "f202896c920f779f72b7e92645923720f3d8c530" and "b873b1fd0fde73852a2b1fe644d844c43a864773" have entirely different histories.
f202896c92
...
b873b1fd0f
@ -1,2 +1 @@
|
|||||||
start_server.sh
|
start_server.sh
|
||||||
run/*
|
|
@ -2,12 +2,6 @@
|
|||||||
# Example configuration. Must be edited and copied to ".env" next to the compose.yaml
|
# Example configuration. Must be edited and copied to ".env" next to the compose.yaml
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
|
|
||||||
# User id to use for the web application. This determines the user id, the media and static files are written to the volumes.
|
|
||||||
# Make sure the user has rw access to these directories.
|
|
||||||
DJANGO_USER_ID=1000
|
|
||||||
|
|
||||||
# Group id to use for the web application
|
|
||||||
DJANGO_USER_GID=1000
|
|
||||||
|
|
||||||
# Path to to mount as the directory for static data. Must be served by a webserver on the /static path
|
# Path to to mount as the directory for static data. Must be served by a webserver on the /static path
|
||||||
DJANGO_STATIC_VOL=/path/to/static/root
|
DJANGO_STATIC_VOL=/path/to/static/root
|
||||||
@ -35,4 +29,4 @@ DJANGO_MEDIA_URL=media.lab.example.com/
|
|||||||
|
|
||||||
# Set this password if you want to use a custom postgres password. The db should be confined inside the docker network.
|
# Set this password if you want to use a custom postgres password. The db should be confined inside the docker network.
|
||||||
# Using the standard PW is therefore not a problem
|
# Using the standard PW is therefore not a problem
|
||||||
# DJANGO_POSTGRESQL_PW=myfancynewpassword123donotsharemewithanyone
|
# DJANGO_POSTGRESQL_PW=myfancynewpassword123donotsharemewithanyone
|
@ -1,11 +1,6 @@
|
|||||||
x-op-restart-policy: &restart_policy
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
shimatta-kenkyusho-web:
|
shimatta-kenkyusho-web:
|
||||||
<<: *restart_policy
|
|
||||||
build: .
|
build: .
|
||||||
user: "${DJANGO_USER_ID}:${DJANGO_USER_GID}"
|
|
||||||
volumes:
|
volumes:
|
||||||
- "${DJANGO_STATIC_VOL:-./run/static}:/var/static"
|
- "${DJANGO_STATIC_VOL:-./run/static}:/var/static"
|
||||||
- "${DJANGO_MEDIA_VOL:-./run/media}:/var/media"
|
- "${DJANGO_MEDIA_VOL:-./run/media}:/var/media"
|
||||||
@ -35,7 +30,6 @@ services:
|
|||||||
start_period: 30s
|
start_period: 30s
|
||||||
|
|
||||||
shimatta-kenkyusho-db:
|
shimatta-kenkyusho-db:
|
||||||
<<: *restart_policy
|
|
||||||
image: postgres:16.5-alpine
|
image: postgres:16.5-alpine
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: "${DJANGO_POSTGRESQL_PW:-p4ssw0rd}"
|
POSTGRES_PASSWORD: "${DJANGO_POSTGRESQL_PW:-p4ssw0rd}"
|
||||||
|
@ -3,6 +3,4 @@ source /home/shimatta/kenkyusho/.venv/bin/activate
|
|||||||
cd /home/shimatta/kenkyusho/shimatta_kenkyusho
|
cd /home/shimatta/kenkyusho/shimatta_kenkyusho
|
||||||
python manage.py migrate --settings shimatta_kenkyusho.settings_production
|
python manage.py migrate --settings shimatta_kenkyusho.settings_production
|
||||||
python manage.py collectstatic --settings shimatta_kenkyusho.settings_production --noinput
|
python manage.py collectstatic --settings shimatta_kenkyusho.settings_production --noinput
|
||||||
python manage.py create_kenkyusho_admin_user --settings shimatta_kenkyusho.settings_production
|
|
||||||
|
|
||||||
gunicorn -w 4 --bind 0.0.0.0:8000 shimatta_kenkyusho.wsgi:application
|
gunicorn -w 4 --bind 0.0.0.0:8000 shimatta_kenkyusho.wsgi:application
|
||||||
|
@ -2,6 +2,5 @@
|
|||||||
source /home/shimatta/kenkyusho/.venv/bin/activate
|
source /home/shimatta/kenkyusho/.venv/bin/activate
|
||||||
cd /home/shimatta/kenkyusho/shimatta_kenkyusho
|
cd /home/shimatta/kenkyusho/shimatta_kenkyusho
|
||||||
python manage.py migrate --settings shimatta_kenkyusho.settings_production
|
python manage.py migrate --settings shimatta_kenkyusho.settings_production
|
||||||
python manage.py create_kenkyusho_admin_user --settings shimatta_kenkyusho.settings_production
|
|
||||||
|
|
||||||
python manage.py runserver 0.0.0.0:8000 --settings shimatta_kenkyusho.settings_production
|
python manage.py runserver 0.0.0.0:8000 --settings shimatta_kenkyusho.settings_production
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
from django.core.management.base import BaseCommand, CommandParser
|
|
||||||
from django.contrib.auth import get_user_model
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
|
||||||
help = "Create a default superuser if no superuser is already present. This aids automatic deployment inside a container."
|
|
||||||
|
|
||||||
def add_arguments(self, parser: CommandParser):
|
|
||||||
parser.add_argument('--user',
|
|
||||||
help='Username to create if no admin account is present',
|
|
||||||
default='admin')
|
|
||||||
parser.add_argument('--password',
|
|
||||||
help='Password to set for newly created user. Ignored, if any admin user is already present',
|
|
||||||
default='admin')
|
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
|
||||||
User = get_user_model()
|
|
||||||
|
|
||||||
# Query if there is any admin user
|
|
||||||
if not User.objects.filter(is_superuser=True).exists():
|
|
||||||
self.stdout.write(f'No superuser present. Creating {options['user']} with supplied password')
|
|
||||||
User.objects.create_superuser(username=options['user'], password=options['password'])
|
|
||||||
else:
|
|
||||||
self.stdout.write('At least one superuser already exists. Skipping superuser creation')
|
|
@ -75,7 +75,7 @@
|
|||||||
'component-parameter-type-list': '{% url 'componentparametertype-list' %}',
|
'component-parameter-type-list': '{% url 'componentparametertype-list' %}',
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="{% static 'js/kenkyusho-api-v1.js' %}"></script>
|
<script type="text/javascript" src="{% static 'js/kenyusho-api-v1.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'js/autocomplete.js' %}"></script>
|
<script type="text/javascript" src="{% static 'js/autocomplete.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'js/autocomplete-foreign-key-field.js' %}"></script>
|
<script type="text/javascript" src="{% static 'js/autocomplete-foreign-key-field.js' %}"></script>
|
||||||
<!-- Initialize bootstrap popovers -->
|
<!-- Initialize bootstrap popovers -->
|
||||||
@ -95,4 +95,4 @@
|
|||||||
{% endblock custom_scripts %}
|
{% endblock custom_scripts %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Startup the db container
|
# Startup the db container
|
||||||
docker compose start shimatta-kenkyusho-db
|
docker-compose start shimatta-kenkyusho-db
|
||||||
|
|
||||||
# Override entrypoint to get interactive shell
|
# Override entrypoint to get interactive shell
|
||||||
docker compose run --entrypoint="/bin/sh" -p 8000:8000 shimatta-kenkyusho-web
|
docker-compose run --entrypoint="/bin/sh" -p 8000:8000 shimatta-kenkyusho-web
|
Loading…
Reference in New Issue
Block a user