Skip to content

Commit

Permalink
fix upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed Dec 18, 2023
1 parent 272baf8 commit 8350677
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docker/bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export REDIS_MAXMEMORY="${REDIS_MAXMEMORY:-100Mb}"
export REDIS_MAXMEMORY_POLICY="${REDIS_MAXMEMORY_POLICY:-volatile-ttl}"
export AURORA_VERSION=${VERSION}
export AURORA_BUILD=${BUILD_DATE}
export PYTHONPATH="/code/src/:/code/__pypackages__/3.11/lib"

export DOLLAR='$'

mkdir -p /var/run /var/nginx ${NGINX_CACHE_DIR} ${MEDIA_ROOT} ${STATIC_ROOT}
echo "created support dirs /var/run ${MEDIA_ROOT} ${STATIC_ROOT}"


if [ $# -eq 0 ]; then
envsubst < /conf/nginx.conf.tpl > /conf/nginx.conf && nginx -tc /conf/nginx.conf
envsubst < /conf/redis.conf.tpl > /conf/redis.conf
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/uwsgi.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[uwsgi]

http-socket=0.0.0.0:8000
env=PYTHONPATH=/code/src
env=PYTHONPATH=/code/src/:/code/__pypackages__/3.11/lib
enable-threads=0
honour-range=1
master=1
Expand Down
18 changes: 9 additions & 9 deletions src/aurora/management/commands/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ def upgrade(admin_email, admin_password, static, migrate, prompt, verbosity, org
extra = {"no_input": prompt, "verbosity": verbosity - 1, "stdout": None}
click.echo("Run upgrade.. waiting for lock")
try:
# ensure project/org
click.echo("Set default Org/Project")
UNICEF, __ = Organization.objects.get_or_create(slug="unicef", defaults={"name": "UNICEF"})
DEF, __ = Project.objects.get_or_create(slug="default-project", organization=UNICEF)

Project.objects.filter(organization__isnull=True).update(organization=UNICEF)
Registration.objects.filter(project__isnull=True).update(project=DEF)
FlexForm.objects.filter(project__isnull=True).update(project=DEF)

with cache.lock(env("MIGRATION_LOCK_KEY"), timeout=60 * 10, blocking_timeout=2, version=VERSION):
if migrate:
if verbosity >= 1:
click.echo("Run migrations")
call_command("migrate", **extra)
call_command("create_extra_permissions")

# ensure project/org
click.echo("Set default Org/Project")
UNICEF, __ = Organization.objects.get_or_create(slug="unicef", defaults={"name": "UNICEF"})
DEF, __ = Project.objects.get_or_create(slug="default-project", organization=UNICEF)

Project.objects.filter(organization__isnull=True).update(organization=UNICEF)
Registration.objects.filter(project__isnull=True).update(project=DEF)
FlexForm.objects.filter(project__isnull=True).update(project=DEF)

static_root = Path(env("STATIC_ROOT"))
if not static_root.exists():
static_root.mkdir(parents=True)
Expand Down

0 comments on commit 8350677

Please sign in to comment.