Introduction
In this guide you will learn how to set up your Forem self-host instance on DigitalOcean.
You will also set up DNS for your domain and restart Forem Traefik service to generate a TLS cert.
Prerequisites
- Forem Requirements guide
- Quick Start in Depth guide.
- A DigitalOcean Account
Step 1- Installing DigitalOcean Ansible Collection
In this step you will install the necessary collection for DigitalOcean.
In your terminal make sure you are in the selfhost directory with:
cd selfhost
Install the DigitalOcean Ansible collection with:
ansible-galaxy collection install community.digitalocean
Alternatively you can install all the cloud provider collections with:
ansible-galaxy collection install -r requirements.yml
This is useful if you want to try other cloud providers.
Step 2- Installing doctl
In this step you will install DigitalOcean's CLI doctl
to set up preset variables.
You can install doctl
with Homebrew.
In your terminal type
brew install doctl
Step 3- Generating a DigitalOcean Auth Token
In this step you will generate an Auth Token in DigitalOceanβs Control Panel.
Log in to the DigitalOcean Control Panel. If you see a Welcome page click the Explore our control panel
link
Click the API
link in the main navigation to go to the Applications & API page.
In the Tokens/Keys tab click the Generate New Token
button.
Enter a name for your Token.
Check the Write
box then click the Generate Token
button.
Save your generated token.
In your terminal run
doctl auth init
and pass in the API token you generated.
If you have set it up correctly you should see the following message in your terminal:
Validating token... OK
Note: If you have an old API token set up for DigitalOcean already you can update it with the following command:
doctl auth init --access-token <your-new-key>
Verify that you can authenticate to the DigitalOCean API with the following command:
doctl account get
Step 4- Provisioning the Playbook
In this step you will provision the DigitalOcean provider playbook to set up your Forem.
In your terminal type:
ansible-playbook -i inventory/forem/setup.yml playbooks/providers/digitalocean.yml
Once you run the command, you should see an output in your terminal similar to the code below with your community's domain name and IP address.
ok: [forem] =>
msg:
- The public IPv4 IP Address for www.creativecommunity.club is 54.221.141.133
- Please add an A entry for www.creativecommunity.club that points to 54.221.141.133
- 'Example:'
- ' www.creativecommunity.club IN A 54.221.141.133'
- 'Once you have DNS resolving to this EC2 instance please read the Forem Admin Docs: https://forem-admin.netlify.app/'
Note: DigitalOcean does not have support for Fedora CoreOS. We have to upload a custom image to your account via Ansible. If the
"Wait for fcos-{{ fcos_download_release }}
to be created" task times out. please check the Custom Images section on your DigitalOcean account to see if your image is still in a pending state. Wait for it to finish processing and re-run the DigitalOcean provider playbook.
Now you can set up an A record
and point it to your public IPv4 IP Address
Step 5- Setting up DNS
In this step you will see an example of creating an A record in NameCheap and pointing it to the IP address that was outputted in the previous step. If you are not using NameCheap please refer to your own domain provider for how to set up DNS.
In the Advanced DNS section add an A record for your domain and subdomain.
Set the value to the IP address that was outputted after provisioning.
Step 6- Restarting Forem Traefik Service
In this step you will reset Forem Traefik Service via SSH to generate a TLS cert.
In your terminal type:
ssh core@<SERVER IP ADDRESS>
replacing with your community name.
Here is an example using a community name:
If prompted to continue, type yes
into your terminal.
Once you have connected to your Forem server, type the following command:
sudo systemctl restart forem-traefik.service
Now, you can navigate to your community domain. You should see a "Let's Start your Forem Journey" page.
You may need to wait a few minutes after running the Forem Traefik command.
Conclusion
Congratulations on setting up your first Forem!π
For next steps on how to configure your Forem please visit our Forem Admin Docs
Top comments (26)
I was able to install Forem Selfhost on DigitalOcean before without any problem. However, I cannot restart forem-traefik.service for 2 days. It sticks and the ssh connection time outs. What might be the problem? Any idea?
forem.dev/remoteimages/uploads/art...
Hocam selamlar. Kurulumu hangi rehbere gΓΆre gerΓ§ekleΕtirdiniz? HazΔ±rlΔ±klarΔ± yapΔ±yorum tam kurulum aΕamasΔ±nda hatalarla boΔuΕuyorum. 7 gΓΌndΓΌr kurulum yapamadΔ±m iΕ inada bindi artΔ±k. YardΔ±mcΔ± olur musunuz?
Selamlar. Tam olarak bu rehbere gΓΆre gerΓ§ekleΕtirdim. DevamΔ±nda da yine burada linki olan DigitalOcean rehberi ile tamamladΔ±m.
KarΕΔ±laΕtΔ±ΔΔ±nΔ±z hatalarΔ± detaylΔ± bir Εekilde paylaΕabilirseniz yardΔ±mcΔ± olmaya Γ§alΔ±ΕΔ±rΔ±m. Bu hafta studyhab.com'un aΓ§Δ±lΔ±ΕΔ±nΔ± yapmaya Γ§alΔ±ΕΔ±yorum. O yΓΌzden pek mΓΌsait deΔilim ancak ΓΆnΓΌmΓΌzdeki haftaiΓ§i hatalar devam ediyor olursa kurulumunuza doΔrudan yardΔ±m edebilirim.
Bana buradan ulaΕabilirsiniz: m@ce7in.com
Hocam Γ§ok teΕekkΓΌr ederim. Kurulumu hangi OS ΓΌzerinde gerΓ§ekleΕtirdiniz onu da ΓΆΔrenebilir miyim?
AyrΔ±ca e-posta adresinizden ulaΕamadΔ±m. GΓΆnderdiΔim posta teslim edilemediΔinden geri dΓΆndΓΌ. UlaΕabileceΔim farklΔ± bir posta adresiniz var mΔ±?
Normalde ulaΕΔ±labilir olmasΔ± gerekiyordu ama... Gmail ΓΌzerinden de ulaΕabilirsiniz: cetin.muhammed@gmail.com
Thank you so much, @ce7in , for offering to help here!
Thank you so much, too. All your efforts are so valuable for community builders. And I am trying to help as much as I can do.
Windows 11 ΓΌzerinde WSL2 ile Ubuntu 20.04 kullanΔ±yorum. Kurulumu da Ubuntu ile yaptΔ±m.
Hocam bende DO ΓΌzerinde oluΕturduΔum Ubuntu sunucu ΓΌzerinden iΕlem yapΔ±yorum. Ancak sΓΌrekli ekran gΓΆrΓΌntΓΌsΓΌndeki hatayΔ± alΔ±yorum.
forem.dev/remoteimages/uploads/art...
YAML dosyasΔ±nΔ± defalarca kontrol ettim, hosts dosyasΔ±nΔ± dΓΌzenledim bu sefer de FCOS ile ilgili bir iΕlem yaparken takΔ±ldΔ± kaldΔ± kurulum.
Γnemli bilgileri gizleyerek ya da rastgele deΔiΕtirerek, Εablonu bozmadan, girinti ve Γ§Δ±kΔ±ntΔ±larΔ± bozmadan gmail adresime gΓΆnderirseniz inceleyip yardΔ±mcΔ± olmaya Γ§alΔ±ΕayΔ±m. Onlarca kez kurdum Forem'i. HiΓ§bir sorun yaΕamadΔ±m. YapΔ±landΔ±rmanΔ±zda mutlaka bir hata vardΔ±r.
I've fixed it again but I don't know what is the reason.
My solution:
After the installation has been done, I run the command "sudo foremctl deploy" before restarting forem-traefik.service. Then I restarted forem by running this: "sudo foremctl restart". Lastly, I tried to restart forem-traefik.service. That's all.
However, I have one more problem now. Even if I've added sendgrid api key and api key id as ecrypted vault keys, I cannot receive a confirmation email. What might be the problem? I've used the command below to encrypt my api key and api key id:
echo -n myApiKey | ansible-vault encrypt_string --stdin-name vault_sendgrid_api_key
Everything is OK for now. I've solved the problem. I've followed the Quick Start in Depth tutorial first, then I tried to install Forem on DO. Since I've already generated Ansible secrets, when I was trying to run ansible-playbook command, it threw the error.
After the installation has been done, I wasn't able to run
sudo systemctl restart forem-traefik.service
properly. When I was trying to run it, it stucked. However, after restarting the machine completely, I was able to run the restarting command.Whether I would face a problem or a feedback, I'll try to share it with you here.
Thanks a lot everybody.
Now, imgproxy.servide doesn't work properly. That's why I cannot show my uploaded images as you can see here: answr.to
SS: i.imgur.com/NEmQnwa.png
Thank you for sharing the problems you have encountered so far @ce7in !
Our systems team asked if you could run:
to get more logs for them so we could help debug the issue.
Here is more info on
journalctl
if you haven't used it before.digitalocean.com/community/tutoria...
i dont know why i cant run this command... plz help ansible-playbook -i inventory/forem/setup.yml playbooks/providers/digitalocean.yml
When you say you can't run it, what is the reason? Do you get an error message or does nothing happen?
Thank for replay me ! ! i trying but still dont know how to fix this, i cant upload image to this comment so i created a post for upload my error message image.. this is link forem.dev/lyhuutri/error-install-f... .. plz help, thank you !
I answered your question in your linked post. Hope this helps!
Hey @lyhuutri for a quicker response from the team here can you post screenshots of any errors you see as you go through this process? We want to help you succeed but need more information. Thanks!
Oh thank you for replay me <3, but. i cant upload image to this comment, i' ll create a new post and upload my error message( this is link forem.dev/lyhuutri/error-install-f... )! Plz help me. So many thank you
The Digital Ocean Ansible collection was installed fine but I still I am getting this error:
Anyone else having the same issue or know what may be going on here?
Upgrading pip3 and redoing all the steps solved the issue.
Is the VM backup feature offered by DO viable to have backups of an instance?
Step 4 i getting eror. how to fix this?
forem.dev/remoteimages/uploads/art...
It seems there is a typing error in setup.yml file. The error message says that the host pattern is invalid. Please check if your setup.yml file is appropriate.