Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide gitea #563

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Comment on lines +65 to +67
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be taking precedence over /robots.txt. Maybe just remove the robots.txt location in the gitea server? If most things are 404 anyway then it's probably not needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in 2982097.

}

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
Loading