Skip to content

Commit

Permalink
Fix reverse proxy invalid redirection
Browse files Browse the repository at this point in the history
Add new env var
  • Loading branch information
Alvarwow69 committed Oct 28, 2022
1 parent f6b4d6a commit 03bfe46
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
11 changes: 11 additions & 0 deletions ci/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ app.post('/payload', (req, res) => {
});

app.post('/ci_deploy', (req, res) => {
console.info(prefix("ARKultur") + "Endpoint: /ci_deploy targeted");
const name = req.body.repository.name;
if (!req.body.workflow_run) {
console.info(prefix("ARKultur") + "Not a workflow event");
res.status(200).send();
return;
}
const branch = req.body.workflow_run.head_branch;

if (canDeploy(req, name))
Expand All @@ -85,6 +91,11 @@ app.post('/ci_deploy', (req, res) => {
res.status(200).send();
})

app.get('/ci_deploy/ping', (req, res) => {
console.info(prefix("ARKultur") + "Endpoint: /ci_deploy/ping targeted");
res.status(200).send({message: "Pong"});
})

app.listen(port, () => {
console.log(prefix("ARKultur") + "Now listening on port " + port);
if (!Process.env.CI_BRANCH)
Expand Down
8 changes: 4 additions & 4 deletions configs/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
email [email protected]
}

arkultur.creative-rift.com {
route /ci_deploy {
reverse_proxy localhost:4567
}
{$SITE_DOMAIN:localhost} {
route /ci_deploy* {
reverse_proxy {$SITE_ADDRESS:localhost}:4567
}

route /api/* {
reverse_proxy api:8080
Expand Down
7 changes: 5 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ services:
volumes:
- ./configs/Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
environment:
- SITE_ADDRESS=${SITE_ADDRESS}
- SITE_DOMAIN=${SITE_DOMAIN}
restart: unless-stopped

db:
Expand All @@ -27,7 +30,7 @@ services:
restart: unless-stopped

web:
image: bogdzn/theed:canon
image: bogdzn/theed:${CI_BRANCH}
container_name: theed
ports:
- "3000:3000"
Expand All @@ -36,7 +39,7 @@ services:
restart: unless-stopped

api:
image: bogdzn/naboo:canon
image: bogdzn/naboo:${CI_BRANCH}
container_name: naboo
env_file:
- .env-api
Expand Down

0 comments on commit 03bfe46

Please sign in to comment.