Skip to content

Commit

Permalink
feat: added metaploy config
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Jul 11, 2024
1 parent 12e4907 commit 7b98b25
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY metaploy/ ./

RUN chmod +x ./postinstall.sh

COPY . .

CMD [ "gunicorn", "--bind", "0.0.0.0:8000", "wsgi:app" ]
CMD [ "./postinstall.sh", "gunicorn", "--bind", "0.0.0.0:8000", "wsgi:app" ]
2 changes: 0 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ services:
container_name: gyfe-api
build: .
restart: always
ports:
- 8000:8000
networks:
metaploy-network:
aliases:
Expand Down
16 changes: 16 additions & 0 deletions metaploy/gyfe-api.metaploy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
upstream gyfe_api {
server gyfe-api:8000;
}

server {
server_name gyfe-api.metakgp.org;

location / {
proxy_pass http://gyfe_api;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
14 changes: 14 additions & 0 deletions metaploy/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

cleanup() {
echo "Container stopped. Removing nginx configuration."
rm /etc/nginx/sites-enabled/gyfe-api.metaploy.conf
}

trap 'cleanup' SIGQUIT SIGTERM SIGHUP

"${@}" &

cp ./gyfe-api.metaploy.conf /etc/nginx/sites-enabled

wait $!

0 comments on commit 7b98b25

Please sign in to comment.