Last minute changes to migration strategy.

This commit is contained in:
Samuel Clay 2024-02-25 12:30:42 -05:00
parent 015d922cb2
commit 41bf125467
7 changed files with 38 additions and 12 deletions

View file

@ -2,8 +2,10 @@
- name: Set facts for secondary elasticsearch servers
set_fact:
elasticsearch_secondary: yes
when: inventory_hostname not in ["db-elasticsearch"]
# when: inventory_hostname not in ["hdb-elasticsearch"]
# when: inventory_hostname not in ["db-elasticsearch"]
when: inventory_hostname not in ["hdb-elasticsearch"]
tags:
- always
- name: Permissions for elasticsearch
become: yes

View file

@ -2,9 +2,11 @@
- name: Set mongo_analytics_secondary
set_fact:
mongo_analytics_secondary: yes
when: (inventory_hostname | regex_replace('\-?[0-9]+', '')) not in ['db-mongo-analytics']
# when: (inventory_hostname | regex_replace('\-?[0-9]+', '')) not in ['db-mongo-analytics']
when: (inventory_hostname | regex_replace('\-?[0-9]+', '')) not in ['hdb-mongo-analytics']
tags:
- consul
- always
- name: Permissions for mongo
become: yes

View file

@ -1,4 +1,12 @@
---
- name: Set facts for secondary postgres servers
set_fact:
postgres_secondary: yes
# when: inventory_hostname not in ["db-postgres2"]
when: inventory_hostname not in ["hdb-postgres-1"]
tags:
- always
- name: Template postgresql-13.conf file
template:
src: /srv/newsblur/docker/postgres/postgresql-13.conf.j2

View file

@ -1,6 +1,6 @@
{
"service": {
{% if inventory_hostname.startswith('db-postgres2') %}
{% if not postgres_secondary %}
"name": "db-postgres",
{% else %}
"name": "db-postgres-secondary",

View file

@ -3,22 +3,27 @@
set_fact:
redis_role: "{{ inventory_hostname.split('-')[2] }}"
# redis_port: 6379
redis_secondary: yes
redis_ports:
story: 6380
user: 6381
session: 6382
pubsub: 6383
tags:
- always
- name: Set redis_port for redis servers
set_fact:
redis_port: "{{ redis_ports[redis_role] }}"
tags:
- always
- name: Set redis_secondary for secondary redis servers
set_fact:
redis_secondary: yes
when: inventory_hostname not in ["db-redis-user", "db-redis-story1", "db-redis-session", "db-redis-pubsub"]
# when: inventory_hostname not in ["hdb-redis-user-1", "hdb-redis-story-1", "hdb-redis-session-1", "hdb-redis-pubsub"]
# when: inventory_hostname not in ["db-redis-user", "db-redis-story1", "db-redis-session", "db-redis-pubsub"]
when: inventory_hostname not in ["hdb-redis-user-1", "hdb-redis-story-1", "hdb-redis-session-1", "hdb-redis-pubsub"]
tags:
- always
- name: Install sysfsutils for disabling transparent huge pages
become: yes

View file

@ -273,7 +273,8 @@ backend maintenance
option httpchk HEAD /maintenance
http-check expect status 404
http-check send-state
server maintenance app-django1.node.nyc1.consul:80 check inter 2000ms resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
# server maintenance app-django1.node.nyc1.consul:80 check inter 2000ms resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
server maintenance happ-web-01.node.nyc1.consul:80 check inter 2000ms resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
listen stats
bind :1936 ssl crt {{ ssl_certificate }}

View file

@ -3,6 +3,9 @@
"Afterwards, you shouldn't notice anything different, although these are bare metal servers, so theoretically they should be faster and more reliable."
make maintenance_on
make celery_stop
# Postgres
# Edit postgres/consul_service.json: db-postgres2 -> hdb-postgres-1
@ -23,10 +26,10 @@ aps -l db-mongo-analytics,hdb-mongo-analytics -t consul
# Redis
# Edit redis/tasks/main.yml: redis_secondary
aps -l hdb-redis-user-1,hdb-redis-user-2 -t redis
aps -l hdb-redis-session-1,hdb-redis-session-2 -t redis
aps -l hdb-redis-story-1,hdb-redis-story-2 -t redis
aps -l hdb-redis-pubsub -t redis
aps -l hdb-redis-user-1,hdb-redis-user-2,db-redis-user -t consul
aps -l hdb-redis-session-1,hdb-redis-session-2,db-redis-sessions -t consul
aps -l hdb-redis-story-1,hdb-redis-story-2,db-redis-story1 -t consul
aps -l hdb-redis-pubsub,db-redis-pubsub -t consul
apd -l hdb-redis-user-1,hdb-redis-session-1,hdb-redis-story-1,hdb-redis-pubsub -t replicaofnoone
# Elasticsearch
@ -35,6 +38,11 @@ apd -l hdb-redis-user-1,hdb-redis-session-1,hdb-redis-story-1,hdb-redis-pubsub -
aps -l hdb-elasticsearch-1 -t elasticsearch
# Eventually MUserSearch.remove_all()
# Test hwww.newsblur.com
ansible-playbook ansible/deploy.yml -l happ-web-01 --tags maintenance_off
# Looks good? Launch
# Haproxy on DO to redirect to Hetzner
aps -l www -t haproxy
# Change DNS to point to Hetzner
make maintenance_off