Merge branch 'master' into dejal

* master:
  Fixing date hack for folder rss feeds.
  Fixing date hack for RSS feeds for folders to not turn off until a year after premium archive has launched.
  Favicons count++
  Bumping up sentry and node text servers.
  ansible_ssh_host -> ansible_host
This commit is contained in:
Samuel Clay 2022-09-02 10:03:34 -04:00
commit cb32376ce1
20 changed files with 44 additions and 36 deletions

View file

@ -16,6 +16,9 @@ groups:
node: inventory_hostname.startswith('node') node: inventory_hostname.startswith('node')
node_socket: inventory_hostname.startswith('node-socket') node_socket: inventory_hostname.startswith('node-socket')
node_images: inventory_hostname.startswith('node-images') node_images: inventory_hostname.startswith('node-images')
node_text: inventory_hostname.startswith('node-text')
node_page: inventory_hostname.startswith('node-page')
node_favicons: inventory_hostname.startswith('node-favicons')
# debugs: inventory_hostname.startswith('debug') # debugs: inventory_hostname.startswith('debug')

View file

@ -6,7 +6,7 @@
], ],
"checks": [{ "checks": [{
"id": "consul-manager", "id": "consul-manager",
"http": "http://{{ ansible_ssh_host }}:8500", "http": "http://{{ ansible_host }}:8500",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
}], }],

View file

@ -7,7 +7,7 @@
"port": 9200, "port": 9200,
"checks": [{ "checks": [{
"id": "es-ping", "id": "es-ping",
"http": "http://{{ ansible_ssh_host }}:5579/db_check/elasticsearch", "http": "http://{{ ansible_host }}:5579/db_check/elasticsearch",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
}] }]

View file

@ -6,7 +6,7 @@
], ],
"checks": [{ "checks": [{
"id": "grafana-ping", "id": "grafana-ping",
"http": "http://{{ ansible_ssh_host }}:3000/api/health", "http": "http://{{ ansible_host }}:3000/api/health",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
}], }],

View file

@ -9,10 +9,10 @@
"checks": [ "checks": [
{ {
"id": "{{inventory_hostname}}-exporter-ping", "id": "{{inventory_hostname}}-exporter-ping",
"http": "http://{{ ansible_ssh_host }}:9216", "http": "http://{{ ansible_host }}:9216",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
} }
] ]
} }
} }

View file

@ -8,7 +8,7 @@
"port": 27017, "port": 27017,
"checks": [{ "checks": [{
"id": "mongo-analytics-ping", "id": "mongo-analytics-ping",
"http": "http://{{ ansible_ssh_host }}:5579/db_check/mongo_analytics?consul=1", "http": "http://{{ ansible_host }}:5579/db_check/mongo_analytics?consul=1",
"interval": "15s" "interval": "15s"
}] }]
} }

View file

@ -8,7 +8,7 @@
"port": 27017, "port": 27017,
"checks": [{ "checks": [{
"id": "mongo-ping", "id": "mongo-ping",
"http": "http://{{ ansible_ssh_host }}:5579/db_check/mongo?consul=1", "http": "http://{{ ansible_host }}:5579/db_check/mongo?consul=1",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
}] }]

View file

@ -9,10 +9,10 @@
"checks": [ "checks": [
{ {
"id": "{{inventory_hostname}}-node-exporter-ping", "id": "{{inventory_hostname}}-node-exporter-ping",
"http": "http://{{ ansible_ssh_host }}:9100", "http": "http://{{ ansible_host }}:9100",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
} }
] ]
} }
} }

View file

@ -13,13 +13,13 @@
"checks": [{ "checks": [{
"id": "{{inventory_hostname}}-ping", "id": "{{inventory_hostname}}-ping",
{% if item.target_host == "node-images" %} {% if item.target_host == "node-images" %}
"http": "http://{{ ansible_ssh_host }}:{{ item.port }}/sc,seLJDaKBog3LLEMDe8cjBefMhnVSibO4RA5boZhWcVZ0=/https://samuelclay.com/static/images/2019%20-%20Cuba.jpg", "http": "http://{{ ansible_host }}:{{ item.port }}/sc,seLJDaKBog3LLEMDe8cjBefMhnVSibO4RA5boZhWcVZ0=/https://samuelclay.com/static/images/2019%20-%20Cuba.jpg",
{% elif item.target_host == "node-favicons" %} {% elif item.target_host == "node-favicons" %}
"http": "http://{{ ansible_ssh_host }}:{{ item.port }}/rss_feeds/icon/1", "http": "http://{{ ansible_host }}:{{ item.port }}/rss_feeds/icon/1",
{% elif item.target_host == "node-text" %} {% elif item.target_host == "node-text" %}
"http": "http://{{ ansible_ssh_host }}:{{ item.port }}/rss_feeds/original_text_fetcher?test=1", "http": "http://{{ ansible_host }}:{{ item.port }}/rss_feeds/original_text_fetcher?test=1",
{% elif item.target_host == "node-page" %} {% elif item.target_host == "node-page" %}
"http": "http://{{ ansible_ssh_host }}:{{ item.port }}/original_page/1?test=1", "http": "http://{{ ansible_host }}:{{ item.port }}/original_page/1?test=1",
{% endif %} {% endif %}
"interval": "15s" "interval": "15s"
}] }]

View file

@ -9,10 +9,10 @@
"checks": [ "checks": [
{ {
"id": "{{inventory_hostname}}-exporter-ping", "id": "{{inventory_hostname}}-exporter-ping",
"http": "http://{{ ansible_ssh_host }}:9187", "http": "http://{{ ansible_host }}:9187",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
} }
] ]
} }
} }

View file

@ -11,7 +11,7 @@
"port": 5432, "port": 5432,
"checks": [{ "checks": [{
"id": "postgres-ping", "id": "postgres-ping",
"http": "http://{{ ansible_ssh_host }}:5579/db_check/postgres?consul=1", "http": "http://{{ ansible_host }}:5579/db_check/postgres?consul=1",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
}] }]

View file

@ -6,10 +6,10 @@
], ],
"checks": [{ "checks": [{
"id": "prometheus-ping", "id": "prometheus-ping",
"http": "http://{{ ansible_ssh_host }}:9090/metrics", "http": "http://{{ ansible_host }}:9090/metrics",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
}], }],
"port": 9090 "port": 9090
} }
} }

View file

@ -9,10 +9,10 @@
"checks": [ "checks": [
{ {
"id": "{{ item.redis_target }}-exporter-ping", "id": "{{ item.redis_target }}-exporter-ping",
"http": "http://{{ ansible_ssh_host }}:{{ item.port }}", "http": "http://{{ ansible_host }}:{{ item.port }}",
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4
} }
] ]
} }
} }

View file

@ -13,15 +13,15 @@
"checks": [{ "checks": [{
"id": "{{inventory_hostname}}-ping", "id": "{{inventory_hostname}}-ping",
{% if inventory_hostname.startswith('db-redis-story') %} {% if inventory_hostname.startswith('db-redis-story') %}
"http": "http://{{ ansible_ssh_host }}:5579/db_check/redis_story?consul=1", "http": "http://{{ ansible_host }}:5579/db_check/redis_story?consul=1",
{% elif inventory_hostname.startswith('db-redis-user') %} {% elif inventory_hostname.startswith('db-redis-user') %}
"http": "http://{{ ansible_ssh_host }}:5579/db_check/redis_user?consul=1", "http": "http://{{ ansible_host }}:5579/db_check/redis_user?consul=1",
{% elif inventory_hostname.startswith('db-redis-pubsub') %} {% elif inventory_hostname.startswith('db-redis-pubsub') %}
"http": "http://{{ ansible_ssh_host }}:5579/db_check/redis_pubsub?consul=1", "http": "http://{{ ansible_host }}:5579/db_check/redis_pubsub?consul=1",
{% elif inventory_hostname.startswith('db-redis-sessions') %} {% elif inventory_hostname.startswith('db-redis-sessions') %}
"http": "http://{{ ansible_ssh_host }}:5579/db_check/redis_sessions?consul=1", "http": "http://{{ ansible_host }}:5579/db_check/redis_sessions?consul=1",
{% else %} {% else %}
"http": "http://{{ ansible_ssh_host }}:5000/db_check/redis?consul=1", "http": "http://{{ ansible_host }}:5000/db_check/redis?consul=1",
{% endif %} {% endif %}
"interval": "15s", "interval": "15s",
"failures_before_critical": 4 "failures_before_critical": 4

View file

@ -1159,7 +1159,7 @@ def starred_stories_rss_feed_tag(request, user_id, secret_token, tag_slug):
def folder_rss_feed(request, user_id, secret_token, unread_filter, folder_slug): def folder_rss_feed(request, user_id, secret_token, unread_filter, folder_slug):
domain = Site.objects.get_current().domain domain = Site.objects.get_current().domain
date_hack_2023 = (datetime.datetime.now() > datetime.datetime(2023, 7, 1))
try: try:
user = User.objects.get(pk=user_id) user = User.objects.get(pk=user_id)
except User.DoesNotExist: except User.DoesNotExist:
@ -1169,7 +1169,7 @@ def folder_rss_feed(request, user_id, secret_token, unread_filter, folder_slug):
feed_ids, folder_title = user_sub_folders.feed_ids_under_folder_slug(folder_slug) feed_ids, folder_title = user_sub_folders.feed_ids_under_folder_slug(folder_slug)
usersubs = UserSubscription.subs_for_feeds(user.pk, feed_ids=feed_ids) usersubs = UserSubscription.subs_for_feeds(user.pk, feed_ids=feed_ids)
if feed_ids and user.profile.is_archive: if feed_ids and ((user.profile.is_archive and date_hack_2023) or (not date_hack_2023)):
params = { params = {
"user_id": user.pk, "user_id": user.pk,
"feed_ids": feed_ids, "feed_ids": feed_ids,
@ -1268,7 +1268,7 @@ def folder_rss_feed(request, user_id, secret_token, unread_filter, folder_slug):
rss.add_item(**story_data) rss.add_item(**story_data)
# TODO: Remove below date hack to accomodate users who paid for premium but want folder rss # TODO: Remove below date hack to accomodate users who paid for premium but want folder rss
if not user.profile.is_archive and (datetime.datetime.now() > datetime.datetime(2023, 7, 1)): if not user.profile.is_archive and date_hack_2023:
story_data = { story_data = {
'title': "You must have a premium archive subscription on NewsBlur to have RSS feeds for folders.", 'title': "You must have a premium archive subscription on NewsBlur to have RSS feeds for folders.",
'link': "https://%s/?next=premium" % domain, 'link': "https://%s/?next=premium" % domain,

View file

@ -63,7 +63,7 @@ frontend public
use_backend app_push if { hdr_end(host) -i push.newsblur.com } use_backend app_push if { hdr_end(host) -i push.newsblur.com }
use_backend node_socket if { path_beg /v3/socket.io/ } use_backend node_socket if { path_beg /v3/socket.io/ }
use_backend node_favicon if { path_beg /rss_feeds/icon/ } use_backend node_favicons if { path_beg /rss_feeds/icon/ }
use_backend node_text if { path_beg /rss_feeds/original_text_fetcher } use_backend node_text if { path_beg /rss_feeds/original_text_fetcher }
use_backend node_images if { hdr_end(host) -i imageproxy.newsblur.com } use_backend node_images if { hdr_end(host) -i imageproxy.newsblur.com }
use_backend node_images if { hdr_end(host) -i imageproxy2.newsblur.com } use_backend node_images if { hdr_end(host) -i imageproxy2.newsblur.com }
@ -174,7 +174,7 @@ backend node_socket
server {{host}} {{host}}.node.nyc1.consul:8008 server {{host}} {{host}}.node.nyc1.consul:8008
{% endfor %} {% endfor %}
backend node_favicon backend node_favicons
http-check expect rstatus 200|503 http-check expect rstatus 200|503
option httpchk GET /rss_feeds/icon/1 option httpchk GET /rss_feeds/icon/1
balance roundrobin balance roundrobin
@ -184,7 +184,10 @@ backend node_text
http-check expect rstatus 200|503 http-check expect rstatus 200|503
option httpchk GET /rss_feeds/original_text_fetcher?test=1 option httpchk GET /rss_feeds/original_text_fetcher?test=1
balance roundrobin balance roundrobin
server-template node-text 1 _node-text._tcp.service.nyc1.consul:8008 check inter 2000ms resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none default-server check inter 2000ms resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
{% for host in groups.node_text %}
server {{host}} {{host}}.node.nyc1.consul:8008
{% endfor %}
backend node_page backend node_page
http-check expect rstatus 200|503 http-check expect rstatus 200|503

View file

@ -71,6 +71,6 @@ favicons = (app) =>
if ENV_DEV or ENV_DOCKER if ENV_DEV or ENV_DOCKER
res.redirect '/media/img/icons/nouns/world.svg' res.redirect '/media/img/icons/nouns/world.svg'
else else
res.redirect 'https://beta.newsblur.com/media/img/icons/nouns/world.svg' res.redirect 'https://newsblur.com/media/img/icons/nouns/world.svg'
exports.favicons = favicons exports.favicons = favicons

View file

@ -88,7 +88,7 @@
if (ENV_DEV || ENV_DOCKER) { if (ENV_DEV || ENV_DOCKER) {
return res.redirect('/media/img/icons/nouns/world.svg'); return res.redirect('/media/img/icons/nouns/world.svg');
} else { } else {
return res.redirect('https://beta.newsblur.com/media/img/icons/nouns/world.svg'); return res.redirect('https://newsblur.com/media/img/icons/nouns/world.svg');
} }
} }
}); });

View file

@ -228,8 +228,9 @@ resource "digitalocean_droplet" "discovery" {
} }
resource "digitalocean_droplet" "node-text" { resource "digitalocean_droplet" "node-text" {
count = 2
image = var.droplet_os image = var.droplet_os
name = "node-text" name = contains([0], count.index) ? "node-text" : "node-text${count.index+1}"
region = var.droplet_region region = var.droplet_region
size = var.droplet_size size = var.droplet_size
ssh_keys = [digitalocean_ssh_key.default.fingerprint] ssh_keys = [digitalocean_ssh_key.default.fingerprint]
@ -263,8 +264,9 @@ resource "digitalocean_droplet" "node-socket" {
} }
resource "digitalocean_droplet" "node-favicons" { resource "digitalocean_droplet" "node-favicons" {
count = 2
image = var.droplet_os image = var.droplet_os
name = "node-favicons" name = "node-favicons${count.index+1}"
region = var.droplet_region region = var.droplet_region
size = var.droplet_size size = var.droplet_size
ssh_keys = [digitalocean_ssh_key.default.fingerprint] ssh_keys = [digitalocean_ssh_key.default.fingerprint]

View file

@ -54,7 +54,7 @@ variable "droplet_os" {
variable "sentry_droplet_size" { variable "sentry_droplet_size" {
type = string type = string
default = "s-4vcpu-8gb" default = "s-8vcpu-16gb"
} }
variable "metrics_droplet_size" { variable "metrics_droplet_size" {