Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
tahamusvi committed Mar 22, 2024
1 parent 5f3fa1a commit f71e5d5
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/liara.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CD-Liara
on:
push:
branches:
- main
- dev
jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: update-liara
env:
LIARA_TOKEN: ${{ secrets.LIARA_API_TOKEN }}
run: |
npm i -g @liara/cli@5
liara deploy --app="gizmoshop" --api-token="$LIARA_TOKEN" --no-app-logs
14 changes: 11 additions & 3 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@

BASE_DIR = Path(__file__).resolve().parent.parent

deploy = True
if(deploy):
# deploy
SECRET_KEY = os.getenv('SECRET_KEY', 'LIARA_URL is not set.')
DEBUG = os.getenv('DEBUG', 'LIARA_URL is not set.')

else:
SECRET_KEY = "dkfgjiuerhguehrgedjgnerfghiuer"
DEBUG = True



SECRET_KEY = "dkfgjiuerhguehrgedjgnerfghiuer"
DEBUG = True

ALLOWED_HOSTS = ["*","89.199.35.132","192.168.45.68",]
CORS_ORIGIN_ALLOW_ALL = True
Expand Down Expand Up @@ -96,7 +104,7 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'NAME': BASE_DIR / 'media/db.sqlite3',
}
}

Expand Down
8 changes: 8 additions & 0 deletions liara.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"disks": [
{
"name": "data",
"mountTo": "media"
}
]
}
33 changes: 33 additions & 0 deletions liara_nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
client_max_body_size 100M;

location /media {
add_header Access-Control-Allow-Origin *;
alias /usr/src/app/media;

if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
}

location /static {
alias /usr/src/app/staticfiles;
}

location / {
try_files /dev/null @django_app;
}

location ~\.sqlite3$ {
deny all;
error_page 403 =404 /;
}

location ~ /\.well-known {
allow all;
}

0 comments on commit f71e5d5

Please sign in to comment.