Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment fixes #66

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ VERSION=0.1.0

DEVELOPMENT=false
HOST_NAME=vim.linkedmusic.ca
PORT=8000

## DATABASE ##
POSTGRES_DB=virtual_instrument_museum
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
environment:
- HOST_NAME=${HOST_NAME}
ports:
- "8000:80"
- "${PORT}:80"
volumes:
- vim-static:/virtual-instrument-museum/static
depends_on:
Expand Down
4 changes: 1 addition & 3 deletions web-app/django/VIM/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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