XoneB 4 LIFE

This commit is contained in:
Samuel Clay 2022-02-08 15:32:43 -05:00
parent 902f0b3d8e
commit b6763d872f
7 changed files with 30 additions and 10 deletions

View file

@ -1,6 +1,6 @@
---
- name: SETUP -> www containers
hosts: www
hosts: haproxy
vars:
- update_apt_cache: yes
- motd_role: app

View file

@ -224,9 +224,11 @@
# tags:
# - mongo-backup
# Renaming a db-mongo3 to db-mongo2:
# - Change hostname to db-mongo2 on Digital Ocean (doctl)
# - Change hostname to db-mongo2 in /etc/hostname
# Renaming a db-mongo-primary3 to db-mongo-primary2:
# - Change hostname to db-mongo-primary2 on Digital Ocean
# - make list; doctl compute droplet-action rename <id> --droplet-name db-mongo-primary2
# - Change hostname to db-mongo-primary2 in /etc/hostname
# - make inventory
# - Symlink /mnt/mongo2 to /mnt/mongo3
# - tf state mv "digitalocean_droplet.db-mongo-primary[2]" "digitalocean_droplet.db-mongo-primary[1]"
# - tf state mv "digitalocean_volume.mongo_volume[2]" "digitalocean_volume.mongo_volume[1]"

View file

@ -47,6 +47,9 @@ frontend public
acl mx_mode nbsrv(maintenance) lt 1
acl is_unread_count url_beg /reader/feed_unread_count
acl is_refresh_feeds url_beg /reader/refresh_feed
acl is_original_text url_beg /rss_feeds/original_text
acl is_river url_beg /reader/river_stories
acl is_automated_river urlp(h) -m found
acl is_dashboard url_param(dashboard) -i true
monitor-uri /status
@ -80,6 +83,8 @@ frontend public
use_backend app_counts if is_unread_count
use_backend app_refresh if is_refresh_feeds
use_backend app_refresh if is_dashboard
use_backend app_refresh if is_original_text
use_backend app_refresh if is_river is_automated_river
use_backend app_django unless gunicorn_dead || nginx_dead
backend nginx

View file

@ -41,6 +41,9 @@ frontend public
acl mx_mode nbsrv(maintenance) lt 1
acl is_unread_count url_beg /reader/feed_unread_count
acl is_refresh_feeds url_beg /reader/refresh_feed
acl is_original_text url_beg /rss_feeds/original_text
acl is_river url_beg /reader/river_stories
acl is_automated_river urlp(h) -m found
acl is_dashboard url_param(dashboard) -i true
monitor-uri /status
@ -68,6 +71,8 @@ frontend public
use_backend app_django_counts if is_unread_count
use_backend app_django_refresh if is_refresh_feeds
use_backend app_django_refresh if is_dashboard
use_backend app_django_refresh if is_original_text
use_backend app_django_refresh if is_river is_automated_river
use_backend app_django unless gunicorn_dead || nginx_dead
@ -121,7 +126,7 @@ backend maintenance
server nginx localhost:81 check inter 60000ms
listen stats
bind :1936 ssl crt /srv/newsblur/config/certificates/newsblur.com.pem
bind :1936 ssl crt /srv/newsblur/config/certificates/newsblur.com.pem ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA no-sslv3
stats enable
stats hide-version
stats realm Haproxy\ Statistics

View file

@ -46,10 +46,11 @@ resource "digitalocean_droplet" "db-consul" {
}
resource "digitalocean_droplet" "www" {
count = 2
image = var.droplet_os
name = "www"
name = "www${count.index+1}"
region = var.droplet_region
size = var.droplet_size
size = var.droplet_size_15
ssh_keys = [digitalocean_ssh_key.default.fingerprint]
provisioner "local-exec" {
command = "/srv/newsblur/ansible/utils/generate_inventory.py; sleep 120"
@ -67,7 +68,7 @@ resource "digitalocean_droplet" "app-django" {
image = var.droplet_os
name = "app-django${count.index+1}"
region = var.droplet_region
size = var.droplet_size
size = contains([0,1,2], count.index) ? var.droplet_size_15 : var.droplet_size
ssh_keys = [digitalocean_ssh_key.default.fingerprint]
provisioner "local-exec" {
command = "/srv/newsblur/ansible/utils/generate_inventory.py; sleep 120"
@ -424,7 +425,7 @@ resource "digitalocean_droplet" "db-mongo-primary" {
image = var.droplet_os
name = "db-mongo-primary${count.index+2}"
region = var.droplet_region
size = var.mongo_primary_droplet_size
size = contains([0], count.index) ? "so1_5-2vcpu-16gb" : var.mongo_primary_droplet_size
ssh_keys = [digitalocean_ssh_key.default.fingerprint]
provisioner "local-exec" {
command = "/srv/newsblur/ansible/utils/generate_inventory.py; sleep 120"

View file

@ -13,6 +13,10 @@ variable "droplet_size_10" {
type = string
default = "s-1vcpu-2gb"
}
variable "droplet_size_15" {
type = string
default = "s-2vcpu-2gb"
}
variable "droplet_size_20" {
type = string
@ -47,7 +51,7 @@ variable "mongo_droplet_size" {
variable "mongo_primary_droplet_size" {
type = string
default = "so1_5-2vcpu-16gb"
default = "so-4vcpu-32gb"
}
variable "metrics_droplet_size" {

View file

@ -17,6 +17,9 @@ IGNORE_HOSTS = [
'app-push',
]
# Use this to count the number of times each user shows up in the logs. Good for finding abusive accounts.
# tail -n20000 logs/newsblur.log | sed 's/\x1b\[[0-9;]*m//g' | sed -En 's/.*?[0-9]s\] \[([a-zA-Z0-9]+\*?)\].*/\1/p' | sort | uniq -c | sort
def main(roles=None, command=None, path=None):
delay = 1