Skip to content

Commit

Permalink
Merge pull request #563 from kitspace/ag/hide-gitea
Browse files Browse the repository at this point in the history
Hide gitea
  • Loading branch information
kasbah authored Nov 13, 2023
2 parents 1311f1e + 06bfcbd commit ac5c80e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
13 changes: 11 additions & 2 deletions e2e/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,17 @@ Cypress.Commands.add('importRepo', (remoteUrl, repoName, user) => {
cy.createGiteaUser(user).then(giteaUser => {
cy.mirrorRepo(remoteUrl, repoName, giteaUser)
})
cy.waitForStatusCode(
`http://gitea.kitspace.test:3000/${user.username}/${repoName}`,

cy.waitUntil(
() =>
cy
.request({
url: `http://gitea.kitspace.test:3000/api/v1/repos/${user.username}/${repoName}`,
method: 'GET',
failOnStatusCode: false,
})
.then(response => response.body.empty !== false),
{ timeout: 60_000, interval: 1000 },
)
})

Expand Down
14 changes: 10 additions & 4 deletions nginx/kitspace.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ server {

server_name @KITSPACE_DOMAIN;

location /robots.txt {
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "@KITSPACE_ROBOTS_TXT";
}
Expand Down Expand Up @@ -35,12 +35,14 @@ server {

server_name gitea.@KITSPACE_DOMAIN;

location /robots.txt {
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "@KITSPACE_ROBOTS_TXT";
}

location ^~ / {
# Proxy api, and raw content requests to gitea, otherwise return 404.
# The raw content is for readme images.
location ~ ^/(api|[^/]+/[^/]+/raw)/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand All @@ -59,6 +61,10 @@ server {
}
proxy_pass http://gitea:3000;
}

location ~ / {
return 404;
}
}

server {
Expand All @@ -67,7 +73,7 @@ server {

server_name meilisearch.@KITSPACE_DOMAIN;

location /robots.txt {
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "@KITSPACE_ROBOTS_TXT";
}
Expand Down
2 changes: 1 addition & 1 deletion nginx/reachability_healthcheck
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ healthcheck() {
# Maeke sure that each service is reachable from external domain.s
if [ "$KITSPACE_DOMAIN" != "kitspace.test" ]; then
test_reachability "https://$KITSPACE_DOMAIN" "Kitspace" || report_healthcheck_failure "frontend is unreachable" || reload_nginx
test_reachability "https://gitea.$KITSPACE_DOMAIN" "Gitea" || report_healthcheck_failure "gitea is unreachable" || reload_nginx
test_reachability "https://gitea.$KITSPACE_DOMAIN/api/v1/settings/ui" "gitea" || report_healthcheck_failure "gitea is unreachable" || reload_nginx
test_reachability "https://meilisearch.$KITSPACE_DOMAIN" "Meilisearch" || report_healthcheck_failure "meilisearch is unreachable" || reload_nginx
fi
}
Expand Down

0 comments on commit ac5c80e

Please sign in to comment.