Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade images/change GQL makefile #993

Merged
merged 8 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ sync-to-veekun: pull pull-veekun # Copy data from this repository to ../pokedex
# read-env-file: # Exports ./.env into shell environment variables
# export `egrep -v '^#' .env | xargs`

hasura-export: # Export Hasura configuration
hasura md export --project graphql --admin-secret ${HASURA_GRAPHQL_ADMIN_SECRET}
hasura-export: # Export Hasura configuration, be sure to have set HASURA_GRAPHQL_ADMIN_SECRET
hasura md export --project graphql

hasura-apply: # Apply local Hasura configuration
hasura md apply --project graphql --admin-secret ${HASURA_GRAPHQL_ADMIN_SECRET}
hasura-apply: # Apply local Hasura configuration, be sure to have set HASURA_GRAPHQL_ADMIN_SECRET
hasura md apply --project graphql

hasura-get-anon-schema: # Dumps GraphQL schema
gq http://localhost:8080/v1/graphql --introspect > graphql/schema.graphql
Expand All @@ -128,17 +128,23 @@ k8s-delete: # (k8s) Delete pokeapi namespace
start-graphql-prod:
git pull origin master
git submodule update --init
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 Resources/compose/docker-compose-prod-graphql.yml up -d
docker compose stop app

down-graphql-prod:
docker container rm $(docker container ls -aq) -f
docker system prune --all --volumes --force
sync; echo 3 > /proc/sys/vm/drop_caches

update-graphql-data-prod:
git pull origin master
git submodule update --init
docker stop pokeapi_graphql-engine_1
docker compose stop graphql-engine
sync; echo 3 > /proc/sys/vm/drop_caches
docker-compose -f docker-compose.yml -f docker-compose.override.yml -f Resources/compose/docker-compose-prod-graphql.yml up -d app
docker compose -f docker-compose.yml -f Resources/compose/docker-compose-prod-graphql.yml up -d app
make docker-migrate
make docker-build-db
docker stop pokeapi_app_1
docker compose stop app
sync; echo 3 > /proc/sys/vm/drop_caches
docker exec pokeapi_web_1 sh -c 'rm -rf /tmp/cache/*'
docker start pokeapi_graphql-engine_1
docker compose exec -T web sh -c 'rm -rf /tmp/cache/*'
docker compose start graphql-engine
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ When you start PokéAPI with the above docker-compose setup, an [Hasura Engine](

```sh
# hasura cli needs to be installed and available in your $PATH: https://hasura.io/docs/latest/graphql/core/hasura-cli/install-hasura-cli.html
# hasura cli's version has to be v2.0.8
# hasura cli's version has to greater than v2.0.8
make hasura-apply
```

Expand Down
5 changes: 0 additions & 5 deletions Resources/compose/docker-compose-prod-graphql.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
version: '2.4'
services:
cache:
image: redis:7.0.7-alpine
db:
image: postgres:15.1
environment:
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_USER: "${POSTGRES_USER}"
Expand All @@ -14,12 +11,10 @@ services:
restart: "no"

web:
image: nginx:1.23.3-alpine
volumes:
- graphiql:/public-console:ro

graphql-engine:
image: hasura/graphql-engine:v2.16.1
cpus: 0.7
memswap_limit: 3g
mem_limit: 700m
Expand Down
1 change: 1 addition & 0 deletions Resources/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ http {
}

location /graphql/v1beta {
include /ssl/cache.conf*;
# proxy_cache small;
# proxy_cache_valid 200 10d;
# proxy_cache_valid any 0;
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
version: '2.4'
services:
cache:
image: redis:7.0.7-alpine
image: redis:7.2.3-alpine
volumes:
- redis_data:/data
restart: always

db:
image: postgres:15.1
image: postgres:16.1
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-pokemon}
POSTGRES_USER: ${POSTGRES_USER:-ash}
Expand All @@ -33,7 +33,7 @@ services:
restart: always

web:
image: nginx:1.23.3-alpine
image: nginx:1.25.3-alpine
ports:
- "80:80"
- "443:443"
Expand All @@ -44,7 +44,7 @@ services:
- ./Resources/nginx/ssl:/ssl:ro
- graphql_cache:/tmp/cache
graphql-engine:
image: hasura/graphql-engine:v2.16.1
image: hasura/graphql-engine:v2.36.1-ce
ports:
- "8080:8080"
depends_on:
Expand Down
1 change: 1 addition & 0 deletions graphql/metadata/api_limits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions graphql/metadata/backend_configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,56 @@ table:
name: pokemon_v2_ability
schema: public
object_relationships:
- name: pokemon_v2_generation
using:
foreign_key_constraint_on: generation_id
- name: pokemon_v2_generation
using:
foreign_key_constraint_on: generation_id
array_relationships:
- name: pokemon_v2_abilitychanges
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_abilitychange
schema: public
- name: pokemon_v2_abilityeffecttexts
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_abilityeffecttext
schema: public
- name: pokemon_v2_abilityflavortexts
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_abilityflavortext
schema: public
- name: pokemon_v2_abilitynames
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_abilityname
schema: public
- name: pokemon_v2_pokemonabilities
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_pokemonability
schema: public
- name: pokemon_v2_pokemonabilitypasts
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_pokemonabilitypast
schema: public
- name: pokemon_v2_abilitychanges
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_abilitychange
schema: public
- name: pokemon_v2_abilityeffecttexts
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_abilityeffecttext
schema: public
- name: pokemon_v2_abilityflavortexts
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_abilityflavortext
schema: public
- name: pokemon_v2_abilitynames
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_abilityname
schema: public
- name: pokemon_v2_pokemonabilities
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_pokemonability
schema: public
- name: pokemon_v2_pokemonabilitypasts
using:
foreign_key_constraint_on:
column: ability_id
table:
name: pokemon_v2_pokemonabilitypast
schema: public
select_permissions:
- permission:
allow_aggregations: true
columns: "*"
filter: {}
limit: 100000
role: anon
- role: anon
permission:
columns: '*'
filter: {}
limit: 100000
allow_aggregations: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ table:
name: pokemon_v2_abilitychange
schema: public
object_relationships:
- name: pokemon_v2_ability
using:
foreign_key_constraint_on: ability_id
- name: pokemon_v2_versiongroup
using:
foreign_key_constraint_on: version_group_id
- name: pokemon_v2_ability
using:
foreign_key_constraint_on: ability_id
- name: pokemon_v2_versiongroup
using:
foreign_key_constraint_on: version_group_id
array_relationships:
- name: pokemon_v2_abilitychangeeffecttexts
using:
foreign_key_constraint_on:
column: ability_change_id
table:
name: pokemon_v2_abilitychangeeffecttext
schema: public
- name: pokemon_v2_abilitychangeeffecttexts
using:
foreign_key_constraint_on:
column: ability_change_id
table:
name: pokemon_v2_abilitychangeeffecttext
schema: public
select_permissions:
- permission:
allow_aggregations: true
columns: "*"
filter: {}
limit: 100000
role: anon
- role: anon
permission:
columns: '*'
filter: {}
limit: 100000
allow_aggregations: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ table:
name: pokemon_v2_abilitychangeeffecttext
schema: public
object_relationships:
- name: pokemon_v2_abilitychange
using:
foreign_key_constraint_on: ability_change_id
- name: pokemon_v2_language
using:
foreign_key_constraint_on: language_id
- name: pokemon_v2_abilitychange
using:
foreign_key_constraint_on: ability_change_id
- name: pokemon_v2_language
using:
foreign_key_constraint_on: language_id
select_permissions:
- permission:
allow_aggregations: true
columns: "*"
filter: {}
limit: 100000
role: anon
- role: anon
permission:
columns: '*'
filter: {}
limit: 100000
allow_aggregations: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ table:
name: pokemon_v2_abilityeffecttext
schema: public
object_relationships:
- name: pokemon_v2_ability
using:
foreign_key_constraint_on: ability_id
- name: pokemon_v2_language
using:
foreign_key_constraint_on: language_id
- name: pokemon_v2_ability
using:
foreign_key_constraint_on: ability_id
- name: pokemon_v2_language
using:
foreign_key_constraint_on: language_id
select_permissions:
- permission:
allow_aggregations: true
columns: "*"
filter: {}
limit: 100000
role: anon
- role: anon
permission:
columns: '*'
filter: {}
limit: 100000
allow_aggregations: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ table:
name: pokemon_v2_abilityflavortext
schema: public
object_relationships:
- name: pokemon_v2_ability
using:
foreign_key_constraint_on: ability_id
- name: pokemon_v2_language
using:
foreign_key_constraint_on: language_id
- name: pokemon_v2_versiongroup
using:
foreign_key_constraint_on: version_group_id
- name: pokemon_v2_ability
using:
foreign_key_constraint_on: ability_id
- name: pokemon_v2_language
using:
foreign_key_constraint_on: language_id
- name: pokemon_v2_versiongroup
using:
foreign_key_constraint_on: version_group_id
select_permissions:
- permission:
allow_aggregations: true
columns: "*"
filter: {}
limit: 100000
role: anon
- role: anon
permission:
columns: '*'
filter: {}
limit: 100000
allow_aggregations: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ table:
name: pokemon_v2_abilityname
schema: public
object_relationships:
- name: pokemon_v2_ability
using:
foreign_key_constraint_on: ability_id
- name: pokemon_v2_language
using:
foreign_key_constraint_on: language_id
- name: pokemon_v2_ability
using:
foreign_key_constraint_on: ability_id
- name: pokemon_v2_language
using:
foreign_key_constraint_on: language_id
select_permissions:
- permission:
allow_aggregations: true
columns: "*"
filter: {}
limit: 100000
role: anon
- role: anon
permission:
columns: '*'
filter: {}
limit: 100000
allow_aggregations: true
Loading