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.