-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1a2cde
commit 70fe523
Showing
7 changed files
with
202 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
apiVersion: run.googleapis.com/v1 | ||
kind: Job | ||
metadata: | ||
name: <GCP_CLOUD_RUN_SERVICE>-task-runner | ||
namespace: '<GCP_PROJECT_NUMBER>' | ||
labels: | ||
cloud.googleapis.com/location: <GCP_REGION> | ||
spec: | ||
template: | ||
spec: | ||
parallelism: 1 | ||
taskCount: 1 | ||
template: | ||
spec: | ||
containers: | ||
- image: <DOCKER_IMAGE> | ||
env: | ||
- name: RUN_MODE | ||
value: <RUN_MODE> | ||
- name: APP_NAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_APP_NAME | ||
key: latest | ||
- name: APP_VERSION | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_APP_VERSION | ||
key: latest | ||
- name: APP_URL | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_APP_URL | ||
key: latest | ||
- name: APP_ENV | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_APP_ENV | ||
key: latest | ||
- name: APP_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_APP_KEY | ||
key: latest | ||
- name: APP_DEBUG | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_APP_DEBUG | ||
key: latest | ||
- name: DB_CONNECTION | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DB_CONNECTION | ||
key: latest | ||
- name: DB_HOST | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DB_HOST | ||
key: latest | ||
- name: DB_PORT | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DB_PORT | ||
key: latest | ||
- name: DB_DATABASE | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DB_DATABASE | ||
key: latest | ||
- name: DB_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DB_USERNAME | ||
key: latest | ||
- name: DB_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DB_PASSWORD | ||
key: latest | ||
- name: REDIS_CONNECTION | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_REDIS_CONNECTION | ||
key: latest | ||
- name: REDIS_HOST | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_REDIS_HOST | ||
key: latest | ||
- name: REDIS_PORT | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_REDIS_PORT | ||
key: latest | ||
- name: REDIS_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_REDIS_USERNAME | ||
key: latest | ||
- name: REDIS_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_REDIS_PASSWORD | ||
key: latest | ||
- name: RAWG_API_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_RAWG_API_KEY | ||
key: latest | ||
- name: RAWG_API_HOST | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_RAWG_API_HOST | ||
key: latest | ||
- name: JWT_EXPIRES | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_JWT_EXPIRES | ||
key: latest | ||
- name: DISCORD_APP_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DISCORD_APP_ID | ||
key: latest | ||
- name: DISCORD_PUBLIC_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DISCORD_PUBLIC_KEY | ||
key: latest | ||
- name: DISCORD_BOT_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DISCORD_BOT_TOKEN | ||
key: latest | ||
- name: DISCORD_API_HOST | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_DISCORD_API_HOST | ||
key: latest | ||
- name: ROOT_DISCORD_USER_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_ROOT_DISCORD_USER_ID | ||
key: latest | ||
- name: ROOT_DISCORD_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_ROOT_DISCORD_USERNAME | ||
key: latest | ||
- name: ROOT_DISCORD_CHANNEL_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: GAMEWATCH_ROOT_DISCORD_CHANNEL_ID | ||
key: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
if [ -f .env ]; then | ||
export $(cat .env | grep -v '^#' | xargs) | ||
fi | ||
|
||
# Stop the script if any command fails | ||
set -e | ||
|
||
# Get the RUN_MODE from the first argument | ||
RUN_MODE=$1 | ||
|
||
# Get the directory where the script is located | ||
SCRIPT_DIR="$(dirname "$0")" | ||
|
||
# Copy the template to a new job.yaml file | ||
cp "$SCRIPT_DIR/../job.template.yaml" "$SCRIPT_DIR/../job.yaml" | ||
|
||
# Replace placeholders | ||
sed -i "s|<RUN_MODE>|$RUN_MODE|" "$SCRIPT_DIR/../job.yaml" | ||
sed -i "s|<GCP_PROJECT_NUMBER>|$GCP_PROJECT_NUMBER|" "$SCRIPT_DIR/../job.yaml" | ||
sed -i "s|<GCP_REGION>|$GCP_REGION|" "$SCRIPT_DIR/../job.yaml" | ||
sed -i "s|<GCP_CLOUD_RUN_SERVICE>|$GCP_CLOUD_RUN_SERVICE|" "$SCRIPT_DIR/../job.yaml" | ||
|
||
# Deploy the job using the modified job.yaml | ||
gcloud beta run jobs replace "$SCRIPT_DIR/../job.yaml" --region $GCP_REGION --project $GCP_PROJECT_ID | ||
|
||
# Execute the job after replacing it | ||
gcloud beta run jobs execute gamewatch-init-db --region $GCP_REGION --project $GCP_PROJECT_ID | ||
|
||
# Clean up the temporary job.yaml file | ||
rm "$SCRIPT_DIR/../job.yaml" | ||
|
||
|