mirror of
https://github.com/viq/NewsBlur.git
synced 2025-04-13 09:38:09 +00:00
Beginning to add consul to old servers.
This commit is contained in:
parent
d498cca9e1
commit
56cea73a9c
16 changed files with 54 additions and 25 deletions
15
ansible.old.cfg
Normal file
15
ansible.old.cfg
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[defaults]
|
||||||
|
host_key_checking = False
|
||||||
|
remote_user = sclay
|
||||||
|
retry_files_enabled = False
|
||||||
|
inventory = /srv/newsblur/ansible/inventories/digital_ocean.old.ini, /srv/newsblur/ansible/inventories/digital_ocean.old.yml
|
||||||
|
private_key_file = /srv/secrets-newsblur/keys/newsblur.key
|
||||||
|
publickey = /srv/secrets-newsblur/keys/newsblur.key.pub
|
||||||
|
remote_tmp = ~/.ansible/tmp
|
||||||
|
forks = 20
|
||||||
|
|
||||||
|
[inventory]
|
||||||
|
enable_plugins = ini, constructed
|
||||||
|
|
||||||
|
[connection]
|
||||||
|
pipelining = True
|
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
remote_user: nb
|
|
||||||
vars:
|
vars:
|
||||||
- update_apt_cache: yes
|
- update_apt_cache: yes
|
||||||
vars_files:
|
vars_files:
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
- hosts: app,node
|
- hosts: app,node
|
||||||
remote_user: nb
|
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
vars_files:
|
vars_files:
|
||||||
- env_vars/base.yml
|
- env_vars/base.yml
|
||||||
|
|
|
@ -6,8 +6,14 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import digitalocean
|
import digitalocean
|
||||||
|
|
||||||
TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.token"
|
OLD = False
|
||||||
# TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.readprod.token"
|
# Uncomment below line to use existing servers
|
||||||
|
# OLD = True
|
||||||
|
|
||||||
|
if OLD:
|
||||||
|
TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.readprod.token"
|
||||||
|
else:
|
||||||
|
TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.token"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_token = open(TOKEN_FILE, 'r').read().strip()
|
api_token = open(TOKEN_FILE, 'r').read().strip()
|
||||||
|
@ -15,7 +21,7 @@ except IOError:
|
||||||
print(f" ---> Missing Digital Ocean API token: {TOKEN_FILE}")
|
print(f" ---> Missing Digital Ocean API token: {TOKEN_FILE}")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
outfile = "/srv/newsblur/ansible/inventories/digital_ocean.ini"
|
outfile = f"/srv/newsblur/ansible/inventories/digital_ocean{'.old' if OLD else ''}.ini"
|
||||||
|
|
||||||
# Install from https://github.com/do-community/do-ansible-inventory/releases
|
# Install from https://github.com/do-community/do-ansible-inventory/releases
|
||||||
ansible_inventory_cmd = f'do-ansible-inventory -t {api_token} --out {outfile}'
|
ansible_inventory_cmd = f'do-ansible-inventory -t {api_token} --out {outfile}'
|
||||||
|
|
15
ansible/inventories/digital_ocean.old.yml
Normal file
15
ansible/inventories/digital_ocean.old.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
plugin: constructed
|
||||||
|
strict: False
|
||||||
|
|
||||||
|
groups:
|
||||||
|
web: inventory_hostname.startswith('app')
|
||||||
|
app: inventory_hostname.startswith('app')
|
||||||
|
node: inventory_hostname.startswith('node')
|
||||||
|
db: inventory_hostname.startswith('db')
|
||||||
|
task: inventory_hostname.startswith('task')
|
||||||
|
search: inventory_hostname.startswith('db-elasticsearch')
|
||||||
|
elasticsearch: inventory_hostname.startswith('db-elasticsearch')
|
||||||
|
redis: inventory_hostname.startswith('db-redis')
|
||||||
|
postgres: inventory_hostname.startswith('db-postgres')
|
||||||
|
mongo: inventory_hostname.startswith('db-mongo')
|
||||||
|
consul: inventory_hostname.startswith('db-consul')
|
|
@ -1,4 +1,16 @@
|
||||||
---
|
---
|
||||||
|
- name: Allow haproxy stats port
|
||||||
|
ufw: rule=allow port={{ item }}
|
||||||
|
become: yes
|
||||||
|
tags: ufw
|
||||||
|
with_items:
|
||||||
|
- "8000"
|
||||||
|
|
||||||
|
- name: Copy app secrets
|
||||||
|
copy:
|
||||||
|
src: /srv/secrets-newsblur/settings/docker_settings.py
|
||||||
|
dest: /srv/newsblur/newsblur_web/local_settings.py
|
||||||
|
|
||||||
- name: Start NewsBlur Web Docker container
|
- name: Start NewsBlur Web Docker container
|
||||||
become: yes
|
become: yes
|
||||||
docker_container:
|
docker_container:
|
||||||
|
@ -6,22 +18,14 @@
|
||||||
image: newsblur/newsblur_python3
|
image: newsblur/newsblur_python3
|
||||||
container_default_behavior: no_defaults
|
container_default_behavior: no_defaults
|
||||||
env:
|
env:
|
||||||
DOCKERBUILD: "True"
|
DOCKERBUILD: ""
|
||||||
state: started
|
state: started
|
||||||
command: gunicorn --bind :8000 newsblur_web.wsgi:application
|
command: gunicorn --bind :8000 newsblur_web.wsgi:application
|
||||||
ports:
|
network_mode: host
|
||||||
- "8000:8000"
|
|
||||||
expose:
|
|
||||||
- "8000"
|
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- /srv/newsblur:/srv/newsblur
|
- /srv/newsblur:/srv/newsblur
|
||||||
|
|
||||||
- name: Copy app secrets
|
|
||||||
copy:
|
|
||||||
src: /srv/secrets-newsblur/settings/app_settings.py
|
|
||||||
dest: /srv/newsblur/newsblur_web/local_settings.py
|
|
||||||
|
|
||||||
- name: Register web app in consul
|
- name: Register web app in consul
|
||||||
become: yes
|
become: yes
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> app containers
|
- name: SETUP -> app containers
|
||||||
hosts: app
|
hosts: app
|
||||||
remote_user: nb
|
|
||||||
vars:
|
vars:
|
||||||
- update_apt_cache: yes
|
- update_apt_cache: yes
|
||||||
- motd_role: app
|
- motd_role: app
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> consul manager containers
|
- name: SETUP -> consul manager containers
|
||||||
hosts: db-consul
|
hosts: db-consul
|
||||||
remote_user: nb
|
|
||||||
vars:
|
vars:
|
||||||
- update_apt_cache: yes
|
- update_apt_cache: yes
|
||||||
- motd_role: db
|
- motd_role: db
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> elasticsearch containers
|
- name: SETUP -> elasticsearch containers
|
||||||
hosts: elasticsearch
|
hosts: elasticsearch
|
||||||
remote_user: nb
|
|
||||||
vars:
|
vars:
|
||||||
- update_apt_cache: yes
|
- update_apt_cache: yes
|
||||||
- motd_role: db
|
- motd_role: db
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> mongo containers
|
- name: SETUP -> mongo containers
|
||||||
hosts: mongo
|
hosts: mongo
|
||||||
remote_user: nb
|
|
||||||
vars:
|
vars:
|
||||||
- update_apt_cache: yes
|
- update_apt_cache: yes
|
||||||
- motd_role: db
|
- motd_role: db
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> node containers
|
- name: SETUP -> node containers
|
||||||
hosts: node
|
hosts: node
|
||||||
remote_user: nb
|
|
||||||
become: true
|
become: true
|
||||||
vars_files:
|
vars_files:
|
||||||
- env_vars/base.yml
|
- env_vars/base.yml
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> postgresql containers
|
- name: SETUP -> postgresql containers
|
||||||
hosts: postgres
|
hosts: postgres
|
||||||
remote_user: nb
|
|
||||||
become: true
|
become: true
|
||||||
vars_files:
|
vars_files:
|
||||||
- env_vars/base.yml
|
- env_vars/base.yml
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> redis containers
|
- name: SETUP -> redis containers
|
||||||
hosts: redis
|
hosts: redis
|
||||||
remote_user: nb
|
|
||||||
vars:
|
vars:
|
||||||
- update_apt_cache: yes
|
- update_apt_cache: yes
|
||||||
- motd_role: db
|
- motd_role: db
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> task containers
|
- name: SETUP -> task containers
|
||||||
hosts: task
|
hosts: task
|
||||||
remote_user: nb
|
|
||||||
vars_files:
|
vars_files:
|
||||||
- env_vars/base.yml
|
- env_vars/base.yml
|
||||||
vars:
|
vars:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> www containers
|
- name: SETUP -> www containers
|
||||||
hosts: www
|
hosts: www
|
||||||
remote_user: nb
|
|
||||||
vars:
|
vars:
|
||||||
- update_apt_cache: yes
|
- update_apt_cache: yes
|
||||||
- motd_role: app
|
- motd_role: app
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM python:3.7-slim
|
FROM python:3.9-slim
|
||||||
WORKDIR /srv/newsblur
|
WORKDIR /srv/newsblur
|
||||||
ENV PYTHONPATH=/srv/newsblur
|
ENV PYTHONPATH=/srv/newsblur
|
||||||
COPY config/requirements.txt /srv/newsblur/
|
COPY config/requirements.txt /srv/newsblur/
|
||||||
|
|
Loading…
Add table
Reference in a new issue