From 43fc4c0e102775addbf9c9c83808bf978761cef9 Mon Sep 17 00:00:00 2001 From: "Silvio J. Gutierrez" Date: Tue, 30 Apr 2024 14:02:10 -0400 Subject: [PATCH 1/8] Fix Nix symlink regression --- .github/actions/setup/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 134b34ac..4691e950 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -2,7 +2,7 @@ name: "Setup" runs: using: "composite" steps: - - uses: cachix/install-nix-action@v22 + - uses: cachix/install-nix-action@v26 with: nix_path: nixpkgs=channel:nixos-unstable - name: Cache .venv From b3575ca50a7dc1a069e30809c98e6b7f0152e847 Mon Sep 17 00:00:00 2001 From: "Silvio J. Gutierrez" Date: Tue, 30 Apr 2024 14:16:29 -0400 Subject: [PATCH 2/8] actual fix --- packages/create-django-app/scripts/create-django-app.sh | 2 +- packages/create-django-app/scripts/sync-development.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/create-django-app/scripts/create-django-app.sh b/packages/create-django-app/scripts/create-django-app.sh index b8dea535..4f863246 100755 --- a/packages/create-django-app/scripts/create-django-app.sh +++ b/packages/create-django-app/scripts/create-django-app.sh @@ -22,7 +22,7 @@ fi cp -RT "$SCRIPT_PATH/../template" "$PROJECT_NAME" chmod -R u+w "$PROJECT_NAME" -ln -s localhost.py "$PROJECT_NAME/server/settings/__init__.py" +# ln -s localhost.py "$PROJECT_NAME/server/settings/__init__.py" cd "$PROJECT_NAME" || exit mv gitignore.template .gitignore diff --git a/packages/create-django-app/scripts/sync-development.sh b/packages/create-django-app/scripts/sync-development.sh index 5ef38539..f5137417 100755 --- a/packages/create-django-app/scripts/sync-development.sh +++ b/packages/create-django-app/scripts/sync-development.sh @@ -8,6 +8,7 @@ cd "$SCRIPT_PATH/../" rm -rf template mkdir template rsync -a --filter=':- .gitignore' ../../development/ template/ +ln -s localhost.py template/settings/__init__.py cp ../../requirements.nix template sed -i s#../requirements#./requirements# template/shell.nix sed -i s#../node_modules#./node_modules# template/.eslintrc.json From dedde16fe026b75c728c99212961be69a6306272 Mon Sep 17 00:00:00 2001 From: "Silvio J. Gutierrez" Date: Tue, 30 Apr 2024 14:20:27 -0400 Subject: [PATCH 3/8] Again --- packages/create-django-app/scripts/sync-development.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-django-app/scripts/sync-development.sh b/packages/create-django-app/scripts/sync-development.sh index f5137417..01467284 100755 --- a/packages/create-django-app/scripts/sync-development.sh +++ b/packages/create-django-app/scripts/sync-development.sh @@ -8,10 +8,10 @@ cd "$SCRIPT_PATH/../" rm -rf template mkdir template rsync -a --filter=':- .gitignore' ../../development/ template/ -ln -s localhost.py template/settings/__init__.py cp ../../requirements.nix template sed -i s#../requirements#./requirements# template/shell.nix sed -i s#../node_modules#./node_modules# template/.eslintrc.json rm template/server/settings/__init__.py +ln -s localhost.py template/settings/__init__.py rm template/package.json cp template/.gitignore template/gitignore.template From 63e4dc87c433003d90e3792a6bd6830df977752c Mon Sep 17 00:00:00 2001 From: "Silvio J. Gutierrez" Date: Tue, 30 Apr 2024 14:21:07 -0400 Subject: [PATCH 4/8] Does this work --- packages/create-django-app/scripts/sync-development.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-django-app/scripts/sync-development.sh b/packages/create-django-app/scripts/sync-development.sh index 01467284..49278ca4 100755 --- a/packages/create-django-app/scripts/sync-development.sh +++ b/packages/create-django-app/scripts/sync-development.sh @@ -12,6 +12,6 @@ cp ../../requirements.nix template sed -i s#../requirements#./requirements# template/shell.nix sed -i s#../node_modules#./node_modules# template/.eslintrc.json rm template/server/settings/__init__.py -ln -s localhost.py template/settings/__init__.py +ln -fs localhost.py template/settings/__init__.py rm template/package.json cp template/.gitignore template/gitignore.template From 76da4f51a4d4e74735eac9ea1cf8e70340798cb6 Mon Sep 17 00:00:00 2001 From: "Silvio J. Gutierrez" Date: Tue, 30 Apr 2024 14:24:02 -0400 Subject: [PATCH 5/8] But if I revert it works? --- .github/actions/setup/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 4691e950..134b34ac 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -2,7 +2,7 @@ name: "Setup" runs: using: "composite" steps: - - uses: cachix/install-nix-action@v26 + - uses: cachix/install-nix-action@v22 with: nix_path: nixpkgs=channel:nixos-unstable - name: Cache .venv From 86ea46e7df75362e2ac7358fb29c8f62de21223d Mon Sep 17 00:00:00 2001 From: "Silvio J. Gutierrez" Date: Tue, 30 Apr 2024 14:38:49 -0400 Subject: [PATCH 6/8] Try this --- .github/actions/setup/action.yaml | 2 +- packages/create-django-app/scripts/sync-development.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 134b34ac..4691e950 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -2,7 +2,7 @@ name: "Setup" runs: using: "composite" steps: - - uses: cachix/install-nix-action@v22 + - uses: cachix/install-nix-action@v26 with: nix_path: nixpkgs=channel:nixos-unstable - name: Cache .venv diff --git a/packages/create-django-app/scripts/sync-development.sh b/packages/create-django-app/scripts/sync-development.sh index 49278ca4..4dcf9ab5 100755 --- a/packages/create-django-app/scripts/sync-development.sh +++ b/packages/create-django-app/scripts/sync-development.sh @@ -12,6 +12,6 @@ cp ../../requirements.nix template sed -i s#../requirements#./requirements# template/shell.nix sed -i s#../node_modules#./node_modules# template/.eslintrc.json rm template/server/settings/__init__.py -ln -fs localhost.py template/settings/__init__.py +ln -s localhost.py template/server/settings/__init__.py rm template/package.json cp template/.gitignore template/gitignore.template From 9e04258f580e13e2ef39c276dfc8e7555ae88c5a Mon Sep 17 00:00:00 2001 From: "Silvio J. Gutierrez" Date: Tue, 30 Apr 2024 14:51:20 -0400 Subject: [PATCH 7/8] Tmate --- .github/actions/setup/action.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 4691e950..15f8477a 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -51,3 +51,6 @@ runs: if: runner.os == 'Linux' run: nix-shell --command "pip install greenlet==3.0.3 --no-binary greenlet --force-reinstall" shell: bash + - name: Setup tmate session + if: runner.os == 'macOS' + uses: mxschmitt/action-tmate@v3 From e821f6f13c19dddc0bb57618aa9d8094787d1cf6 Mon Sep 17 00:00:00 2001 From: "Silvio J. Gutierrez" Date: Thu, 2 May 2024 23:30:29 -0400 Subject: [PATCH 8/8] A better attempt --- development/Dockerfile | 2 +- packages/create-django-app/scripts/sync-development.sh | 1 - packages/reactivated/scripts/setup_environment.sh | 7 +++++++ website/Dockerfile | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/development/Dockerfile b/development/Dockerfile index 724cf19f..0142afe7 100644 --- a/development/Dockerfile +++ b/development/Dockerfile @@ -65,7 +65,7 @@ COPY --from=builder /app/collected collected ENV PYTHONUNBUFFERED 1 ENV PATH="/app/.venv/bin:$PATH" ENV ENVIRONMENT=production -RUN rm server/settings/__init__.py && echo 'export DJANGO_SETTINGS_MODULE=server.settings.$ENVIRONMENT' > /etc/profile +RUN rm -f server/settings/__init__.py && echo 'export DJANGO_SETTINGS_MODULE=server.settings.$ENVIRONMENT' > /etc/profile ENTRYPOINT ["/bin/sh", "-lc"] # SSH commands are weird with fly for now, so we use this dirty script at the root level. RUN echo "source /etc/profile; cd /app; python manage.py migrate" > /migrate.sh && chmod +x /migrate.sh diff --git a/packages/create-django-app/scripts/sync-development.sh b/packages/create-django-app/scripts/sync-development.sh index 4dcf9ab5..5ef38539 100755 --- a/packages/create-django-app/scripts/sync-development.sh +++ b/packages/create-django-app/scripts/sync-development.sh @@ -12,6 +12,5 @@ cp ../../requirements.nix template sed -i s#../requirements#./requirements# template/shell.nix sed -i s#../node_modules#./node_modules# template/.eslintrc.json rm template/server/settings/__init__.py -ln -s localhost.py template/server/settings/__init__.py rm template/package.json cp template/.gitignore template/gitignore.template diff --git a/packages/reactivated/scripts/setup_environment.sh b/packages/reactivated/scripts/setup_environment.sh index d9d3828d..e54db098 100755 --- a/packages/reactivated/scripts/setup_environment.sh +++ b/packages/reactivated/scripts/setup_environment.sh @@ -20,6 +20,13 @@ export PGDATABASE="database" export PGHOST=$TMP_ENV EXTERNAL_PID="$TMP_ENV/postmaster.pid" +settings_file="server/settings/__init__.py" + +# Temporary fix with Nix issues. +if [ ! -f "$settings_file" ]; then + ln -s localhost.py "$settings_file" +fi + if [ ! -d "$VIRTUAL_ENV" ]; then if [ -f "$EXTERNAL_PID" ]; then kill -9 "$(cat "$EXTERNAL_PID")" diff --git a/website/Dockerfile b/website/Dockerfile index ebfffecd..ead1e5a4 100644 --- a/website/Dockerfile +++ b/website/Dockerfile @@ -69,7 +69,7 @@ COPY --from=builder /app/collected collected ENV PYTHONUNBUFFERED 1 ENV PATH="/app/.venv/bin:$PATH" ENV ENVIRONMENT=production -RUN rm server/settings/__init__.py && echo 'export DJANGO_SETTINGS_MODULE=server.settings.$ENVIRONMENT' > /etc/profile +RUN rm -f server/settings/__init__.py && echo 'export DJANGO_SETTINGS_MODULE=server.settings.$ENVIRONMENT' > /etc/profile ENTRYPOINT ["/bin/sh", "-lc"] # SSH commands are weird with fly for now, so we use this dirty script at the root level. RUN echo "source /etc/profile; cd /app; python manage.py migrate" > /migrate.sh && chmod +x /migrate.sh