forem / selfhost

Selfhost your Forem Community on your own infrastructure 🎉
https://www.forem.com/get-started/
GNU Affero General Public License v3.0
1.43k stars 169 forks source link

Add setup script #44

Closed citizen428 closed 2 years ago

citizen428 commented 2 years ago

While going through the selfhost setup process myself, I noticed a few things that can be automated. This PR adds a script that does the following:

  1. Verify pip is available (either as pip3 or pip, now that Python 2 is EOL not everyone uses pip3 explicitly). image If it's not, an error will be shown and the script terminates. image
  2. Install all Python dependencies. image
  3. Create an Ansible Vault password (stored in ~/.forem_selfhost_ansible_vault_password) image
  4. Copy the example inventory from inventory/example/setup.yml to inventory/forem/setup.yml image
  5. Generate the 4 necessary Vault secrets (screenshot abbreviated) image
  6. Inform the user about adding the Vault secrets to inventory/forem/setup.yml and activating pipenv in their shell via pipenv shell before they continue. image

There's definitely a bit more we could do (e.g. generating the SSH key) but I was at a good stopping point for opening a draft PR.

citizen428 commented 2 years ago

The Vault secret and inventory example copy steps are now idempotent:

image

citizen428 commented 2 years ago

OK, I think it now made all the changes requested as well as the ones that came up during the discussions. I also updated the README so I'll take this PR out of draft now.

jdoss commented 2 years ago

I think this is good to merge @citizen428. Thanks for your hard work here!