Skip to content

Commit

Permalink
Other try
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiollende committed Mar 20, 2024
1 parent 6157f00 commit b45ee7b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,29 @@ jobs:
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

- name: Create .env file
run: echo "REACT_APP_API_ENDPOINT=http://${{ secrets.DEPLOY_HOST }}:8000" > webapp/.env

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
env:
API_URI: http://${{ secrets.DEPLOY_HOST }}:8000
REACT_APP_API_ENDPOINT: http://${{ secrets.DEPLOY_HOST }}:8000
teamname: wiq_en3a
with:
name: arquisoft/wiq_en3a/webapp
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: webapp
buildargs: API_URI
docker-push-wikidataservice:
buildargs: |
REACT_APP_API_ENDPOINT
docker-push-wikidata-service:
name: Push wikidata Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -76,7 +81,7 @@ jobs:
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-userservice,docker-push-gatewayservice,docker-push-webapp, docker-push-wikidataservice]
needs: [docker-push-userservice,docker-push-gatewayservice,docker-push-webapp, docker-push-wikidata-service]
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
Expand Down
11 changes: 7 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ services:
container_name: webapp-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en3a/webapp:latest
profiles: ["dev", "prod"]
build: ./webapp
depends_on:
- gatewayservice
build:
args:
REACT_APP_API_ENDPOINT: ${API_URI}
context: ./webapp
environment:
- REACT_APP_API_ENDPOINT=${API_URI}
ports:
- "3000:3000"
- "3000:3000"

prometheus:
image: prom/prometheus
Expand Down
6 changes: 3 additions & 3 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ app.get('/health', (_req, res) => {
res.json({ status: 'OK' });
});

app.post(userServiceUrl + '/login', async (req, res) => {
app.post('/login', async (req, res) => {
try {
// Forward the login request to the authentication service
const authResponse = await axios.post(userServiceUrl + '/auth/login', req.body);
Expand All @@ -31,7 +31,7 @@ app.post(userServiceUrl + '/login', async (req, res) => {
}
});

app.post(userServiceUrl + '/adduser', async (req, res) => {
app.post('/adduser', async (req, res) => {
try {
// Forward the add user request to the user service
const userResponse = await axios.post(userServiceUrl + '/user/adduser', req.body);
Expand All @@ -51,7 +51,7 @@ app.post('/edituser', async (req, res) => {
}
});

app.get(wikidataServiceUrl + '/WikiData/GetCapitalsQuestions', async (_req, res) => {
app.get('/WikiData/GetCapitalsQuestions', async (_req, res) => {
try {
// Forward the edit user request to the user service
const wikiResponse = await axios.get(wikidataServiceUrl+'/WikiData/GetCapitalsQuestions');
Expand Down

0 comments on commit b45ee7b

Please sign in to comment.