Include more details and examples.

This commit is contained in:
Brian Lee 2023-07-29 17:33:15 -07:00
parent ccb50b1ac2
commit 30454e79f1
2 changed files with 63 additions and 13 deletions

View File

@ -1,11 +1,6 @@
# Ansible Role: strfry # Ansible Role: strfry
This Ansible Role builds and installs [strfry](https://github.com/hoytech/strfry). This Ansible Role builds and installs [strfry](https://github.com/hoytech/strfry). It is intended to be composed with a separate role to handle the web proxy configuration.
Future role improvements:
* The git tasks in this role are not yet idempotent due to handling a submodule.
* The installation process could be made to check if strfry is already running and perform a zero-downtime upgrade.
## Requirements ## Requirements
@ -16,20 +11,24 @@ None.
```yaml ```yaml
strfry_version: beta # git repository branch or release tag strfry_version: beta # git repository branch or release tag
strfry_make_jobs: "{{ ansible_processor_cores }}" # number of CPUs to build with strfry_make_jobs: "{{ ansible_processor_cores }}" # number of CPUs to build with
strfry_skip_config: False strfry_skip_config: no
``` ```
See `defaults/main.yml` See the role [defaults](defaults/main.yml).
If you are not using the `beta` branch/version, you should override the template with your own by setting `strfry_skip_config` to true and manage the configuration manually. If you are not using the `beta` branch/version, you should override the template with your own by enabling `strfry_skip_config` and managing the configuration manually.
```yaml
strfry_skip_config: yes
```
For more configuration info, see the relevant upstream [configuration example](https://github.com/hoytech/strfry/blob/beta/strfry.conf) for your branch/version. For more configuration info, see the relevant upstream [configuration example](https://github.com/hoytech/strfry/blob/beta/strfry.conf) for your branch/version.
## Example Playbook ## Example Playbook
```yaml ```yaml
- hosts: all - hosts: strfry
become: true become: yes
roles: roles:
- role: bleetube.strfry - role: bleetube.strfry
- role: nginxinc.nginx_core.nginx - role: nginxinc.nginx_core.nginx
@ -37,10 +36,20 @@ For more configuration info, see the relevant upstream [configuration example](h
- import_tasks: nginx_conf.yml - import_tasks: nginx_conf.yml
``` ```
## Troubleshooting A sample [nginx configuration](docs/examples/nginx_conf.yml) is provided.
If `make` fails, try running on a single core: For a fully functional production example that includes hosting multiple relays, see this [homelab stack](https://github.com/bleetube/satstack).
## Troubleshooting
If `make` fails, try building on a single core:
```shell ```shell
ansible-playbook playbooks/strfry/main.yml -e 'strfry_make_jobs=1' ansible-playbook playbooks/strfry/main.yml -e 'strfry_make_jobs=1'
``` ```
Logs
```shell
systemctl status strfry
journalctl -fu strfry
```

View File

@ -0,0 +1,41 @@
---
- name: strfry | Configure nginx
ansible.builtin.import_role:
name: nginxinc.nginx_core.nginx_config
vars:
nginx_config_http_template_enable: true
nginx_config_http_template:
- template_file: http/default.conf.j2
deployment_location: "/etc/nginx/conf.d/strfry_{{ nginx_strfry_domain }}.conf"
backup: false
config:
upstreams:
- name: strfry
servers:
- address: "127.0.0.1:{{ strfry_relay.port|default(7777) }}"
#- address: unix:/var/lib/strfry/strfry.sock
servers:
- core:
listen:
- address: "{{ default_interface_ipv4_address|default(ansible_default_ipv4.address) }}:{{ nginx_strfry_https_port|default(443) }} ssl"
include:
- "/etc/nginx/acme_{{ nginx_strfry_domain }}.conf"
- /etc/nginx/enable_http2.conf
client_max_body_size: 0 # Stream request body to backend
locations:
- location: /
proxy:
pass: http://strfry
http_version: '1.1'
set_header:
- field: Host
value: $http_host
- field: Connection
value: $connection_upgrade
- field: Upgrade
value: $http_upgrade
- field: X-Forwarded-For
value: $proxy_add_x_forwarded_for
connect_timeout: 3m
send_timeout: 3m
read_timeout: 3m