V0.17.0 changes 2 (#60)

* Upgrade for v0.17.0 changes. Better docker install.

* Fix LEMMY_UI env vars.

* Remove postgres optimizations.

* Adding a custom postgresql.conf file

* Updating VERSION
This commit is contained in:
Dessalines 2023-01-31 12:22:20 -05:00 committed by GitHub
parent d9ce528278
commit cd8bcea976
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 95 additions and 17 deletions

View file

@ -13,14 +13,14 @@ To run this ansible playbook, you need to:
## Install
Clone this repo:
Clone this repo:
```
git clone https://github.com/LemmyNet/lemmy-ansible.git
cd lemmy-ansible
```
Make a directory to hold your config:
Make a directory to hold your config:
`mkdir -p inventory/host_vars/<your-domain>`
@ -38,15 +38,21 @@ Copy the sample inventory hosts file:
Edit the inventory hosts file (inventory/hosts) to your liking.
Run the playbook:
Copy the sample postgresql.conf
`cp examples/customPostgresql.conf inventory/customPostgresql.conf`
You can use [the PGTune tool](https://pgtune.leopard.in.ua) to tune your postgres to meet your server memory and CPU.
Run the playbook:
`ansible-playbook -i inventory/hosts lemmy.yml`
*Note*: if you are not the root user or don't have password-less sudo, use this command:
_Note_: if you are not the root user or don't have password-less sudo, use this command:
`ansible-playbook -i inventory/hosts lemmy.yml --become --ask-become-pass`
*Note*: if you haven't set up ssh keys, and ssh using a password, use the command:
_Note_: if you haven't set up ssh keys, and ssh using a password, use the command:
`ansible-playbook -i inventory/hosts lemmy.yml --become --ask-pass --ask-become-pass`
@ -59,7 +65,7 @@ If the command above fails, you may need to comment out this line In the ansible
## Upgrading
- Run `git pull`
- Check out the [Lemmy Releases Changelog](https://github.com/LemmyNet/lemmy/blob/main/RELEASES.md) to see if there are any config changes with the releases since your last.
- Check out the [Lemmy Releases Changelog](https://github.com/LemmyNet/lemmy/blob/main/RELEASES.md) to see if there are any config changes with the releases since your last.
- Run `ansible-playbook -i inventory/hosts lemmy.yml --become`
## Migrating your existing install to use this deploy

View file

@ -1 +1 @@
0.16.7
0.17.0

View file

@ -7,9 +7,9 @@
password: "{{ postgres_password }}"
}
hostname: "{{ domain }}"
pictrs_url: "http://pictrs:8080"
federation: {
enabled: true
pictrs: {
url: "http://pictrs:8080/"
api_key: "{{ postgres_password }}"
}
email: {
smtp_server: "postfix:25"

View file

@ -0,0 +1,23 @@
# DB Version: 15
# OS Type: linux
# DB Type: web
# Total Memory (RAM): 8 GB
# CPUs num: 4
# Data Storage: ssd
max_connections = 200
shared_buffers = 2GB
effective_cache_size = 6GB
maintenance_work_mem = 512MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 5242kB
min_wal_size = 1GB
max_wal_size = 4GB
max_worker_processes = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
max_parallel_maintenance_workers = 2

View file

@ -21,15 +21,54 @@
- setup: # gather facts
tasks:
- name: Install aptitude
apt:
name: aptitude
state: latest
update_cache: true
- name: install dependencies
apt:
update_cache: yes
state: latest
update_cache: true
pkg:
- 'nginx'
- 'docker-compose'
- 'docker.io'
- 'certbot'
- 'python3-certbot-nginx'
- 'apt-transport-https'
- 'ca-certificates'
- 'curl'
- 'software-properties-common'
- 'python3-pip'
- 'virtualenv'
- 'python3-setuptools'
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Update apt and install docker-ce
apt:
name: docker-ce
state: latest
update_cache: true
- name: Install Docker Module for Python
pip:
name: docker
- name: Install or upgrade docker-compose
get_url:
url : "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-Linux-x86_64"
dest: /usr/local/bin/docker-compose
mode: 'a+x'
force: yes
- name: copy docker config
copy: src='../files/docker-daemon.json' dest='/etc/docker/daemon.json' mode='0644'
@ -99,6 +138,15 @@
mode: '0600'
owner: '1000'
group: '1000'
- name: add the customPostgresql.conf
template:
src: 'inventory/host_vars/{{domain}}/customPostgresql.conf'
dest: '{{lemmy_base_dir}}/{{domain}}/customPostgresql.conf'
mode: '0600'
owner: '1000'
group: '1000'
vars:
postgres_password: "{{ lookup('password', 'inventory/host_vars/{{domain}}/passwords/postgres chars=ascii_letters,digits') }}"

View file

@ -20,22 +20,23 @@ services:
- "127.0.0.1:{{ lemmy_ui_port }}:1234"
restart: always
environment:
- LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_EXTERNAL_HOST={{ domain }}
- LEMMY_HTTPS=true
- LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_UI_LEMMY_EXTERNAL_HOST={{ domain }}
- LEMMY_UI_HTTPS=true
volumes:
- ./volumes/lemmy-ui/extra_themes:/app/extra_themes
depends_on:
- lemmy
postgres:
image: postgres:12-alpine
image: postgres:15-alpine
environment:
- POSTGRES_USER=lemmy
- POSTGRES_PASSWORD={{ postgres_password }}
- POSTGRES_DB=lemmy
volumes:
- ./volumes/postgres:/var/lib/postgresql/data
- ./customPostgresql.conf:/etc/postgresql.conf
restart: always
pictrs: