Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Externalize pict-rs configuration, start centralizing configuration variables #160

Merged
merged 15 commits into from Sep 11, 2023
Merged

Externalize pict-rs configuration, start centralizing configuration variables #160

merged 15 commits into from Sep 11, 2023

Conversation

codyro
Copy link
Collaborator

@codyro codyro commented Sep 2, 2023

This PR was primarily looking to resolve #53 & #109. However, I ran across some things that required adjusting (which will benefit us when we tidy up everything a bit more!).

Special thanks to @mpraeger for the inspiration. I've added you as a co-author on the initial commit as I re-used some of your code & idea's.

Primary Changes

  • Remove the environmental variables defined in the docker-compose.yml template for pict-rs and move them to a vars.yml file which is used to configure & maintain variables in a sane spot (instead of them floating around in the playbook) a8c859d

  • Move postgres_password variable to vars.yml instead of being defined in lemmy.yml and lemmy-almalinux.yml. This exposes it to users in case they have an existing database they would like to use or if they’d prefer to set it manually (it also helps clean up the playbooks by centralizing the configuration variables)

    • Rename the generated inventory/host_vars/<fqdn>/passwords/postgres to inventory/host_vars/<fqdn>/passwords/postgres.psk. The reason for this change is we’re currently not using the host_vars path entirely correctly, so it’s attempting to parse the password file as a variable file and will puke due to an invalid syntax. By default, Ansible will read in inventory/host_vars/<fqdn>/{*.yml,*.yaml,*.ini,exec_file} files.
  • Adjust the example inventory (examples/hosts) to use a better format. Instead of using user@server.com, we opt to use the ansible_user=user to avoid unpredictable variable loading. Using the above examples, if you have user@server.com in your inventory, Ansible will look for variables in inventory/host_vars/user@server.com directory instead of the expected inventory/host_vars/server.com directory.

Tested against:

  • AlmaLinux 9/RHEL 9
  • Debian 10 (UNTESTED, should work)
  • Debian 11
  • Debian 12
  • Ubuntu 22.04 LTS

Could someone verify at least one or more of the target distributions above? I didn't have time to test pict-rs with S3, but I can confirm the environmental variables get populated and injected into the VM properly. We should try this to ensure there is no funny business when using S3 for object storage.

- Internal/external nginx were sending duplicate headers, removed from internal
- Opted X-Frame-Options DENY as default
- Fixes #143
- Present/enabled in nginx.conf template
- Refs #109
- Co-authored by:  Maximilian Praeger
- Rename pictrs.yml to vars.yml
- Start moving some variables to vars.yml for easier management and
discoverability
- Causes issues with how Ansible resolves variables
- `server.com` != `root@server.com`, host_vars/server.com vs. host_vars/root@server.com
@codyro codyro requested a review from Nutomic September 4, 2023 18:34
Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks a ton!

examples/vars.yml Show resolved Hide resolved
examples/vars.yml Show resolved Hide resolved
examples/vars.yml Show resolved Hide resolved
examples/hosts Show resolved Hide resolved
lemmy.yml Show resolved Hide resolved
@codyro codyro dismissed ticoombs’s stale review September 11, 2023 00:40

Marked as resolved, won't allow merge. Semantic changes need another issue (beyond scope of this PR)

@codyro codyro merged commit aae213e into LemmyNet:main Sep 11, 2023
1 check passed
@codyro codyro linked an issue Sep 11, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to externalize pictrs configuration with ansible? Add PICTRS__API_KEY Add LEMMY_UI_CUSTOM_SCRIPT
4 participants