Skip to content

Commit

Permalink
flyio initial migration configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
alxkp committed Nov 12, 2023
1 parent e68b7de commit bebd738
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 4 deletions.
3 changes: 3 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fly.toml
.git/
*.sqlite3
3 changes: 0 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ WORKDIR /app/

# Install dependencies
RUN apt-get update \

# Clean up
RUN apt-get clean \
&& apt-get install --no-install-recommends -y python3.11-dev pipenv python3-distutils libpq-dev gcc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand Down
2 changes: 1 addition & 1 deletion backend/docker/nginx-default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ upstream django {

server {
listen 443;
server_name platform.pennlabs.org;
server_name platform-backend.fly.dev;

# FastCGI authorizer for Auth Request module
location = /shibauthorizer {
Expand Down
20 changes: 20 additions & 0 deletions backend/docker/platform-run
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
#!/bin/bash

# Check if the SHIBBOLETH_CERT environment variable is set
if [ -z "${SHIBBOLETH_CERT}" ]; then
echo "The required SHIBBOLETH_CERT environment variable is not set. Exiting."
exit 1
fi

# Check if the SHIBBOLETH_KEY environment variable is set
if [ -z "${SHIBBOLETH_KEY}" ]; then
echo "The required SHIBBOLETH_KEY environment variable is not set. Exiting."
exit 1
fi

# Write the SHIBBOLETH_CERT value to the sp-cert.pem file
echo "${SHIBBOLETH_CERT}" > /etc/shibboleth/sp-cert.pem
chmod 644 /etc/shibboleth/sp-cert.pem

# Write the SHIBBOLETH_KEY value to the sp-key.pem file
echo "${SHIBBOLETH_KEY}" > /etc/shibboleth/sp-key.pem
chmod 600 /etc/shibboleth/sp-key.pem

# Django Migrate
/usr/bin/python3 /app/manage.py migrate --noinput

Expand Down
25 changes: 25 additions & 0 deletions backend/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# fly.toml app configuration file generated for platform-backend on 2023-10-24T11:35:39-04:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "platform-backend"
primary_region = "ewr"

[build]
# image = "pennlabs/platform-backend:latest"
dockerfile = "Dockerfile"

[env]
PORT = "8080"

[http_service]
internal_port = 443
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1

[[statics]]
guest_path = "/code/static"
url_prefix = "/static/"
20 changes: 20 additions & 0 deletions frontend/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# fly.toml app configuration file generated for platform-frontend on 2023-10-31T09:32:36-04:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "platform-frontend"
primary_region = "ewr"

[build]
image = "pennlabs/platform-frontend:latest"

[env]
DOMAIN = "platform-backend.fly.dev"

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1

0 comments on commit bebd738

Please sign in to comment.