Skip to content

Commit 33ef0b9

Browse files
committed
feat: add health check endpoint and update tailscale funnel configuration
1 parent b41b87a commit 33ef0b9

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

config/urls.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"""
1717
from django.contrib import admin
1818
from django.urls import path
19+
from . import views
1920

2021
urlpatterns = [
2122
path('admin/', admin.site.urls),
23+
path('', views.index, name='index'),
24+
path('health/', views.health, name='health'),
2225
]

config/views.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from django.http import HttpResponse, JsonResponse
2+
3+
4+
def index(request):
5+
return HttpResponse("Hello, world!")
6+
7+
8+
def health(request):
9+
return JsonResponse({"status": "ok"})

docker-compose.prod.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ services:
5050
sh -c "mkdir -p /var/run/tailscale &&
5151
tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/var/run/tailscale/tailscaled.sock &
5252
sleep 5 &&
53-
tailscale up --authkey=$${TS_AUTHKEY} --hostname=$${TS_HOSTNAME} --accept-routes &&
54-
tailscale serve --bg https+insecure / http://nginx:80 &&
53+
tailscale up --authkey=$${TS_AUTHKEY} --hostname=$${TS_HOSTNAME} --accept-routes --advertise-tags=tag:web-public &&
54+
tailscale funnel --bg http://nginx:80 &&
5555
wait"
5656
db:
5757
image: postgis/postgis:16-3.4
@@ -103,7 +103,7 @@ services:
103103
DOCKER_API_VERSION: "1.44"
104104
REPO_USER: ${GH_USERNAME}
105105
REPO_PASS: ${GH_PAT}
106-
command: --label-enable --interval 60 --cleanup
106+
command: --label-enable --interval 20 --cleanup
107107
restart: always
108108
volumes:
109109
postgres_data:

manage.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
#!/usr/bin/env python
2-
"""Django's command-line utility for administrative tasks."""
3-
import os
4-
import sys
5-
6-
7-
def main():
8-
"""Run administrative tasks."""
9-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
10-
try:
11-
from django.core.management import execute_from_command_line
12-
except ImportError as exc:
13-
raise ImportError(
14-
"Couldn't import Django. Are you sure it's installed and "
15-
"available on your PYTHONPATH environment variable? Did you "
16-
"forget to activate a virtual environment?"
17-
) from exc
18-
execute_from_command_line(sys.argv)
19-
20-
21-
if __name__ == '__main__':
22-
main()
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()

0 commit comments

Comments
 (0)