diff --git a/.env.sample b/.env.sample index 032b8fa..40dd2aa 100644 --- a/.env.sample +++ b/.env.sample @@ -2,6 +2,7 @@ VERSION=0.1.0 DEVELOPMENT=false HOST_NAME=vim.linkedmusic.ca +PORT=8000 ## DATABASE ## POSTGRES_DB=virtual_instrument_museum diff --git a/README.md b/README.md index 7ed5e7e..82f59b7 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ NOTE: These instructions are for local development only. Refer to the "Installat VIM requires Docker Engine with Compose V2. VIM's Docker Compose configuration is written according to the Compose Specification. -After cloning this repository, set up a local `.env` file. Copy or rename the `.env.sample` file to `.env` and update it to include uncommented environment variables for database credentials `POSTGRES_USER` and `POSTGRES_PASSWORD`. Verify the values of the `DEVELOPMENT` and `HOST_NAME` variables. For local development ONLY, these should be set to "true" and "localhost" respectively. +After cloning this repository, set up a local `.env` file. Copy or rename the `.env.sample` file to `.env` and update it to include uncommented environment variables for database credentials `POSTGRES_USER` and `POSTGRES_PASSWORD`. Verify the values of the `DEVELOPMENT`, `HOST_NAME`, and `PORT` variables. For local development ONLY, these should be set to "true", "localhost", and "8000" respectively. ```console > docker compose build @@ -41,7 +41,7 @@ VIM requires Docker Engine with Compose V2. Ensure that the remote server has th SSH into the server. After cloning the repository, set up a local `.env` file. Copy or rename the `.env.sample` file to `.env` and update it to include uncommented environment variables for database credentials `POSTGRES_USER` and `POSTGRES_PASSWORD`. Ensure that `POSTGRES_PASSWORD` is secure. -Ensure that the `DEVELOPMENT` variable is set to "false", and that `HOST_NAME` is set to the host name where the VIM instance will be served (for example, "vim.linkedmusic.ca" or "vim.staging.linkedmusic.ca"). +Ensure that the `DEVELOPMENT` variable is set to "false", and that `HOST_NAME` is set to the host name where the VIM instance will be served (for example, "vim.linkedmusic.ca" or "vim.staging.linkedmusic.ca"). Set the `PORT` variable to "80". Then, run diff --git a/docker-compose.yml b/docker-compose.yml index eb0171d..165468e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,7 +44,7 @@ services: environment: - HOST_NAME=${HOST_NAME} ports: - - "8000:80" + - "${PORT}:80" volumes: - vim-static:/virtual-instrument-museum/static depends_on: diff --git a/web-app/django/VIM/settings.py b/web-app/django/VIM/settings.py index 93410b0..af76145 100644 --- a/web-app/django/VIM/settings.py +++ b/web-app/django/VIM/settings.py @@ -153,7 +153,5 @@ # DEPLOYMENT SETTINGS CSRF_COOKIE_SECURE = IS_PRODUCTION -CSRF_TRUSTED_ORIGINS = [ - f'http{"s" if IS_PRODUCTION else ""}://{os.environ.get("HOST_NAME")}' -] +CSRF_TRUSTED_ORIGINS = [f'https://{os.environ.get("HOST_NAME")}'] SESSION_COOKIE_SECURE = IS_PRODUCTION