-
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
c32ace7
commit 2463565
Showing
2 changed files
with
33 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
packages: | ||
yum: | ||
postgresql-devel: [] | ||
commands: | ||
01_update_yum: | ||
command: "sudo yum update -y" | ||
02_enable_postgresql14: | ||
command: "sudo amazon-linux-extras enable postgresql14" | ||
03_install_postgresql_devel: | ||
command: "sudo yum install postgresql-devel -y" | ||
|
||
## Below command is used for single-instance local postgres | ||
04_postgresql_server_setup: | ||
test: "[ ! -f /usr/bin/psql ]" | ||
command: | | ||
sudo yum install postgresql-server -y | ||
sudo postgresql-setup initdb | ||
sudo systemctl start postgresql | ||
sudo systemctl enable postgresql | ||
sudo sed -i "/^host\s*all\s*all\s*.*$/ s/ident/scram-sha-256/" /var/lib/pgsql/data/pg_hba.conf | ||
sudo systemctl restart postgresql | ||
SECRETS_JSON=$(aws secretsmanager get-secret-value --secret-id "mysterio" --region "ap-south-1" --query "SecretString" --output text) | ||
DB_NAME=$(echo "$SECRETS_JSON" | jq -r '.DB_NAME') | ||
DB_PASS=$(echo "$SECRETS_JSON" | jq -r '.DB_PASSWORD') | ||
DB_USER=$(echo "$SECRETS_JSON" | jq -r '.DB_USER') | ||
sudo -u postgres psql -c "CREATE DATABASE ${DB_NAME};" | ||
sudo -u postgres psql -c "CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASS}';" | ||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} TO ${DB_USER};" |
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,8 @@ | ||
commands: | ||
01_redis_server_setup: | ||
test: "[ ! -f /usr/bin/redis-server ]" | ||
command: | | ||
sudo yum update -y | ||
sudo amazon-linux-extras install redis6 | ||
sudo systemctl start redis | ||
sudo systemctl enable redis |