Skip to content

Commit

Permalink
Merge branch 'augustocristian-dev_dockercompose'
Browse files Browse the repository at this point in the history
  • Loading branch information
pglez82 committed Jan 17, 2024
2 parents 9efe277 + 3d8053d commit 4a2257b
Show file tree
Hide file tree
Showing 19 changed files with 15,228 additions and 11,315 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
teamname="asw2324_0"
47 changes: 47 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
# Maintain the npm dependencies of the frontend
- package-ecosystem: "docker" # See documentation for possible values
directory: "/webapp" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "npm" # See documentation for possible values
directory: "/webapp" # Location of package manifests
schedule:
interval: "weekly"
# Maintain the npm dependencies of the GatewayService
- package-ecosystem: "docker" # See documentation for possible values
directory: "/gatewayservice" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "npm" # See documentation for possible values
directory: "/gatewayservice" # Location of package manifests
schedule:
interval: "weekly"
# Maintain the npm dependencies of the authservice
- package-ecosystem: "docker" # See documentation for possible values
directory: "/users/authservice" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "npm" # See documentation for possible values
directory: "/users/authservice" # Location of package manifests
schedule:
interval: "weekly"
# Maintain the npm dependencies of the userservice
- package-ecosystem: "docker" # See documentation for possible values
directory: "/users/userservice" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "npm" # See documentation for possible values
directory: "/users/userservice" # Location of package manifests
schedule:
interval: "weekly"
29 changes: 14 additions & 15 deletions .github/workflows/asw2324.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- run: npm --prefix users/authservice ci
- run: npm --prefix users/userservice ci
- run: npm --prefix gatewayservice ci
Expand All @@ -29,10 +29,10 @@ jobs:
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- run: npm --prefix users/authservice install
- run: npm --prefix users/userservice install
- run: npm --prefix gatewayservice install
Expand All @@ -47,7 +47,7 @@ jobs:
packages: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
env:
Expand All @@ -67,7 +67,7 @@ jobs:
packages: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
Expand All @@ -84,7 +84,7 @@ jobs:
packages: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
Expand All @@ -101,7 +101,7 @@ jobs:
packages: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
Expand All @@ -122,8 +122,7 @@ jobs:
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
command: |
wget https://raw.githubusercontent.com/pglez82/asw2324_0/master/docker-compose-deploy.yml -O docker-compose.yml
docker-compose stop
docker-compose rm -f
docker-compose pull
docker-compose up -d
wget https://raw.githubusercontent.com/pglez82/asw2324_0/master/docker-compose.yml
wget https://raw.githubusercontent.com/pglez82/asw2324_0/master/docker-compose-deploy.override.yml.yml
docker compose down
docker compose -f docker-compose.yml -f docker-compose-dev.override.yml up -d
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Both the user and auth service share a Mongo database that is accessed with mong
The fastest way for launching this sample project is using docker. Just clone the project:
```git clone git@github.com:pglez82/asw2324_0.git```
and launch it with docker compose:
```docker-compose up --build```
```docker compose -f docker-compose.yml -f docker-compose-dev.override.yml up --build```

### Component by component start
First, start the database. Either install and run Mongo or run it using docker:
Expand Down Expand Up @@ -87,10 +87,8 @@ deploy:
key: ${{ secrets.DEPLOY_KEY }}
command: |
wget https://raw.githubusercontent.com/pglez82/asw2324_0/master/docker-compose-deploy.yml -O docker-compose.yml
docker-compose stop
docker-compose rm -f
docker-compose pull
docker-compose up -d
docker compose down --volumes
docker compose -f docker-compose.yml -f docker-compose-deploy.override.yml up -d
```
This action uses three secrets that must be configured in the repository:
Expand Down
19 changes: 0 additions & 19 deletions docker-compose-deploy.yml → docker-compose-deploy.override.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,41 @@
version: '3'
services:
mongodb:
image: mongo
ports:
- "27017:27017"
networks:
- mynetwork
volumes:
- mongodb_data:/data/db

authservice:
image: ghcr.io/pglez82/asw2324_0/authservice:latest
ports:
- "8002:8002"
networks:
- mynetwork
depends_on:
- mongodb
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

userservice:
image: ghcr.io/pglez82/asw2324_0/userservice:latest
ports:
- "8001:8001"
networks:
- mynetwork
depends_on:
- mongodb
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

gatewayservice:
image: ghcr.io/pglez82/asw2324_0/gatewayservice:latest
ports:
- "8000:8000"
networks:
- mynetwork
depends_on:
- mongodb
- userservice
- authservice
environment:
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001

webapp:
image: ghcr.io/pglez82/asw2324_0/webapp:latest
ports:
- "3000:3000"
depends_on:
- gatewayservice

networks:
mynetwork:
driver: bridge

volumes:
mongodb_data:
81 changes: 81 additions & 0 deletions docker-compose-dev.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: '3'
services:
mongodb:
image: mongo
ports:
- "27017:27017"
networks:
- mynetwork
volumes:
- mongodb_data:/data/db

authservice:
build: ./users/authservice
ports:
- "8002:8002"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

userservice:
build: ./users/userservice
ports:
- "8001:8001"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

gatewayservice:
build: ./gatewayservice
ports:
- "8000:8000"
networks:
- mynetwork
environment:
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001

webapp:
build: ./webapp
ports:
- "3000:3000"

prometheus:
image: prom/prometheus
networks:
- mynetwork
volumes:
- ./gatewayservice/monitoring/prometheus:/etc/prometheus
- prometheus_data:/prometheus
ports:
- "9090:9090"
depends_on:
- gatewayservice

grafana:
image: grafana/grafana
networks:
- mynetwork
volumes:
- grafana_data:/var/lib/grafana
- ./gatewayservice/monitoring/grafana/provisioning:/etc/grafana/provisioning
environment:
- GF_SERVER_HTTP_PORT=9091
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
ports:
- "9091:9091"
depends_on:
- prometheus

networks:
mynetwork:
driver: bridge

volumes:
mongodb_data:
prometheus_data:
grafana_data:
72 changes: 11 additions & 61 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,40 @@
version: '3'
services:
mongodb:
container_name: mongodb-${teamname:-defaultASW}
image: mongo
ports:
- "27017:27017"
networks:
- mynetwork
volumes:
- mongodb_data:/data/db

authservice:
container_name: authservice-${teamname:-defaultASW}
image: ghcr.io/pglez82/asw2324_0/authservice:latest
build: ./users/authservice
ports:
- "8002:8002"
networks:
- mynetwork
depends_on:
- mongodb
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

userservice:
container_name: userservice-${teamname:-defaultASW}
image: ghcr.io/pglez82/asw2324_0/userservice:latest
build: ./users/userservice
ports:
- "8001:8001"
networks:
- mynetwork
depends_on:
- mongodb
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

gatewayservice:
container_name: gatewayservice-${teamname:-defaultASW}
image: ghcr.io/pglez82/asw2324_0/gatewayservice:latest
build: ./gatewayservice
ports:
- "8000:8000"
networks:
- mynetwork
depends_on:
- mongodb
- authservice
- userservice
environment:
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001

- authservice

webapp:
container_name: webapp-${teamname:-defaultASW}
image: ghcr.io/pglez82/asw2324_0/webapp:latest
build: ./webapp
ports:
- "3000:3000"
depends_on:
- gatewayservice

prometheus:
image: prom/prometheus
networks:
- mynetwork
volumes:
- ./gatewayservice/monitoring/prometheus:/etc/prometheus
- prometheus_data:/prometheus
ports:
- "9090:9090"
depends_on:
- gatewayservice
grafana:
image: grafana/grafana
networks:
- mynetwork
volumes:
- grafana_data:/var/lib/grafana
- ./gatewayservice/monitoring/grafana/provisioning:/etc/grafana/provisioning
environment:
- GF_SERVER_HTTP_PORT=9091
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
ports:
- "9091:9091"
depends_on:
- prometheus

networks:
mynetwork:
driver: bridge

volumes:
mongodb_data:
prometheus_data:
grafana_data:
Loading

0 comments on commit 4a2257b

Please sign in to comment.