Skip to content

Replace hkgmetadb with ams-pg.ooni.nu #451

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

Open
wants to merge 2 commits into
base: api-flip-db
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 1 addition & 35 deletions ansible/deploy-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,10 @@
---
- import_playbook: ansible-version.yml

- hosts: [datacollector.infra.ooni.io, hkgmetadb.infra.ooni.io, amsmetadb.ooni.nu]
- hosts: datacollector.infra.ooni.io
roles:
- docker_py

- hosts: hkgmetadb.infra.ooni.io
gather_facts: false # already gathered
roles:
- role: ooca-cert
ooca_ssl_dir: /srv/pl-psql_ssl/pusher
ooca_ssl_subj: '/O=OONI/OU=Prometheus Pusher/CN=plpsql@{{ inventory_hostname }}'
ooca_group: plpsql
ooca_ca: pusher_ca
tags: [ on-rename, plpsql ]

- hosts: [hkgmetadb.infra.ooni.io, amsmetadb.ooni.nu]
gather_facts: false # already gathered
vars:
ansible_python_interpreter: "/root/venv/bin/python2.7"
roles:
- role: plpsql
tags: plpsql

- hosts: hkgmetadb.infra.ooni.io
gather_facts: false
tasks:
- name: ensure replication user exists
postgresql_user:
login_host: localhost
login_user: shovel
login_password: '{{ shovel_postgres_password }}'
db: metadb # otherwise connection fail
name: amsrepl
password: '{{ amsrepl_hkgmetadb_password }}'
encrypted: true
role_attr_flags: 'REPLICATION,LOGIN'
state: present
tags: plpsql

- hosts: datacollector.infra.ooni.io
gather_facts: false # already gathered
vars:
Expand Down
2 changes: 1 addition & 1 deletion ansible/host_vars/ams-api.ooni.nu/vars.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
oomsm_db_url: 'postgresql://amsapi:{{ metadb_amsapi_password }}@amsmetadb.ooni.nu/metadb'
oomsm_db_url: 'postgresql://amsapi:{{ metadb_amsapi_password }}@ams-pg.ooni.nu/metadb'
blocklist_ips: '{{ vault_blocklist_ips }}'
...
4 changes: 2 additions & 2 deletions ansible/roles/airflow/files/docker-trampoline
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ case "$script" in
volargs="${volargs} --volume=$public/autoclaved/${bucket}:$public/autoclaved/${bucket}:ro"
set -- /usr/local/bin/centrifugation.py --start "$isofrom" --end "$isotill" \
--autoclaved-root /data/ooni/public/autoclaved \
--postgres "host=hkgmetadb.infra.ooni.io user=shovel dbname=metadb"
--postgres "host=ams-pg.ooni.nu user=shovel dbname=metadb"
;;

# WAL is flushed after `meta_pg` to ensure that hot replica is not affected
Expand All @@ -97,7 +97,7 @@ case "$script" in
# It may be postgres:9.6 as well, openobservatory/... is used only for consistency.
exec docker run $docksafe --env-file=/etc/af-worker/hkgmetadb.env \
openobservatory/sysadmin-postgres-metadb:20190412-010f6f70 \
psql --host=hkgmetadb.infra.ooni.io --username=shovel --dbname=metadb \
psql --host=ams-pg.ooni.nu --username=shovel --dbname=metadb \
-c 'CHECKPOINT; SELECT pg_switch_xlog()'
exit 1 # if exec fails
;;
Expand Down