Skip to content
README.md 1.71 KiB
Newer Older
Javier Marcet's avatar
Javier Marcet committed
# django-app-unicodex
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
This demo app leverages [unicodex](https://unicodex.gl.asnt.app/) and uses:
Katie McLaughlin's avatar
Katie McLaughlin committed

Katie McLaughlin's avatar
Katie McLaughlin committed
 * [Django 3.1](https://docs.djangoproject.com/en/3.1/) as the web framework,
Katie McLaughlin's avatar
Katie McLaughlin committed
 * [Google Cloud Run](https://cloud.google.com/run/) as the hosting platform,
Javier Marcet's avatar
Javier Marcet committed
 * [Google Cloud SQL](https://cloud.google.com/sql/) as the managed database (via [django-environ](https://django-environ.readthedocs.io/en/latest/)),
Katie McLaughlin's avatar
Katie McLaughlin committed
 * [Google Cloud Storage](https://cloud.google.com/storage/) as the media storage platform (via [django-storages](https://django-storages.readthedocs.io/en/latest/)),
 * [Google Cloud Build](https://cloud.google.com/cloud-build/) for build and deployment automation, and
 * [Google Secret Manager](https://cloud.google.com/secret-manager/) for managing encrypted values.
Katie McLaughlin's avatar
Katie McLaughlin committed

Katie McLaughlin's avatar
Katie McLaughlin committed
## Deployment
Javier Marcet's avatar
Javier Marcet committed
You first need to copy `.env-local` to `.env` and adjust as you like.
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
This demo can be deployed by multiple different methods: automatically from Gitlab or Github, manually
and locally.
Katie McLaughlin's avatar
Katie McLaughlin committed


Javier Marcet's avatar
Javier Marcet committed
### Local
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
You need docker and docker-compose and issue the following commands from the root dir of this repo.
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
```
docker-compose build
docker-compose run --rm web python manage.py migrate
docker-compose run --rm web python manage.py loaddata sampledata
docker-compose up
```
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
### Automated
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
Check `.gitlab-ci.yml` and `cloudbuild.yaml` for Gitlab CI/CD integration.
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
Also see `app.json`, `.cloudbuild`  and `.gcloud/` folders for implementation details.
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
### Manual
Katie McLaughlin's avatar
Katie McLaughlin committed

Javier Marcet's avatar
Javier Marcet committed
* There are two helper scripts to deploy manually to Google Cloud: `steps.sh` and `update.sh`
  * `steps.sh`: is to be run in the first deployment
  * `update.sh`: serves to update the existing deploymnt, it also has commented lines to recreate
the database and/or the secrets in the deploymnt.