From 91234db53b772620e07925ed7f97f9d43d1fb7cc Mon Sep 17 00:00:00 2001 From: Felix Date: Tue, 28 Jan 2020 17:38:23 +0100 Subject: [PATCH 1/5] Fix Ansible installation, add uninstall playbook --- ansible/lemmy.yml | 15 +++++---- ansible/templates/docker-compose.yml | 35 ++++++++++++++++++++ ansible/uninstall.yml | 48 ++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 ansible/templates/docker-compose.yml create mode 100644 ansible/uninstall.yml diff --git a/ansible/lemmy.yml b/ansible/lemmy.yml index e9ad4ddd8..6ec4f916a 100644 --- a/ansible/lemmy.yml +++ b/ansible/lemmy.yml @@ -29,12 +29,15 @@ - { path: '/lemmy/' } - { path: '/lemmy/volumes/' } - - name: add all template files - template: src={{item.src}} dest={{item.dest}} - with_items: - - { src: '../docker/prod/docker-compose.yml', dest: '/lemmy/docker-compose.yml' } - - { src: 'templates/config.hjson', dest: '/lemmy/lemmy.hjson' } - - { src: 'templates/nginx.conf', dest: '/etc/nginx/sites-enabled/lemmy.conf' } + - block: + - name: add template files + template: src={{item.src}} dest={{item.dest}} mode={{item.mode}} + with_items: + - { src: 'templates/docker-compose.yml', dest: '/lemmy/docker-compose.yml', mode: '0600' } + - { src: 'templates/nginx.conf', dest: '/etc/nginx/sites-enabled/lemmy.conf', mode: '0644' } + + - name: add config file (only during initial setup) + template: src='templates/config.hjson' dest='/lemmy/lemmy.hjson' mode='0600' force='no' owner='1000' group='1000' vars: postgres_password: "{{ lookup('password', 'passwords/{{ inventory_hostname }}/postgres chars=ascii_letters,digits') }}" jwt_password: "{{ lookup('password', 'passwords/{{ inventory_hostname }}/jwt chars=ascii_letters,digits') }}" diff --git a/ansible/templates/docker-compose.yml b/ansible/templates/docker-compose.yml new file mode 100644 index 000000000..96489c70d --- /dev/null +++ b/ansible/templates/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3.3' + +services: + lemmy: + image: dessalines/lemmy:v0.6.5 + ports: + - "127.0.0.1:8536:8536" + restart: always + volumes: + - ./lemmy.hjson:/config/config.hjson:ro + depends_on: + - lemmy_db + - lemmy_pictshare + + lemmy_db: + image: postgres:12-alpine + environment: + - POSTGRES_USER=lemmy + - POSTGRES_PASSWORD={{ postgres_password }} + - POSTGRES_DB=lemmy + volumes: + - lemmy_db:/var/lib/postgresql/data + restart: always + + lemmy_pictshare: + image: shtripok/pictshare:latest + ports: + - "127.0.0.1:8537:80" + volumes: + - lemmy_pictshare:/usr/share/nginx/html/data + restart: always + +volumes: + lemmy_db: + lemmy_pictshare: diff --git a/ansible/uninstall.yml b/ansible/uninstall.yml new file mode 100644 index 000000000..252c5bd1f --- /dev/null +++ b/ansible/uninstall.yml @@ -0,0 +1,48 @@ +--- +- hosts: all + + vars_prompt: + + - name: confirm_uninstall + prompt: "Do you really want to uninstall Lemmy? This will delete all data and can not be reverted [yes/no]" + private: no + + - name: delete_certs + prompt: "Delete certificates? Select 'no' if you want to reinstall Lemmy [yes/no]" + private: no + + tasks: + - name: end play if no confirmation was given + debug: + msg: "Uninstall cancelled, doing nothing" + when: not confirm_uninstall|bool + + - meta: end_play + when: not confirm_uninstall|bool + + - name: stop docker-compose + docker_compose: + project_src: /lemmy/ + state: absent + + - name: delete data + file: path={{item.path}} state=absent + with_items: + - { path: '/lemmy/' } + - { path: '/etc/nginx/sites-enabled/lemmy.conf' } + + - name: Remove a volume + docker_volume: name={{item.name}} state=absent + with_items: + - { name: 'lemmy_lemmy_db' } + - { name: 'lemmy_lemmy_pictshare' } + + - name: delete entire ecloud folder + file: path='/mnt/repo-base/' state=absent + when: delete_certs|bool + + - name: remove certbot cronjob + cron: + name=certbot-renew-lemmy + state=absent + From 26468ffce4dda4e006ee6fd27182048710a5129e Mon Sep 17 00:00:00 2001 From: Richie Zhang <12566991+StaticallyTypedRice@users.noreply.github.com> Date: Thu, 30 Jan 2020 16:07:01 -0800 Subject: [PATCH 2/5] Remove empty div tag containing the navbar. In preliminary, the appearance and behavior of the navbar was not affected when the `