mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-24 20:33:04 +00:00
Merge branch 'master' into rename-malie-city-id-768
This commit is contained in:
commit
201a925ed4
17 changed files with 858 additions and 701 deletions
42
.github/workflows/docker-build.yml
vendored
42
.github/workflows/docker-build.yml
vendored
|
@ -1,42 +0,0 @@
|
|||
name: Build Docker image
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: pokeapi/pokeapi
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Inspect builder
|
||||
run: |
|
||||
echo "Name: ${{ steps.buildx.outputs.name }}"
|
||||
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
|
||||
echo "Status: ${{ steps.buildx.outputs.status }}"
|
||||
echo "Flags: ${{ steps.buildx.outputs.flags }}"
|
||||
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
|
||||
- name: Build
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Resources/docker/app/Dockerfile
|
||||
push: false
|
||||
platforms: local,linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
101
.github/workflows/docker-k8s.yml
vendored
Normal file
101
.github/workflows/docker-k8s.yml
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
name: Build Docker image and create k8s with it
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: pokeapi/pokeapi
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Resources/docker/app/Dockerfile
|
||||
push: false
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
||||
tags: pokeapi/pokeapi:local
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
k8s:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: pokeapi/pokeapi
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Resources/docker/app/Dockerfile
|
||||
push: false
|
||||
load: true
|
||||
platforms: local
|
||||
tags: pokeapi/pokeapi:local
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
- name: Lint k8s
|
||||
run: (cd Resources/k8s/kustomize && yamllint .)
|
||||
- name: Create k8s Kind Cluster
|
||||
uses: helm/kind-action@v1.10.0
|
||||
with:
|
||||
cluster_name: pokeapi
|
||||
version: v0.21.0
|
||||
- name: Create deployment configuration
|
||||
run: |
|
||||
cp Resources/k8s/kustomize/base/secrets/postgres.env.sample Resources/k8s/kustomize/base/secrets/postgres.env
|
||||
cp Resources/k8s/kustomize/base/secrets/graphql.env.sample Resources/k8s/kustomize/base/secrets/graphql.env
|
||||
cp Resources/k8s/kustomize/base/config/pokeapi.env.sample Resources/k8s/kustomize/base/config/pokeapi.env
|
||||
- name: Load local image to Kind
|
||||
run: kind load docker-image pokeapi/pokeapi:local --name pokeapi
|
||||
- name: K8s Apply
|
||||
run: |
|
||||
make kustomize-local-apply
|
||||
kubectl proxy &
|
||||
sleep 1
|
||||
bash Resources/scripts/wait.sh http://localhost:8001/api/v1/namespaces/pokeapi/services/pokeapi/proxy/api/v2/
|
||||
- name: Set default namespace and print info
|
||||
run: |
|
||||
kubectl config set-context --current --namespace pokeapi
|
||||
kubectl describe deployment
|
||||
- name: Migrate and build data
|
||||
run: |
|
||||
make k8s-migrate
|
||||
make k8s-build-db
|
||||
bash Resources/scripts/wait.sh http://localhost:8001/api/v1/namespaces/pokeapi/services/pokeapi/proxy/api/v2/pal-park-area/5/
|
||||
- name: K8s wait for job
|
||||
run: |
|
||||
kubectl wait --timeout=600s --for=condition=complete job/load-graphql
|
||||
last_command=$(kubectl get job -o jsonpath='{.status.succeeded}' load-graphql)
|
||||
test "$last_command" -eq 1
|
||||
- name: Get GQL output
|
||||
run: kubectl logs jobs/load-graphql
|
50
.github/workflows/kustomize.yml
vendored
50
.github/workflows/kustomize.yml
vendored
|
@ -1,50 +0,0 @@
|
|||
name: Deploy Kustomize k8s cluster
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build and Push Docker image"]
|
||||
branches: [master, staging]
|
||||
types:
|
||||
- completed
|
||||
schedule:
|
||||
- cron: '0 0 1 * *'
|
||||
|
||||
jobs:
|
||||
create-kustomize-cluster:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Lint
|
||||
run: (cd Resources/k8s/kustomize && yamllint .)
|
||||
- name: Create k8s Kind Cluster
|
||||
uses: helm/kind-action@v1.1.0
|
||||
with:
|
||||
version: v0.11.1
|
||||
- name: Create deployment configuration
|
||||
run: |
|
||||
cp Resources/k8s/kustomize/base/secrets/postgres.env.sample Resources/k8s/kustomize/base/secrets/postgres.env
|
||||
cp Resources/k8s/kustomize/base/secrets/graphql.env.sample Resources/k8s/kustomize/base/secrets/graphql.env
|
||||
cp Resources/k8s/kustomize/base/config/pokeapi.env.sample Resources/k8s/kustomize/base/config/pokeapi.env
|
||||
- name: K8s Apply
|
||||
run: |
|
||||
if [ ${GITHUB_REF#refs/heads/} = 'master' ]; then make kustomize-apply; else make kustomize-staging-apply; fi
|
||||
kubectl proxy &
|
||||
kubectl describe deployment
|
||||
bash Resources/scripts/wait.sh http://localhost:8001/api/v1/namespaces/pokeapi/services/pokeapi/proxy/api/v2/
|
||||
- name: Set default namespace
|
||||
run: |
|
||||
kubectl config set-context --current --namespace pokeapi
|
||||
- name: Migrate and build data
|
||||
run: |
|
||||
make k8s-migrate
|
||||
make k8s-build-db
|
||||
bash Resources/scripts/wait.sh http://localhost:8001/api/v1/namespaces/pokeapi/services/pokeapi/proxy/api/v2/pal-park-area/5/
|
||||
- name: K8s Apply
|
||||
run: |
|
||||
kubectl wait --timeout=120s --for=condition=complete job/load-graphql
|
||||
last_command=$(kubectl get job -o jsonpath='{.status.succeeded}' load-graphql)
|
||||
test "$last_command" -eq 1
|
6
Makefile
6
Makefile
|
@ -116,9 +116,12 @@ hasura-get-anon-schema: # Dumps GraphQL schema
|
|||
kustomize-apply: # (Kustomize) Run kubectl apply -k on the connected k8s cluster
|
||||
kubectl apply -k Resources/k8s/kustomize/base/
|
||||
|
||||
kustomize-staging-apply: # (Kustomize) Run kubectl apply -k on the connected k8s cluster
|
||||
kustomize-staging-apply: # (Kustomize) Run kubectl apply -k on the connected k8s cluster using pokeapi/pokeapi:staging
|
||||
kubectl apply -k Resources/k8s/kustomize/staging/
|
||||
|
||||
kustomize-local-apply: # (Kustomize) Run kubectl apply -k on the connected k8s cluster using the locally available pokeapi/pokeapi:local
|
||||
kubectl apply -k Resources/k8s/kustomize/local/
|
||||
|
||||
k8s-migrate: # (k8s) Run any pending migrations
|
||||
kubectl exec --namespace pokeapi deployment/pokeapi -- python manage.py migrate ${docker_config}
|
||||
|
||||
|
@ -154,4 +157,5 @@ update-graphql-data-prod:
|
|||
make hasura-apply
|
||||
docker compose ${gql_compose_config} up --pull always -d web
|
||||
docker compose exec -T web sh -c 'rm -rf /tmp/cache/*'
|
||||
docker image prune -af
|
||||
sync; echo 3 > /proc/sys/vm/drop_caches
|
||||
|
|
|
@ -119,7 +119,7 @@ A free public GraphiQL console is browsable at the address https://beta.pokeapi.
|
|||
|
||||
A set of examples is provided in the directory [/graphql/examples](./graphql/examples) of this repository.
|
||||
|
||||
## Kubernetes [![k8s status](https://github.com/PokeAPI/pokeapi/actions/workflows/kustomize.yml/badge.svg?branch=master)](https://github.com/PokeAPI/pokeapi/actions/workflows/kustomize.yml)
|
||||
## Kubernetes [![Build Docker image and create k8s with it](https://github.com/PokeAPI/pokeapi/actions/workflows/docker-k8s.yml/badge.svg)](https://github.com/PokeAPI/pokeapi/actions/workflows/docker-k8s.yml)
|
||||
|
||||
[Kustomize](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/) files are provided in the folder https://github.com/PokeAPI/pokeapi/tree/master/Resources/k8s/kustomize/base/. Create and change your secrets:
|
||||
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
ADMINS=PokeAPI,change.me@pokeapi.co
|
||||
BASE_URL=http://localhost/
|
||||
POKEAPI_CHECKOUT_REF=master
|
|
@ -25,7 +25,7 @@ spec:
|
|||
done;
|
||||
containers:
|
||||
- name: graphql-engine
|
||||
image: hasura/graphql-engine:v2.16.1
|
||||
image: hasura/graphql-engine:v2.36.4
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
env:
|
||||
|
|
|
@ -26,7 +26,7 @@ spec:
|
|||
containers:
|
||||
- name: pokeapi
|
||||
image: pokeapi/pokeapi:master
|
||||
imagePullPolicy: Always
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
securityContext: # CI: Github Actions kills this container if not run with root. Otherwise, it's safe to use the default pokeapi/pokeapi user and remove these lines.
|
||||
|
|
|
@ -25,13 +25,17 @@ spec:
|
|||
secretKeyRef:
|
||||
name: graphql-env-secret
|
||||
key: HASURA_GRAPHQL_ADMIN_SECRET
|
||||
- name: POKEAPI_CHECKOUT_REF
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: pokeapi-configmap
|
||||
key: POKEAPI_CHECKOUT_REF
|
||||
command: ["sh", "-c"]
|
||||
args:
|
||||
- apt-get update &&
|
||||
apt-get install -y git curl &&
|
||||
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash &&
|
||||
hasura update-cli --version v2.0.8 &&
|
||||
- apt-get update && apt-get install -y curl git &&
|
||||
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | VERSION=v2.36.4 bash &&
|
||||
cd /tmp &&
|
||||
git clone https://github.com/PokeAPI/pokeapi.git &&
|
||||
cd pokeapi &&
|
||||
git checkout staging &&
|
||||
(git checkout $(POKEAPI_CHECKOUT_REF) || git checkout master) &&
|
||||
hasura md apply --endpoint http://graphql:8080 --project graphql --admin-secret $(HASURA_GRAPHQL_ADMIN_SECRET)
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace: pokeapi
|
|||
|
||||
configMapGenerator:
|
||||
- name: pokeapi-configmap
|
||||
files:
|
||||
envs:
|
||||
- config/pokeapi.env
|
||||
|
||||
secretGenerator:
|
||||
|
|
9
Resources/k8s/kustomize/local/kustomization.yaml
Normal file
9
Resources/k8s/kustomize/local/kustomization.yaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
bases:
|
||||
- ../base
|
||||
|
||||
images:
|
||||
- name: pokeapi/pokeapi
|
||||
newTag: local
|
|
@ -157,6 +157,7 @@ This API will always be publicly available and will never require any extensive
|
|||
|
||||
Created by [**Paul Hallett**(]https://github.com/phalt) and other [**PokéAPI contributors***](https://github.com/PokeAPI/pokeapi#contributing) around the world. Pokémon and Pokémon character names are trademarks of Nintendo.
|
||||
""",
|
||||
"SORT_OPERATIONS": False,
|
||||
"SERVERS": [{"url": "https://pokeapi.co"}],
|
||||
"EXTERNAL_DOCS": {"url": "https://pokeapi.co/docs/v2"},
|
||||
"VERSION": "2.7.0",
|
||||
|
@ -164,16 +165,79 @@ Created by [**Paul Hallett**(]https://github.com/phalt) and other [**PokéAPI co
|
|||
"OAS_VERSION": "3.1.0",
|
||||
"COMPONENT_SPLIT_REQUEST": True,
|
||||
"TAGS": [
|
||||
"pokemon",
|
||||
"evolution",
|
||||
"berries",
|
||||
"items",
|
||||
"machines",
|
||||
"location",
|
||||
"contest",
|
||||
"moves",
|
||||
"encounters",
|
||||
"games",
|
||||
"utility",
|
||||
{
|
||||
"name": "pokemon",
|
||||
"description": "Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "evolution",
|
||||
"description": "Evolution is a process in which a Pokémon changes into a different species of Pokémon.",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/Evolution",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "berries",
|
||||
"description": "Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail.",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/Berry",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "items",
|
||||
"description": "An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/Item",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "machines",
|
||||
"description": "Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine.",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/TM",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"description": "Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "contest",
|
||||
"description": "Pokémon Contests are a type of competition often contrasted with Pokémon battles and held in Contest Halls",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_Contest",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "moves",
|
||||
"description": "Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas.",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_name",
|
||||
},
|
||||
},
|
||||
{"name": "encounters"},
|
||||
{
|
||||
"name": "games",
|
||||
"description": "The Pokémon games are all video games in the Pokémon franchise.",
|
||||
"externalDocs": {
|
||||
"description": "Find more info here",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_games",
|
||||
},
|
||||
},
|
||||
{"name": "utility"},
|
||||
],
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ move_id,meta_category_id,meta_ailment_id,min_hits,max_hits,min_turns,max_turns,d
|
|||
302,0,0,,,,,0,0,0,0,30,0
|
||||
303,3,0,,,,,0,50,0,0,0,0
|
||||
304,0,0,,,,,0,0,0,0,0,0
|
||||
305,4,5,,,15,15,0,0,0,50,0,0
|
||||
305,4,5,,,,,0,0,0,50,0,0
|
||||
306,6,0,,,,,0,0,0,0,0,50
|
||||
307,0,0,,,,,0,0,0,0,0,0
|
||||
308,0,0,,,,,0,0,0,0,0,0
|
||||
|
|
|
|
@ -364,3 +364,17 @@ version_id,local_language_id,name
|
|||
41,8,Violetto
|
||||
41,9,Violet
|
||||
41,12,紫
|
||||
42,1,みどりのかめん
|
||||
42,5,Le masque turquoise
|
||||
42,6,Die türkisgrüne maske
|
||||
42,7,La máscara turquesa
|
||||
42,8,La maschera turchese
|
||||
42,9,The teal mask
|
||||
42,12,碧之假面
|
||||
43,1,あおのえんばん
|
||||
43,5,Le disque indigo
|
||||
43,6,Die indigoblaue scheibe,
|
||||
43,7,El disco índigo
|
||||
43,8,Il disco indaco
|
||||
43,9,The indigo disk
|
||||
43,12,藍之圓盤
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 376.
|
|
@ -44,7 +44,7 @@ services:
|
|||
- ./Resources/nginx/ssl:/ssl:ro
|
||||
- graphql_cache:/tmp/cache
|
||||
graphql-engine:
|
||||
image: hasura/graphql-engine:v2.36.1-ce
|
||||
image: hasura/graphql-engine:v2.36.4
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
|
|
1224
openapi.yml
1224
openapi.yml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue