Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Updates for ControlPlane deploy #548

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

Merged
justin808 merged 28 commits into master from cpln-deploy-update
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6a022d9
Fix mistake in copy address
ahangarha Aug 12, 2023
353fe1f
Use supported redis docker image
ahangarha Aug 12, 2023
7190ba1
Update cpl gem to 1.0.4
ahangarha Aug 12, 2023
cecaa9e
Change the organization
ahangarha Aug 12, 2023
980633e
Add instuction for granting docker access the registry
ahangarha Aug 13, 2023
19452cd
Replace deprecated cpl setup with apply-template
ahangarha Aug 13, 2023
e88cf0c
Copy postcss config to docker image
ahangarha Oct 6, 2023
405e376
Copy all files like the old docker file
ahangarha Oct 6, 2023
c827162
Add postgres-stateful
ahangarha Oct 17, 2023
c836fba
Add postgres-stateful as additional workload
ahangarha Oct 17, 2023
29e71ec
Break down postgres-stateful into separate templates
ahangarha Oct 17, 2023
0b3f23b
Fix credentials for database
ahangarha Oct 17, 2023
749e4ce
Restric policy permission to reveal
ahangarha Oct 17, 2023
6f18c03
Updates for CPLN working
justin808 Oct 18, 2023
ee1904d
beta gem
justin808 Oct 18, 2023
ff8ae4f
Use .dockerignore
ahangarha Oct 18, 2023
5fa28bc
Add command for generating locale files
ahangarha Oct 18, 2023
61fcf8f
Update cpln docs
ahangarha Oct 18, 2023
741c743
Add db:reset cron job workload
ahangarha Oct 24, 2023
2efaa0b
Update cpl to 1.1.2
ahangarha Oct 25, 2023
6785887
Rename cron template for typo
ahangarha Oct 25, 2023
215cbc7
Fix format of job schedule value
ahangarha Oct 25, 2023
47c6262
Add env var for letting db:reset in production env
ahangarha Oct 25, 2023
e280eb6
Wrap env variable value in quotation
ahangarha Oct 25, 2023
8663108
Move env variable for db:reset to corn workload
ahangarha Oct 25, 2023
58adbb9
Add cron to addition workloads
ahangarha Oct 25, 2023
f7886ec
Remove the org from the example
justin808 Oct 26, 2023
ea0eba1
Add missing daily task
justin808 Oct 26, 2023
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
Prev Previous commit
Next Next commit
Add postgres-stateful
  • Loading branch information
ahangarha authored and justin808 committed Oct 17, 2023
commit c827162798be0665a54a451369156c348c078063
2 changes: 1 addition & 1 deletion .controlplane/templates/gvc.yml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
# Password does not matter because host postgres.APP_GVC.cpln.local can only be accessed
# locally within CPLN GVC, and postgres running on a CPLN workload is something only for a
# test app that lacks persistence.
value: 'postgres://postgres:password123@postgres.APP_GVC.cpln.local:5432/APP_GVC'
value: 'postgres://the_user:the_password@postgres-stateful.APP_GVC.cpln.local:5432/APP_GVC'
- name: RAILS_ENV
value: production
- name: NODE_ENV
Expand Down
170 changes: 170 additions & 0 deletions .controlplane/templates/postgres-stateful.yml
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
kind: volumeset
name: postgres-stateful-vs
description: postgres-stateful-vs
spec:
autoscaling:
maxCapacity: 1000
minFreePercentage: 1
scalingFactor: 1.1
fileSystemType: ext4
initialCapacity: 10
performanceClass: general-purpose-ssd
snapshots:
createFinalSnapshot: true
retentionDuration: 7d

---
kind: secret
name: postgres-stateful-credentials
description: ''
type: dictionary
data:
password: the_user #Replace this with a real password
username: the_password #Replace this with a real username

---
kind: secret
name: postgres-stateful-entrypoint-script
type: opaque
data:
encoding: base64
payload: >-
IyEvdXNyL2Jpbi9lbnYgYmFzaAoKc291cmNlIC91c3IvbG9jYWwvYmluL2R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lcyAkUE9TVEdSRVNfREIgZXhpc3RzIChkZWZpbmVkIGluIHRoZSBlbnRyeXBvaW50IHNjcmlwdCBmcm9tIHRoZSBwb3N0Z3JlcyBkb2NrZXIgaW1hZ2UpCgkgIGF3cyBzMyBjcCAiJDIiIC0gfCBwZ19yZXN0b3JlIC0tY2xlYW4gLS1uby1hY2wgLS1uby1vd25lciAtZCAiJDEiIC1VICIkUE9TVEdSRVNfVVNFUiIKCSAgZWNobyAiJChkYXRlKTogJDIgLT4gJDEiIHwgY2F0ID4+ICIkUEdEQVRBL0NQTE5fUkVTVE9SRUQiCgllbHNlCgkgIGVjaG8gIkRiICckMScgYWxyZWFkeSBleGlzdHMuIFJlYWR5ISIKICBmaQp9CgpfbWFpbiAiJEAiICYKYmFja2dyb3VuZFByb2Nlc3M9JCEKCmlmIFsgLW4gIiRQT1NUR1JFU19BUkNISVZFX1VSSSIgXTsgdGhlbgogIHJlc3RvcmVfZGIgIiRQT1NUR1JFU19EQiIgIiRQT1NUR1JFU19BUkNISVZFX1VSSSIKZWxzZQogIGVjaG8gIkRlY2xpbmluZyB0byByZXN0b3JlIHRoZSBkYiBiZWNhdXNlIG5vIGFyY2hpdmUgdXJpIHdhcyBwcm92aWRlZCIKZmkKCndhaXQgJGJhY2tncm91bmRQcm9jZXNzCgoK

#Here is the ASCII-encoded version of the script in the secret above
#!/usr/bin/env bash
#
#source /usr/local/bin/docker-entrypoint.sh
#
#install_deps() {
# apt-get update -y > /dev/null
# apt-get install curl -y > /dev/null
# apt-get install unzip -y > /dev/null
# curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" > /dev/null
# unzip awscliv2.zip > /dev/null
# ./aws/install > /dev/null
#}
#
#db_has_been_restored() {
# if [ ! -f "$PGDATA/CPLN_RESTORED" ]; then
# return 1
# fi
#
# if ! grep -q "\-> 1ドル$" "$PGDATA/CPLN_RESTORED"; then
# return 1
# else
# return 0
# fi
#}
#
#restore_db() {
# while [ ! -S /var/run/postgresql/.s.PGSQL.5432 ]
# do
# echo "Waiting 5s for db socket to be available"
# sleep 5s
# done
#
#
# if ! db_has_been_restored "1ドル"; then
# echo "It appears db '1ドル' has not yet been restored from S3. Attempting to restore 1ドル from 2ドル"
# install_deps
# docker_setup_db #Ensures $POSTGRES_DB exists (defined in the entrypoint script from the postgres docker image)
# aws s3 cp "2ドル" - | pg_restore --clean --no-acl --no-owner -d "1ドル" -U "$POSTGRES_USER"
# echo "$(date): 2ドル -> 1ドル" | cat >> "$PGDATA/CPLN_RESTORED"
# else
# echo "Db '1ドル' already exists. Ready!"
# fi
#}
#
#_main "$@" &
#backgroundProcess=$!
#
#if [ -n "$POSTGRES_ARCHIVE_URI" ]; then
# restore_db "$POSTGRES_DB" "$POSTGRES_ARCHIVE_URI"
#else
# echo "Declining to restore the db because no archive uri was provided"
#fi
#
#wait $backgroundProcess

---
kind: identity
name: postgres-stateful-identity
description: postgres-stateful-identity

---
kind: policy
name: postgres-stateful-access
description: postgres-stateful-access
bindings:
- permissions:
- reveal
- use
- view
principalLinks:
- //gvc/react-webpack-rails-tutorial/identity/postgres-stateful-identity #Replace YOUR_GVC_HERE with the name of your gvc
targetKind: secret
targetLinks:
- //secret/postgres-stateful-credentials
- //secret/postgres-stateful-entrypoint-script

---
kind: workload
name: postgres-stateful
description: postgres-stateful
spec:
type: stateful
containers:
- cpu: 1000m
memory: 512Mi
env:
# - name: POSTGRES_ARCHIVE_URI #Use this var to control the automatic restore behavior. If you leave it out, the db will start empty.
# value: s3://YOUR_BUCKET/PATH_TO_ARCHIVE_FILE
- name: PGDATA #The location postgres stores the db. This can be anything other than /var/lib/postgresql/data, but it must be inside the mount point for the volume set
value: "/var/lib/postgresql/data/pg_data"
- name: POSTGRES_DB #The name of the initial db
value: test
- name: POSTGRES_PASSWORD #The password for the default user
value: cpln://secret/postgres-stateful-credentials.password
- name: POSTGRES_USER #The name of the default user
value: cpln://secret/postgres-stateful-credentials.username
name: stateful
image: postgres:15
command: /bin/bash
args:
- "-c"
- "cat /usr/local/bin/cpln-entrypoint.sh >> ./cpln-entrypoint.sh && chmod u+x ./cpln-entrypoint.sh && ./cpln-entrypoint.sh postgres"
#command: "cpln-entrypoint.sh"
#args:
# - "postgres"
ports:
- number: 5432
protocol: tcp
volumes:
- uri: cpln://volumeset/postgres-stateful-vs
path: "/var/lib/postgresql/data"
- uri: cpln://secret/postgres-stateful-entrypoint-script
path: "/usr/local/bin/cpln-entrypoint.sh"
inheritEnv: false
livenessProbe:
tcpSocket:
port: 5432
failureThreshold: 1
readinessProbe:
tcpSocket:
port: 5432
failureThreshold: 1
identityLink: //identity/postgres-stateful-identity
defaultOptions:
capacityAI: false
autoscaling:
metric: cpu
target: 95
maxScale: 1
firewallConfig:
external:
inboundAllowCIDR: []
outboundAllowCIDR:
- 0.0.0.0/0
internal:
inboundAllowType: same-gvc

AltStyle によって変換されたページ (->オリジナル) /