-
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.
Add missing sql file
- Loading branch information
Showing
5 changed files
with
136 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Deploy binaries | ||
# Deploy on both VMs, only the primary is "active" | ||
hosts: servers | ||
remote_user: ubuntu | ||
roles: | ||
- role: deploy |
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,15 @@ | ||
$ANSIBLE_VAULT;1.1;AES256 | ||
39323433373866646663333962396637323937663436333763373663306264363337383838313531 | ||
3237623337373630343264663232346366316332326564330a343062633165363564616663373366 | ||
38303633346231626433393232313332373933626432613534646538326638623339323830613465 | ||
3135643661323930370a656136326637373933353665316462373938396338383831353039323731 | ||
61363032653830613438313564303432613531636436306662666336383838616132666234616538 | ||
34313861306432626237383464623134386565643831396537343232646237323764346633373461 | ||
30333265653634313436323735633733623032333039303461633931383337333664333636386532 | ||
66383830323265303334323163313862393466383362646634653764373230613464393332363336 | ||
63346438306666633835316333323464623261643861646636316637346363626162303662303039 | ||
38616335356663343762356465653635623330383532656464633537333933613632336433653838 | ||
36633130356262383464653935653864323233346162656639303861643533643563376464633530 | ||
62343336663961363566383438393866353336366438343365363663623162313838396666343539 | ||
39363766316532626463363533653561333933663130353632353934393534333965346637626636 | ||
3138623135623031386437353434643736323166623661666263 |
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,30 @@ | ||
--- | ||
- name: Perform DB migration | ||
hosts: servers | ||
remote_user: ubuntu | ||
gather_facts: false | ||
vars: | ||
primary: lard-a | ||
|
||
tasks: | ||
- name: Copy the db folder to the remote | ||
ansible.builtin.copy: | ||
src: "{{ playbook_dir }}/../db/" | ||
dest: /etc/postgresql/16/db/ | ||
mode: "0755" | ||
become: true | ||
|
||
- name: Migrate primary | ||
when: inventory_hostname == primary | ||
become: true | ||
become_user: postgres | ||
block: | ||
- name: Update public schema in lard | ||
community.postgresql.postgresql_script: | ||
db: lard | ||
path: /etc/postgresql/16/db/public.sql | ||
|
||
- name: Create partition tables in lard | ||
community.postgresql.postgresql_script: | ||
db: lard | ||
path: /etc/postgresql/16/db/partitions_generated.sql |
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,73 @@ | ||
-- Generated by simple script for testing | ||
CREATE TABLE IF NOT EXISTS data_y1950_to_y2000 PARTITION OF public.data | ||
FOR VALUES FROM ('1950-01-01 00:00:00+00') TO ('2000-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2000_to_y2010 PARTITION OF public.data | ||
FOR VALUES FROM ('2000-01-01 00:00:00+00') TO ('2010-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2010_to_y2015 PARTITION OF public.data | ||
FOR VALUES FROM ('2010-01-01 00:00:00+00') TO ('2015-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2015_to_y2016 PARTITION OF public.data | ||
FOR VALUES FROM ('2015-01-01 00:00:00+00') TO ('2016-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2016_to_y2017 PARTITION OF public.data | ||
FOR VALUES FROM ('2016-01-01 00:00:00+00') TO ('2017-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2017_to_y2018 PARTITION OF public.data | ||
FOR VALUES FROM ('2017-01-01 00:00:00+00') TO ('2018-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2018_to_y2019 PARTITION OF public.data | ||
FOR VALUES FROM ('2018-01-01 00:00:00+00') TO ('2019-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2019_to_y2020 PARTITION OF public.data | ||
FOR VALUES FROM ('2019-01-01 00:00:00+00') TO ('2020-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2020_to_y2021 PARTITION OF public.data | ||
FOR VALUES FROM ('2020-01-01 00:00:00+00') TO ('2021-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2021_to_y2022 PARTITION OF public.data | ||
FOR VALUES FROM ('2021-01-01 00:00:00+00') TO ('2022-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2022_to_y2023 PARTITION OF public.data | ||
FOR VALUES FROM ('2022-01-01 00:00:00+00') TO ('2023-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2023_to_y2024 PARTITION OF public.data | ||
FOR VALUES FROM ('2023-01-01 00:00:00+00') TO ('2024-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2024_to_y2025 PARTITION OF public.data | ||
FOR VALUES FROM ('2024-01-01 00:00:00+00') TO ('2025-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2025_to_y2026 PARTITION OF public.data | ||
FOR VALUES FROM ('2025-01-01 00:00:00+00') TO ('2026-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2026_to_y2027 PARTITION OF public.data | ||
FOR VALUES FROM ('2026-01-01 00:00:00+00') TO ('2027-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2027_to_y2028 PARTITION OF public.data | ||
FOR VALUES FROM ('2027-01-01 00:00:00+00') TO ('2028-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2028_to_y2029 PARTITION OF public.data | ||
FOR VALUES FROM ('2028-01-01 00:00:00+00') TO ('2029-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS data_y2029_to_y2030 PARTITION OF public.data | ||
FOR VALUES FROM ('2029-01-01 00:00:00+00') TO ('2030-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y1950_to_y2000 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('1950-01-01 00:00:00+00') TO ('2000-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2000_to_y2010 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2000-01-01 00:00:00+00') TO ('2010-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2010_to_y2015 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2010-01-01 00:00:00+00') TO ('2015-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2015_to_y2016 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2015-01-01 00:00:00+00') TO ('2016-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2016_to_y2017 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2016-01-01 00:00:00+00') TO ('2017-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2017_to_y2018 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2017-01-01 00:00:00+00') TO ('2018-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2018_to_y2019 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2018-01-01 00:00:00+00') TO ('2019-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2019_to_y2020 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2019-01-01 00:00:00+00') TO ('2020-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2020_to_y2021 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2020-01-01 00:00:00+00') TO ('2021-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2021_to_y2022 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2021-01-01 00:00:00+00') TO ('2022-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2022_to_y2023 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2022-01-01 00:00:00+00') TO ('2023-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2023_to_y2024 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2023-01-01 00:00:00+00') TO ('2024-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2024_to_y2025 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2024-01-01 00:00:00+00') TO ('2025-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2025_to_y2026 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2025-01-01 00:00:00+00') TO ('2026-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2026_to_y2027 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2026-01-01 00:00:00+00') TO ('2027-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2027_to_y2028 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2027-01-01 00:00:00+00') TO ('2028-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2028_to_y2029 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2028-01-01 00:00:00+00') TO ('2029-01-01 00:00:00+00'); | ||
CREATE TABLE IF NOT EXISTS nonscalar_data_y2029_to_y2030 PARTITION OF public.nonscalar_data | ||
FOR VALUES FROM ('2029-01-01 00:00:00+00') TO ('2030-01-01 00:00:00+00'); |
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,11 @@ | ||
#!/bin/bash | ||
|
||
if ! cargo build --workspace --release; then | ||
exit 1 | ||
fi | ||
|
||
pushd ansible || exit | ||
|
||
ansible-playbook -i inventory.yml deploy.yml --ask-vault-pass | ||
|
||
popd || exit |