Forem Creators and Builders 🌱

Cover image for Forem Google Cloud Setup on MacOS

Forem Google Cloud Setup on MacOS

Christina Gorton on July 20, 2021

Introduction In this guide you will learn how to set up your Forem self-host instance on Google Cloud. You will also set up DNS for you...
Collapse
 
coffeecraftcode profile image
Christina Gorton

This may be our fault and I would like to test that theory.
Could you run

ansible-galaxy collection install -r requirements.yml
Enter fullscreen mode Exit fullscreen mode

in your terminal and then try:

ansible-playbook -i inventory/forem/setup.yml playbooks/providers/gcp.yml
Enter fullscreen mode Exit fullscreen mode

Let me know what happens after you do that!

Collapse
 
davidmimay profile image
david mimay

Hello! Im trying to install Forem in a e2-micro with 30 gb disk size. I followed the entire guides and i'm stuck at provisioning the playbook, running ansible-playbook -i inventory/forem/setup.yml playbooks/providers/gcp.yml
get me this error:

TASK [Create a FCOS disk] ******************************************************
fatal: [forem]: FAILED! => changed=false 
  msg: Please install the requests library
Enter fullscreen mode Exit fullscreen mode

Is that because I didn't use the recommended size of 100 gb or there is something more i'm missing? (I installed ruby on rails and also libyaml but didn't work) .Thanks in advance :)

Collapse
 
ellativity profile image
Ella (she/her/elle)

Hey @davidmimay

I asked our team who built the playbook and they're suspecting this error is from a missing python dependency (requests) on the local machine you're running the provisioning from rather than a problem with the target machine. Did you run the semi-automated or Manual installation?

If Manual, what happened when you followed the instruction to Install Python dependencies System-wide: pip3 install -r requirements.txt?

Additionally, GCP Setup Step 2 mentions the pip3 modules that need to be installed, which includes requests: github.com/forem/selfhost#setup-2 - did you do this successfully without errors as well?

Thanks for any additional info you can provide us with to help figure out why you're getting this error message!

Collapse
 
davidmimay profile image
david mimay

Thanks for helping me out!

Yes, I run the semi-automated and also the manual installation just to be sure:
pip3 install -r requirements.txt
gave me: Requirement already satisfied:...

The GCP Setup Step 2 was successfull:
ansible-galaxy collection install google.cloud and also
ansible-galaxy collection install -r requirements.yml
gave me: Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using --force.

Solved: It was my fault, my issue was in inventory/forem/setup.yml i've been using ansible_python_interpreter: /usr/bin/python3 , but as the side node says # on macOS, this may need to be /usr/local/bin/python3 (im on macOS Catalina 10.15.3), it works when I changed to /usr/local/bin/python3.

Running again: ansible-playbook -i inventory/forem/setup.yml playbooks/providers/gcp.yml
gave me:

TASK [Create a FCOS disk] ******************************************************
fatal: [forem]: FAILED! => changed=false 
  msg: 'GCP returned error: {''error'': {''code'': 403, ''message'': ''Compute Engine API has not been used in project ******** before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=***** then retry. …
Enter fullscreen mode Exit fullscreen mode

And just following the url and clicking enable on the API made it works.
forem.dev/remoteimages/uploads/art...

Collapse
 
davidmimay profile image
david mimay

Just in case somebody get the same error.
Using the command ansible-galaxy collection install google.cloud I just get through this error:

error when getting available versions of collection google.cloud: Unknown error
when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen
error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get
local issuer certificate (_ssl.c:1123)>
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)>
Enter fullscreen mode Exit fullscreen mode

Solved: If you're using macOS go to Macintosh HD > Applications > Python3.6 folder (or whatever version of python you're using) > double click on "Install Certificates.command" file.

Collapse
 
coffeecraftcode profile image
Christina Gorton

Thank you for adding a solution to the error you found here!

Collapse
 
coffeecraftcode profile image
Christina Gorton • Edited

Ok, from the error it looks like your permissions in Google Cloud may have not been set up correctly.
cloud.google.com/compute/docs/acce...

Did you:
" Create a Google Cloud Service Account called forem-selfhost with Compute Instance Admin (v1) privileges and download a JSON credentials file and place it in ~/.gcp/forem.json"

If not and you need more help you can check the "Google Cloud Service Account" and "Adding Privileges" section of this guide.

 
coffeecraftcode profile image
Christina Gorton

Odd.
Do you have the file playbooks/providers/gcp.yml in your code?
Should be in the playbooks/providers folder.

I'm signing off for the day but will drop this in our internal slack channel to see if anyone else can help debug.
If not, I will circle back tomorrow and make sure we get you some help on this!

Thread Thread
 
jdoss profile image
Joe Doss

What is your current working directory? You need to run all commands out of the selfhost directory.

Collapse
 
coffeecraftcode profile image
Christina Gorton

Hey! Taking a look now.

 
jdoss profile image
Joe Doss

Great! Glad we got ya sorted here. :)

Collapse
 
davidmimay profile image
david mimay

Did you change the gcp.yml with your Google Cloud Project ID? forem-selffhost-ID and not the default 12345.