Skip to content

Commit

Permalink
build(docker): move common parts to docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablito2020 committed Oct 23, 2023
1 parent 4009ca6 commit f03f834
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 107 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ BACKEND_DB_PORT=5432
BACKEND_DB_HOST=localhost
BACKEND_JWT_KEY=fnefthANWsJzOeitxbVhcxfmYdKZMGNY4ieclwBuTl7Mvp1qhwSEKjFB7pOX7X7iaAnS67
FRONTEND_MAPS_API_KEY=your-api-key-here
FRONTEND_API_URL=https://backend.refuapp.pofnet.net
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ jobs:
port: 22
script: |
cd ${{ secrets.PATH_TO_SAVE }}
echo "source .env\nexport FRONTEND_MAPS_API_KEY=${{ secrets.FRONTEND_MAPS_API_KEY }}\ndocker-compose pull\ndocker-compose up -d --build" > run.sh
echo "source .env\nexport FRONTEND_MAPS_API_KEY=${{ secrets.FRONTEND_MAPS_API_KEY }}\ndocker-compose pull\ndocker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build" > run.sh
chmod +x run.sh
/bin/bash run.sh
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

This repository contains all the services you need for running an instance of RefuApp!

## Running Locally 🏠🚀
## Running Locally 💻🚀
You can run refuapp locally with docker compose with the following command:

```shell
docker-compose -f docker-compose-local.yml up -d --build
git clone --recursive [email protected]:RefuAPP/refuapp.git
docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d --build
```

## Deploy 🌎💫
Expand Down
72 changes: 0 additions & 72 deletions docker-compose-local.yml

This file was deleted.

20 changes: 20 additions & 0 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3'
services:

refuapp-backend:
ports:
- "8000:8000"

refuapp-frontend:
build:
args:
- BACKEND_URL=http://localhost:8000
ports:
- '80:80'

refuapp-admin-frontend:
build:
args:
- BACKEND_URL=http://localhost:8000
ports:
- '81:80'
46 changes: 46 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3'
services:

refuapp-frontend:
build:
args:
- BACKEND_URL=${FRONTEND_API_URL}

refuapp-admin-frontend:
build:
args:
- BACKEND_URL=${FRONTEND_API_URL}

postgres:
volumes:
- postgres_data:/var/lib/postgresql/data

nginxproxymanager:
image: 'jc21/nginx-proxy-manager:latest'
container_name: nginxproxymanager
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./proxy-manager/data:/data
- ./proxy-manager/letsencrypt:/etc/letsencrypt

sensors_db:
volumes:
- postgres_sensor_data:/var/lib/postgresql/data

volumes:
postgres_data:
driver: local
driver_opts:
type: none
device: /home/ferran/data
o: bind
postgres_sensor_data:
driver: local
driver_opts:
type: none
device: /home/ferran/data-sensors
o: bind
33 changes: 1 addition & 32 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ services:
POSTGRES_DB: ${BACKEND_DB_NAME}
POSTGRES_USER: ${BACKEND_DB_USER}
POSTGRES_PASSWORD: ${BACKEND_DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data

refuapp-backend:
build:
Expand All @@ -32,7 +30,6 @@ services:
dockerfile: Dockerfile
args:
- MAPS_API_KEY=${FRONTEND_MAPS_API_KEY}
- BACKEND_URL=https://backend.refuapp.pofnet.net
depends_on:
- refuapp-backend

Expand All @@ -41,30 +38,16 @@ services:
context: ./refuapp-admin
dockerfile: Dockerfile
args:
- BACKEND_URL=https://backend.refuapp.pofnet.net
- BACKEND_URL=${FRONTEND_API_URL}
depends_on:
- refuapp-backend

nginxproxymanager:
image: 'jc21/nginx-proxy-manager:latest'
container_name: nginxproxymanager
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./proxy-manager/data:/data
- ./proxy-manager/letsencrypt:/etc/letsencrypt

sensors_db:
image: postgres:latest
environment:
POSTGRES_DB: ${SENSORS_DB_NAME}
POSTGRES_USER: ${SENSORS_DB_USER}
POSTGRES_PASSWORD: ${SENSORS_DB_PASS}
volumes:
- postgres_sensor_data:/var/lib/postgresql/data

refuapp-sensor-backend:
build:
Expand All @@ -80,17 +63,3 @@ services:
DB_PORT: ${SENSORS_DB_PORT}
depends_on:
- sensors_db

volumes:
postgres_data:
driver: local
driver_opts:
type: none
device: /home/ferran/data
o: bind
postgres_sensor_data:
driver: local
driver_opts:
type: none
device: /home/ferran/data-sensors
o: bind

0 comments on commit f03f834

Please sign in to comment.