Skip to content

Commit

Permalink
Tested and now docker works
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Mario committed Mar 6, 2024
1 parent ee57908 commit 7c64de4
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 112 deletions.
223 changes: 111 additions & 112 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,121 +1,120 @@
version: '3'
services:
mongodb:
container_name: mongodb-${teamname:-defaultASW}
image: mongo
profiles: ["dev", "prod"]
volumes:
- mongodb_data:/data/db
ports:
- "27017:27017"
networks:
- mynetwork
version: '3'
services:
mongodb:
container_name: mongodb-${teamname:-defaultASW}
image: mongo
profiles: ["dev", "prod"]
volumes:
- mongodb_data:/data/db
ports:
- "27017:27017"
networks:
- mynetwork

authservice:
container_name: authservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/authservice:latest
profiles: ["dev", "prod"]
build: ./users/authservice
depends_on:
- mongodb
ports:
- "8002:8002"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb
authservice:
container_name: authservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/authservice:latest
profiles: ["dev", "prod"]
build: ./users/authservice
depends_on:
- mongodb
ports:
- "8002:8002"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

userservice:
container_name: userservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/userservice:latest
profiles: ["dev", "prod"]
build: ./users/userservice
depends_on:
- mongodb
ports:
- "8001:8001"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb
userservice:
container_name: userservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/userservice:latest
profiles: ["dev", "prod"]
build: ./users/userservice
depends_on:
- mongodb
ports:
- "8001:8001"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

gatewayservice:
container_name: gatewayservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/gatewayservice:latest
profiles: ["dev", "prod"]
build: ./gatewayservice
depends_on:
- mongodb
- userservice
- authservice
ports:
- "8000:8000"
networks:
- mynetwork
environment:
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001
backend:
container_name: backend_wiq-${teamname:-defaultASW}
profiles: ["dev", "prod"]
build:
context: ./backend/wiq
dockerfile: Dockerfile
ports:
- 8090:8090

webapp:
container_name: webapp-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/webapp:latest
profiles: ["dev", "prod"]
build: ./webapp
depends_on:
- gatewayservice
ports:
- "3000:3000"
gatewayservice:
container_name: gatewayservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/gatewayservice:latest
profiles: ["dev", "prod"]
build: ./gatewayservice
depends_on:
- mongodb
- userservice
- authservice
- backend
ports:
- "8000:8000"
networks:
- mynetwork
environment:
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001

prometheus:
image: prom/prometheus
container_name: prometheus-${teamname:-defaultASW}
profiles: ["dev"]
networks:
- mynetwork
volumes:
- ./gatewayservice/monitoring/prometheus:/etc/prometheus
- prometheus_data:/prometheus
ports:
- "9090:9090"
depends_on:
- gatewayservice

grafana:
image: grafana/grafana
container_name: grafana-${teamname:-defaultASW}
profiles: ["dev"]
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
webapp:
container_name: webapp-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/webapp:latest
profiles: ["dev", "prod"]
build: ./webapp
depends_on:
- gatewayservice
ports:
- "3000:3000"

backend:
build:
context: ./backend/wiq
dockerfile: Dockerfile
container_name: backend_wiq-${teamname:-defaultASW}
profiles: ["dev", "prod"]
depends_on:
- gatewayservice
ports:
- 8090:8090
prometheus:
image: prom/prometheus
container_name: prometheus-${teamname:-defaultASW}
profiles: ["dev"]
networks:
- mynetwork
volumes:
- ./gatewayservice/monitoring/prometheus:/etc/prometheus
- prometheus_data:/prometheus
ports:
- "9090:9090"
depends_on:
- gatewayservice

grafana:
image: grafana/grafana
container_name: grafana-${teamname:-defaultASW}
profiles: ["dev"]
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


volumes:
mongodb_data:
prometheus_data:
grafana_data:
volumes:
mongodb_data:
prometheus_data:
grafana_data:

networks:
mynetwork:
driver: bridge
networks:
mynetwork:
driver: bridge
11 changes: 11 additions & 0 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const port = 8000;

const authServiceUrl = process.env.AUTH_SERVICE_URL || 'http://localhost:8002';
const userServiceUrl = process.env.USER_SERVICE_URL || 'http://localhost:8001';
const backendServiceUrl = process.env.BACKEND_SERVICE_URL || 'http://localhost:8090';

app.use(cors());
app.use(express.json());
Expand Down Expand Up @@ -41,6 +42,16 @@ app.post('/adduser', async (req, res) => {
}
});

/*app.get('/question', async (req, res) => {
try {
// Forward the add backend request to the backend service
const backendResponse = await axios.get(backendServiceUrl+'/question', req.body);
res.json(backendResponse.data);
} catch (error) {
res.status(error.response.status).json({ error: error.response.data.error });
}
});*/

// Start the gateway service
const server = app.listen(port, () => {
console.log(`Gateway Service listening at http://localhost:${port}`);
Expand Down

0 comments on commit 7c64de4

Please sign in to comment.