Skip to content

Commit

Permalink
Merge pull request #3 from City-of-Turku/deploy/deploy-configurations
Browse files Browse the repository at this point in the history
Deploy/deploy configurations
  • Loading branch information
juuso-j authored Feb 8, 2024
2 parents ce16831 + bda7d91 commit 643c683
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
2 changes: 0 additions & 2 deletions deploy/docker_uwsgi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
chdir = /mpbackend
# Django's wsgi file
module = mpbackend.wsgi
# full path to python virtual env
home = /mpbackend/env
uid = appuser
gid = root
# enable uwsgi master process
Expand Down
2 changes: 1 addition & 1 deletion mpbackend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@
"Authorization",
]
CORS_ALLOW_CREDENTIALS = True

CORS_ORIGIN_WHITELIST = env("CORS_ORIGIN_WHITELIST")

CSRF_TRUSTED_ORIGINS = ["http://localhost:8080"]

SECURE_CROSS_ORIGIN_OPENER_POLICY = None

REST_FRAMEWORK = {
"DEFAULT_PERMISSION_CLASSES": [
Expand Down
10 changes: 6 additions & 4 deletions mpbackend/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# from django.conf import settings
from django.contrib import admin
from django.urls import include, path, re_path
from drf_spectacular.views import (
Expand All @@ -8,13 +9,16 @@

import account.api.urls
import profiles.api.urls
from profiles.views import get_csrf

urlpatterns = [
re_path("^admin/", admin.site.urls),
# re_path(r"^api/v1/", include(router.urls)),
re_path(r"^api/account/", include(account.api.urls), name="account"),
re_path(r"^api/v1/", include(profiles.api.urls), name="profiles"),
# path("api-auth/", include("rest_framework.urls")),
]

# NOTE, consider disabling in production. if settings.DEBUG:
urlpatterns += [
path("api/v1/schema/", SpectacularAPIView.as_view(), name="schema"),
path(
"api/v1/schema/swagger-ui/",
Expand All @@ -26,6 +30,4 @@
SpectacularRedocView.as_view(url_name="schema"),
name="redoc",
),
path("csrf/", get_csrf)
# path("api-auth/", include("rest_framework.urls")),
]
6 changes: 0 additions & 6 deletions profiles/views.py

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/backup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#!/bin/bash
BACKUP_PATH=/home/azureuser/backups/
current_date=$(date +"%Y-%m-%d")
echo "Backuping mobilityprofile database on curren date $current_date..."
echo "Backuping mobilityprofile database on current date $current_date..."
docker exec -i mpbackend_postgres_1 /usr/bin/pg_dump -U mobilityprofile -F t mobilityprofile | gzip -9 > ${BACKUP_PATH}mpbackend_backup_${current_date}.tar.gz
echo "Backup finished."

Expand All @@ -17,5 +17,5 @@ docker inspect mpbackend_postgres_1
3. Restore the database: docker exec mpbackend_postgres_1 pg_restore -U mobilityprofile -c -d mobilityprofile /tmp/mpbackend_backup_YYYY-MM-DD.tar
4. Optionally, remove the backup file from the container: docker exec mpbackend_postgres_1 rm /tmp/mpbackend_backup_YYYY-MM-DD.tar
# For additinol informaiton, e.g.: https://simplebackups.com/blog/docker-postgres-backup-restore-guide-with-examples/#back-up-a-docker-postgresql-database
# For additional informaition, e.g.: https://simplebackups.com/blog/docker-postgres-backup-restore-guide-with-examples/#back-up-a-docker-postgresql-database
'

0 comments on commit 643c683

Please sign in to comment.