mirror of
https://github.com/PokeAPI/pokeapi
synced 2025-02-16 12:38:25 +00:00
refactor: use compose V2
This commit is contained in:
parent
f0b51031ae
commit
f364369f5e
6 changed files with 18 additions and 18 deletions
|
@ -18,10 +18,10 @@ graphql
|
|||
.vscode
|
||||
.github
|
||||
.circleci
|
||||
docker-compose.yml
|
||||
docker-compose*
|
||||
.dockerignore
|
||||
/*.md
|
||||
/*.js
|
||||
.env
|
||||
*pycache*
|
||||
target
|
||||
target
|
||||
|
|
20
Makefile
20
Makefile
|
@ -42,38 +42,38 @@ shell: # Load a shell
|
|||
python manage.py shell ${local_config}
|
||||
|
||||
docker-up: # (Docker) Create services/volumes/networks
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
|
||||
docker-migrate: # (Docker) Run any pending migrations
|
||||
docker-compose exec -T app python manage.py migrate ${docker_config}
|
||||
docker compose exec -T app python manage.py migrate ${docker_config}
|
||||
|
||||
docker-build-db: # (Docker) Build the database
|
||||
docker-compose exec -T app sh -c 'echo "from data.v2.build import build_all; build_all()" | python manage.py shell ${docker_config}'
|
||||
docker compose exec -T app sh -c 'echo "from data.v2.build import build_all; build_all()" | python manage.py shell ${docker_config}'
|
||||
|
||||
docker-make-migrations: # (Docker) Create migrations files if schema has changed
|
||||
docker-compose exec -T app sh -c 'python manage.py makemigrations ${docker_config}'
|
||||
docker compose exec -T app sh -c 'python manage.py makemigrations ${docker_config}'
|
||||
|
||||
docker-flush-db: # (Docker) Removes all the data present in the database but preserves tables and migrations
|
||||
docker-compose exec -T app sh -c 'python manage.py flush --no-input ${docker_config}'
|
||||
docker compose exec -T app sh -c 'python manage.py flush --no-input ${docker_config}'
|
||||
|
||||
docker-destroy-db: # (Docker) Removes the volume where the database is installed on, alongside to the container itself
|
||||
docker rm -f pokeapi_db_1
|
||||
docker volume rm pokeapi_pg_data
|
||||
|
||||
docker-shell: # (Docker) Launch an interative shell for the pokeapi container
|
||||
docker-compose exec app sh -l
|
||||
docker compose exec app sh -l
|
||||
|
||||
docker-stop: # (Docker) Stop containers
|
||||
docker-compose stop
|
||||
docker compose stop
|
||||
|
||||
docker-down: # (Docker) Stop and removes containers and networks
|
||||
docker-compose down
|
||||
docker compose down
|
||||
|
||||
docker-test: # (Docker) Run tests
|
||||
docker-compose exec -T app python manage.py test ${local_config}
|
||||
docker compose exec -T app python manage.py test ${local_config}
|
||||
|
||||
docker-prod:
|
||||
docker-compose -f docker-compose.yml -f docker-compose.override.yml -f Resources/compose/docker-compose-prod-graphql.yml up -d
|
||||
docker compose -f docker-compose.yml -f docker-compose.override.yml -f Resources/compose/docker-compose-prod-graphql.yml up -d
|
||||
|
||||
docker-setup: docker-up docker-migrate docker-build-db # (Docker) Start services, prepare the latest DB schema, populate the DB
|
||||
|
||||
|
|
|
@ -83,9 +83,9 @@ make docker-setup
|
|||
If you don't have `make` on your machine you can use the following commands
|
||||
|
||||
```sh
|
||||
docker-compose up -d
|
||||
docker-compose exec -T app python manage.py migrate --settings=config.docker-compose
|
||||
docker-compose exec -T app sh -c 'echo "from data.v2.build import build_all; build_all()" | python manage.py shell --settings=config.docker-compose'
|
||||
docker compose up -d
|
||||
docker compose exec -T app python manage.py migrate --settings=config.docker-compose
|
||||
docker compose exec -T app sh -c 'echo "from data.v2.build import build_all; build_all()" | python manage.py shell --settings=config.docker-compose'
|
||||
```
|
||||
|
||||
Browse [localhost/api/v2/](http://localhost/api/v2/) or [localhost/api/v2/pokemon/bulbasaur/](http://localhost/api/v2/pokemon/bulbasaur/) on port `80`.
|
||||
|
|
|
@ -35,7 +35,7 @@ The container connects to a Redis cache via the environment variable `REDIS_CONN
|
|||
|
||||
### Run the container
|
||||
|
||||
The container exposes port `80`. It needs a PostgreSQL and a Redis instance to connect to. Refer to the section [How to use this image](./how-to-use-this-image) for mapping the environment variables.
|
||||
The container exposes port `80`. It needs a PostgreSQL and a Redis instance to connect to. Refer to the section [How to use this image](#how-to-use-this-image) for mapping the environment variables.
|
||||
|
||||
It's recommended to use the provided [docker-compose.yml](https://github.com/PokeAPI/pokeapi/blob/master/docker-compose.yml) to start a container from this image.
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ DEBUG = False
|
|||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
os.environ.get("ADMINS", "Paul Hallett,paulandrewhallett@gmail.com").split(","),
|
||||
os.environ.get("ADMINS", "Pokeapi,team@pokeapi.co").split(","),
|
||||
)
|
||||
|
||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
|
|
@ -6,4 +6,4 @@ services:
|
|||
context: .
|
||||
dockerfile: ./Resources/docker/app/Dockerfile
|
||||
|
||||
# docker-compose -f docker-compose.yml -f docker-compose-dev.yml up -d
|
||||
# docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d
|
||||
|
|
Loading…
Add table
Reference in a new issue