Forem Creators and Builders

loading...
Cover image for Forem DigitalOcean Setup on MacOS
Forem Core Team

Forem DigitalOcean Setup on MacOS

Christina Gorton
Developer Advocate, Technical Writer, and Instructor.
Updated on ・3 min read

Before starting this tutorial please go through the Quick Start in Depth guide.

This is a walkthrough of how to use DigitalOcean as your cloud provider for Forem selfhost.

To set up a Forem on DigitalOcean you must first create an account. Navigate to the
DigitalOcean homepage and fill in the appropriate information to create your account.

Install Requirements

  1. In your terminal make sure you are in the selfhost directory with: cd selfhost
  2. Install the DigitalOcean Ansible collection with: ansible-galaxy collection install community.digitalocean or install all collections with: ansible-galaxy collection install -r requirements.yml

Install doctl

The DigitalOcean provisioning target has a few preset variables you will set up further down in the instructions with DigitalOcean's CLI doctl. First you will need to install doctl.

  1. On MacOS you can install doctl with the following command: brew install doctl

Create DigitalOcean Auth Token

  1. Log in to the DigitalOcean Control Panel. If you see a Welcome page click the Explore our control panel link
    DigitalOcean Control Panel

  2. Click the API link in the main navigation to go to the Applications & API page.
    Go to Applications & API page

  3. In the Tokens/Keys tab click the Generate New Token button
    Click Generate New Token button

  4. Enter a name for your Token, check the Write box, and click the Generate Token button.
    generate token

  5. Save your generated token. It will be used when we configure the preset variables for the DigitalOcean provisioning target.

DigitalOcean Provisioning Target

  1. In your terminal run doctl auth init and pass in the API token you created. If you have set it up correctly you should see the followin gmessage 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>

2.) Verify that you can authenticate to the DigitalOCean API with the following command:
doctl account get

Provision

Run the DigitalOcean provider playbook to set up your Forem

  1. In your terminal type: ansible-playbook -i inventory/forem/setup.yml playbooks/providers/digitalocean.yml
  2. 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/>'

Enter fullscreen mode Exit fullscreen mode

DNS

  1. You will need to create an A record and point DNS at the IP address that is output at the end of the provider playbook.

You can see an example of how I set an A record for my namecheap domain below:

In Advanced DNS I added an A record for my domain and subdomain and set the value to the IP address that was outputted after provisioning. I also set TTL to 1minute.
This will defer depending on where your DNS is hosted.
Advanced DNS in namecheap.com

Forem Traefik Service

Once DNS is pointed at your Forem VM, you will need to restart the Forem Traefik service.

  1. You will need to run the command via SSH. In your terminal type:
    ssh core@<SERVER IP ADDRESS> replacing with your community name. In the example below I am using my community:
    ssh core@ example

  2. You may be prompted to continue. Type yes in to your terminal.

  3. Once you have connected to your Forem server, type the following command:
    sudo systemctl restart forem-traefik.service
    systemctl restart command in terminal

  4. Now, you can navigate to your community domain.and 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.
    Let's Start your Forem Journey page

Congratulations on setting up your first Forem!🎉

For more details on how to configure your Forem please visit our Forem Admin Docs

Discussion (8)

Collapse
ce7in profile image
Muhammed Cetin • Edited

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.

Collapse
ce7in profile image
Muhammed Cetin

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

Collapse
coffeecraftcode profile image
Christina Gorton Author

Thank you for sharing the problems you have encountered so far @ce7in !
Our systems team asked if you could run:

sudo journalctl -u forem-imgproxy.service -n 200 --no-pager
Enter fullscreen mode Exit fullscreen mode

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...

Collapse
supernova profile image
Prdpt

The Digital Ocean Ansible collection was installed fine but I still I am getting this error:

fatal: [forem]: FAILED! => changed=false 
  assertion: false
  evaluated_to: false
  msg: 'You are missing some of the required Python 3 packages: [''ansible'', ''boto'', ''boto3'', ''botocore'', ''google-auth'', ''jmespath'', ''netaddr'', ''requests''] Run pip3 install -r requirements.txt'
Enter fullscreen mode Exit fullscreen mode

Anyone else having the same issue or know what may be going on here?

Collapse
supernova profile image
Prdpt

Upgrading pip3 and redoing all the steps solved the issue.

Collapse
ce7in profile image
Muhammed Cetin • Edited

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...

Collapse
ce7in profile image
Muhammed Cetin

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

Collapse
kristoff profile image
Loris Cro

Is the VM backup feature offered by DO viable to have backups of an instance?