[サービス名] is a service that provides [機能]. This service was developed for HackU Kosen 2022.
Dependency management for Python files is done using POETRY.
- https://python-poetry.org/docs/#installation
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
(if needed)poetry install
(After cloning this repository)
This tool defines commands to be executed before committing. It is already defined in .pre-commit-config.yaml
, so you need to configure it in your environment. Please follow the steps below.
- https://pre-commit.com/#installation
pre-commit install
(After cloning this repository)
-
Clone this repository
-
Create fastapi.env with reference to fastapi.env.tmpl
-
Start Server
docker-compose up
-
Dependency install
docker-compose run --rm fastapi poetry install
-
Setup Static Files
docker-compose run --rm fastapi poetry run python manage.py collectstatic --noinput
-
Migrate
docker-compose run --rm fastapi poetry run python manage.py migrate
-
Create Super User for Admin Page
docker-compose run --rm fastapi poetry run python manage.py createsuperuser
source alias.sh
https://youngeek-0410.github.io/hacku-kosen-2022-backend/
-
Build
IMAGE=[イメージ名] docker-compose -f docker-compose.prod.yaml build
-
Push to GCR
IMAGE=[イメージ名] docker-compose -f docker-compose.prod.yaml push
-
Deploy to Cloud Run
gcloud run deploy [サービス名(CloudRun)] --image [イメージ名] --project [プロジェクト名] --port 8000 --region asia-northeast1 --platform managed
-
Set Environment Variables
gcloud run services update [サービス名(CloudRun)] --set-env-vars [key1]=[value1],[key2]=[value2]