Skip to content

Commit

Permalink
Adiciona passos para deploy manual (#72)
Browse files Browse the repository at this point in the history
* Remove arquivo não utilizado

* Corrige leitura da env var ALLOWED_HOSTS

* Adiciona script e dependências para deploy manual

* Corrige valor default de ALLOWED_HOSTS

* Add comando para rodar o servidor em um só
  • Loading branch information
anapaulagomes authored May 22, 2023
1 parent 28bcd56 commit 351d5c3
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,21 @@ make run
```

Acesse [localhost:8000](http://localhost:8000).

## Deploy

Atualmente estamos fazendo o deploy manual dessa aplicação.
Para isso, precisamos fazer o pull do código e reiniciar
a aplicação para que ela seja atualizada.

Para preparar o código para atualização é preciso que você:

* Atualize as dependências:

```bash
poetry export --without-hashes --format=requirements.txt > requirements.txt
```

* Atualize as variáveis de ambiente no `.env` do servidor

* Reinicie o serviço
15 changes: 15 additions & 0 deletions bin/setup_and_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

echo "===== Starting the deploy ====="

cd /home/admin/app

echo "Installing dependencies..."
pip install -r requirements.txt

echo "Running migrations..."
python manage.py migrate

python manage.py runserver 5000 &

echo "Done!"
4 changes: 2 additions & 2 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import dj_database_url
import sentry_sdk
from decouple import config
from decouple import Csv, config
from sentry_sdk.integrations.django import DjangoIntegration

BASE_DIR = Path(__file__).resolve().parent.parent
Expand All @@ -19,7 +19,7 @@
DEBUG = True

ALLOWED_HOSTS = config(
"ALLOWED_HOSTS", default=["localhost", "127.0.0.1", "[::1]", "0.0.0.0"], cast=list
"ALLOWED_HOSTS", default=".localhost,127.0.0.1,[::1],0.0.0.0", cast=Csv()
)

INSTALLED_APPS = [
Expand Down
Binary file removed docs/imgs/.DS_Store
Binary file not shown.
16 changes: 16 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
asgiref==3.6.0 ; python_full_version == "3.7.3"
certifi==2023.5.7 ; python_full_version == "3.7.3"
dj-database-url==0.5.0 ; python_full_version == "3.7.3"
django-public-admin==0.0.5 ; python_full_version == "3.7.3"
django==3.2.19 ; python_full_version == "3.7.3"
gunicorn==20.1.0 ; python_full_version == "3.7.3"
psycopg2-binary==2.9.6 ; python_full_version == "3.7.3"
python-dateutil==2.8.2 ; python_full_version == "3.7.3"
python-decouple==3.8 ; python_full_version == "3.7.3"
pytz==2023.3 ; python_full_version == "3.7.3"
sentry-sdk==1.23.1 ; python_full_version == "3.7.3"
setuptools==67.8.0 ; python_full_version == "3.7.3"
six==1.16.0 ; python_full_version == "3.7.3"
sqlparse==0.4.4 ; python_full_version == "3.7.3"
typing-extensions==4.5.0 ; python_full_version == "3.7.3"
urllib3==1.26.15 ; python_full_version == "3.7.3"

0 comments on commit 351d5c3

Please sign in to comment.