Skip to content
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
14 changes: 14 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ jobs:
- name: Run E2E tests
run: docker compose run --rm tests

- name: Serve on GEO_PORT as a non-root user
run: |
docker run -d --name geo-port --user 82:82 --cap-drop ALL \
--sysctl net.ipv4.ip_unprivileged_port_start=1024 \
-e GEO_PORT=8081 -e GEO_SECRET=test-secret -p 8081:8081 geo-dev
for i in $(seq 1 30); do
if curl -sf http://localhost:8081/v1/health; then
exit 0
fi
sleep 1
done
docker logs geo-port
exit 1

- name: Show logs on failure
if: failure()
run: docker compose logs geo
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ COPY ./src /usr/src/code/src
EXPOSE 80

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD php -r "exit(str_contains(file_get_contents('http://localhost:80/v1/health'), 'ok') ? 0 : 1);"
CMD php -r "exit(str_contains(file_get_contents('http://localhost:' . (getenv('GEO_PORT') ?: '80') . '/v1/health'), 'ok') ? 0 : 1);"

CMD ["php", "app/http.php"]
2 changes: 1 addition & 1 deletion src/Geo/Server/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(?Http $http = null)
$http ??= new Http(
new SwooleServer(
host: '0.0.0.0',
port: '80',
port: (string) System::getEnv('GEO_PORT', '80'),
Comment thread
hansi-codes[bot] marked this conversation as resolved.
Resolved
settings: [
'enable_coroutine' => true,
],
Expand Down
Loading