GithubHelp home page GithubHelp logo

forem / selfhost Goto Github PK

View Code? Open in Web Editor NEW
1.4K 44.0 169.0 123 KB

Selfhost your Forem Community on your own infrastructure ๐ŸŽ‰

Home Page: https://www.forem.com/get-started/

License: GNU Affero General Public License v3.0

Jinja 94.69% Shell 5.31%
forem ansible fcos butane ignition

selfhost's Introduction

Forem Self-Host

This is a repo for setting up a free, self-managed install of Forem on a Fedora CoreOS VM running on one of a few popular cloud providers (current support for DigitalOcean, AWS, and Google Cloud). Local development is also supported using a VM on Linux via QEMU.

Please note that Forem is a complex piece of software, and hosting and managing it in a cloud environment is non-trivial. While the recipes and scripts here are expected to work for the limited scenarios we tested against, use and modification of the recipes, or altering the deployed environment, may require familiarity with the following layers of the tech stack we built with, and ongoing maintenance of the deployed system may require interacting with any of these technologies:

If a Self-Hosted Forem is not right for you, we offer a fully-managed, enterprise solution called Forem Cloud; no technical setup required. For more information, please contact us via this form.

For those that want to DIY beyond the scope of this repo, you can use the systemd units in the Butane template as an example of how to run Forem without Fedora CoreOS on a Linux distribution that supports systemd, or customize that template to fit your needs or create a bootable Ignition configuration to consume on bare metal or in a custom VM.

The goal of this project is to provide you with the choice, freedom, and cost-effectiveness to host your own Forem community as you see fit.

We can't wait to see the community you selfhost with Forem!

Table of Contents

Requirements

  • Git
  • Python 3.x and pip3
    • macOS: brew install python3

    Note: This will likely use Python 3 at /usr/local/bin/python3, not /usr/bin/python3, requiring that you set ansible_python_interpreter to /usr/local/bin/python in inventory or via extra vars (eg -e ansible_python_interpreter=/usr/local/bin/python)

  • Ansible: ansible-core 2.11 or greater (provided by Ansible 4.0.0)
  • Butane
    • Mac OS: brew install butane
  • pwgen
    • Mac OS: brew install pwgen
  • Fedora CoreOS, running on the Stable stream
  • A supported cloud provider, bare metal server, or a VM in QEMU.

Note: Some provisioning targets have additional requirements that are detailed out in each respective section.

Quick Start

Note: Following this quick start guide with the cloud provider of your choice will cost you money! Please consult with each cloud provider to figure out how much your Forem will cost you per month.

Start by cloning the forem/selfhost repository to your local computer and change into the newly created directory:

git clone https://github.com/forem/selfhost.git
cd selfhost

After this step you have two choices: a semi-automated setup via a script or a completely manual installation.

Semi-automated setup

We have a script in place that will perform several of the necessary setup tasks for you. It will take care of the first 3 steps of the manual installation process (installing Python dependencies, generating an Ansible Vault password and copying the inventory definition for you). It will also generate the secrets needed for step 4.

./setup

Verifying that pip is available

Installing Python dependencies
[output omitted]

Generating Ansible Vault secret
ixooGe3ob0shob8soo6AhYie

Copying example inventory
'inventory/example/setup.yml' -> 'inventory/forem/setup.yml'

Generating Vault secrets
[output omitted]

Use these secrets to replace the placeholders in inventory/forem/setup.yml

Once the script finished running, continue from step 4. of the manual installation process described below.

Manual installation

  1. Install Python dependencies:
    • System-wide:
      • pip3 install -r requirements.txt
    • In a virtual environment: create a virtual env first, then enter it before installing the dependencies. Then remain in the virtual env unless you're done with the setup process. Example with Python 3's native venv module:
      • python3 -m venv /path/to/new/virtual/environment
      • source <venv>/bin/activate
      • pip3 install -r requirements.txt
      • perform rest of setup
      • deactivate (leaves the virtual env)
  2. Generate an Ansible Vault password
    • mkdir -p ~/.config/forem
    • pwgen -1 24|tee ~/.config/forem/selfhost_ansible_vault_password
  3. Copy example Ansible Inventory from inventory/example/setup.yml to inventory/forem/setup.yml
  4. Edit inventory/forem/setup.yml Ansible Inventory with your Forem settings
    • Edit the following Ansible inventory variables:
      • default_email (Admin Email for system to use)
      • forem_domain_name (A domain name that you own and set A records on at your DNS provider)
      • forem_subdomain_name (defaults to www)
      • forem_server_hostname (defaults to host)
    • If you used the setup script you can use the previously generated inventory secrets here. Otherwise, you have to use ansible-vault encrypt_string to create the secrets listed below. See "Required Ansible Vault secret variables" in the example setup.yml, which contains the required commands to generate each variable's value:
      • vault_secret_key_base
      • vault_imgproxy_key
      • vault_imgproxy_salt
      • vault_forem_postgres_password
  5. Setup SSH access for your cloud provider
    • If you choose to use DigitalOcean or Google Cloud as your cloud provider, you will need to generate a SSH key and save it to ${HOME}/.ssh/forem. Use ls -lh ~/.ssh/forem* to ensure you have both a ${HOME}/.ssh/forem private key, and a corresponding ${HOME}/.ssh/forem.pub public key.
    • If you use AWS as your cloud provider, you will need to generate an RSA-based SSH key and save it to the file path ~/.ssh/id_rsa.pub. Please visit the AWS RSA based SSH key section in our Self Host: Quick Start in Depth guide for instructions on creating an RSA-based key.
  6. Pick a supported cloud provider and set it up on your workstation
  7. Run the Ansible Playbook for your chosen cloud provider
  8. Once your Forem VM is set up with your chosen cloud provider, you will need to point DNS at the IP address that is output at the end of the provider playbook.
  9. Once DNS is pointed at your Forem VM, you will need to restart the Forem Traefik service (sudo systemctl restart forem-traefik.service) via SSH on your Forem server to generate a TLS cert.
  10. Go to your Forem domain name and create your first account. Please see the Forem Admin documentation located here for more information on setting up your Forem.

Provisioning Targets

Note about recommended instance types and cost: for each hosted provisioning target below, we attempted to recommend an instance type with 2 CPUs, 2GB of RAM, and a monthly cost of around $15 USD. Please note that providers may charge additionally for disk space, network usage, etc, so your price per month may vary based on your Forem's usage and needs. For exact and specific pricing information, please see each provider directly.


AWS

The AWS provisioning target has a few preset variables that can be either edited in the playbook or passed along as Ansible extra vars on the CLI.

fcos_aws_region: us-east-1
fcos_aws_size: t3a.small
fcos_aws_ebs_size: 100
ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
  • fcos_aws_region: the AWS region that is used to setup your Forem server. The default region is in us-east-1 which is in North Virginia, USA
  • fcos_aws_size: the AWS EC2 instance type. A recommended type is a t3a.small EC2 instance, with 2 VCPUs and 2GB of RAM
  • fcos_aws_ebs_size: the amount of EBS disk space (in GB)
  • ssh_key: the path to a public SSH key. Note that AWS's EC2 service can only use RSA based SSH keys. If you get an error that your SSH key is not the right type, please generate an RSA based SSH key and set ssh_key with a lookup path to that key

Setup

  1. Install the Ansible Amazon AWS collections ansible-galaxy collection install amazon.aws community.aws or install them via ansible-galaxy collection install -r requirements.yml
  2. Download and install the AWS CLI version 2 tool
  3. Install boto, boto3, and botocore pip3 modules pip3 install boto boto3 botocore or run pip3 install -r requirements.txt
  4. Create an AWS IAM user with Programmatic access called forem-selfhost with the following AmazonEC2FullAccess, AmazonS3FullAccess, AmazonVPCFullAccess AWS managed policies attached. Be sure to save the Access key ID and Secret access key to use in step 5.
  5. Run aws configure --profile forem-selfhost and input the access key ID and secret key when prompted. We use us-east-1 for default region name but you can choose a different one if you wish. Set default output format to json

Provision

  1. Run the AWS provider playbook to setup your Forem
    • ansible-playbook -i inventory/forem/setup.yml playbooks/providers/aws.yml

DigitalOcean

The DigitalOcean provisioning target has a few preset variables that can be either edited in the playbook or pass along as Ansible extra vars on the CLI.

forem_do_region: nyc3
forem_do_size: s-2vcpu-2gb
  • forem_do_region: the DigitalOcean region that is used to setup your Forem server. The default region is nyc3 which is in New York City, New York, USA
  • forem_do_size: the Droplet size. The recommended size is s-2vcpu-2gb, with 2 Shared CPUs, 2GB of RAM, a 60GB SSD disk, and 3TB of outbound transfer.

Setup

  1. Install the DigitalOcean Ansible collection ansible-galaxy collection install community.digitalocean or install it via ansible-galaxy collection install -r requirements.yml
  2. Download and install doctl
  3. Create DigitalOcean Auth Token
  4. Run doctl auth init and pass the API token created from step 3 and verify that you can authenticate to the DigitalOcean API with doctl account get. If you used a context here, you'll need to also doctl auth switch.

Provision

  1. Run the DigitalOcean provider playbook to set up your Forem
    • ansible-playbook -i inventory/forem/setup.yml playbooks/providers/digitalocean.yml

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.


Google Cloud

The Google Cloud provisioning target has a few preset variables that can be either edited in the playbook or pass along as Ansible extra vars on the CLI.

forem_gcp_region: us-central1
forem_gcp_zone: a
forem_gcp_machine_type: e2-small
forem_gcp_disk_size: 100
forem_gcp_project_id: forem-selfhost-12345
  • forem_gcp_region + forem_gcp_zone: the Google Cloud region and zone that is used to setup your Forem server. The default region is us-central1 in zone a which is in Council Bluffs, Iowa, USA
  • forem_gcp_machine_type: the GCP machine type. A recommended type is e2-small, with 2 shared CPUs and 2GB of RAM
  • forem_gcp_disk_size: the amount of disk space (in GB)
  • forem_gcp_project_id: your GCP project ID

Setup

  1. Install the Google Cloud collection ansible-galaxy collection install google.cloud or install it via ansible-galaxy collection install -r requirements.yml
  2. Install requests and google-auth pip3 modules pip3 install requests google-auth or run pip3 install -r requirements.txt
  3. 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

Provision

  1. Run the Google Cloud provider playbook to setup your Forem
    • ansible-playbook -i inventory/forem/setup.yml playbooks/providers/gcp.yml

Ansible Dynamic Inventories

We provide some example Dynamic Inventories for you to use on your self-hosted Forem. You can use them to run Ansible Adhoc Commands or write your own Ansible playbooks to manage your Forem.

See the SSH Examples for some commands that you can run with an Ansible Adhoc command.

AWS

Show all Forems on AWS

ansible-inventory -i inventory/providers/aws/ --graph forem

Run an Ansible Adhoc command on all Forems on AWS

ansible -i inventory/providers/aws/ -m command -a "hostname" forem

DigitalOcean

Note: You need to run export DO_API_TOKEN=your_digitalocean_api_token before running the ansible-inventory or ansible commands!

Show all Forems on DigitalOcean

ansible-inventory -i inventory/providers/digitalocean/ --graph forem

Run an Ansible Adhoc command on all Forems on DigitalOcean

ansible -i inventory/providers/digitalocean/ -m command -a "hostname" forem

Google Compute

Note: You need to edit the project list in inventory/providers/gcp/gcp.yml with your GCP project for this Ansible Inventory Dynamic to work correctly!

Show all Forems on Google Compute

ansible-inventory -i inventory/providers/gcp/ --graph forem

Run an Ansible Adhoc command on all Forems on Google Compute

ansible -i inventory/providers/gcp/ -m command -a "hostname" forem


Configuration Internals

This section covers how Forem is configured and run on Fedora CoreOS.

systemd

Forem is run with a stack of containers that are powered via Podman and systemd. The systemd unit files are located in /etc/systemd/system:

$ cd /etc/systemd/system
$ ls -lah forem*
-rw-r--r--. 1 root root  243 Jun 29 17:16 forem-container.service
-rw-r--r--. 1 root root  833 Jun 29 17:16 forem-imgproxy.service
-rw-r--r--. 1 root root 1.1K Jun 29 17:16 forem-openresty.service
-rw-r--r--. 1 root root  787 Jun 29 17:16 forem-pod.service
-rw-r--r--. 1 root root  904 Jun 29 17:16 forem-postgresql.service
-rw-r--r--. 1 root root 1.4K Jun 29 17:16 forem-rails.service
-rw-r--r--. 1 root root  941 Jun 29 17:16 forem-redis.service
-rw-r--r--. 1 root root  951 Jun 29 17:16 forem-traefik.service
-rw-r--r--. 1 root root 1006 Jun 29 17:16 forem-worker.service
-rw-r--r--. 1 root root  691 Jun 29 17:16 forem.service

We use systemd unit dependencies heavily to correctly configure the start of service required to power your Forem.

The first systemd unit that runs on boot is forem-container.service. This service interfaces with foremimg to pull down the Forem container image and ensure that the localhost/forem/forem:current container tag is present.

We then create a Podman pod with the forem-pod.service to run all of the Forem services within it. Pods are a group of one or more containers that share the same network, pid and ipc namespaces. This means that localhost is isolated inside the pod and shared across all of the containers within the pod. The pod also binds ports 80 and 443 on the Fedora CoreOS server.

We then launch all of the required services within this Podman pod: forem-imgproxy.service, forem-postgresql.service, forem-redis.service. All of these services use the systemd BindsTo directive which configures a strong dependency on forem-pod.service. This means if forem-pod.service is stopped or it enters an inactive state, all of these services will stop too. Also, all of these services have to be up before our next unit, forem.service can start successfully.

The forem.service unit uses the BindsTo directive to bind forem-rails.service, forem-worker.service, and forem-openresty together as they are tightly dependent on each other to run Forem. This means you can stop and start the forem.service unit via systemctl and it will stop the three main Forem units, too. This service also ensures that forem-pod.service, forem-postgresql.service, forem-imgproxy.service, and forem-redis.service units are active and that the local container localhost/forem/forem:current exists before starting.

The main Forem systemd units are forem-rails.service, forem-worker.service, and forem-openresty. The forem-rails.service creates container volume mount /opt/forem/data/uploads on the Fedora CoreOS host and mounts it inside the container at /opt/apps/forem/public/uploads. The Forem Containerfile uses a VOLUME directive to create a container volume /opt/apps/forem/public and it puts all of the Forem public assets (CSS and JS) inside. These volumes are shared between the other main Forem containers: forem-worker.service, and forem-openresty.

The forem-rails.service is the main Ruby on Rails application that is running Puma which is a very fast and concurrent HTTP 1.1 application server.

The forem-worker.service is the background worker container that runs Sidekiq.

The forem-openresty.service runs OpenResty which is a dynamic web platform based on NGINX and LuaJIT. We use OpenResty to proxy connections to Puma in the forem-rails.service unit. We also use OpenResty to send proxy requests to forem-imgproxy.service for image resizing, which are then cached in OpenResty.

The last service we use in the configuration phase is forem-traefik.service. It is responsible for handling traffic from the Internet and passing it into the Forem Pod to forem-openresty.service, which then manages the traffic to forem-rails.service. It also manages the TLS certificate from Let's Encrypt and handles the redirection from HTTP to HTTPS.

Forem configs

All of your Forem's data and configuration resides in /opt/forem. This is the most important directory on your Forem. You should backup this directory regularly.

# ll /opt/forem/
total 4
drwxr-x---. 3 root root 39 Jun 29 17:16 configs
drwxr-x---. 5 root root 52 Jun 29 17:16 data
drwxr-x---. 2 root root 82 Jun 29 17:16 envs
drwxr-xr-x. 2 root root  6 Jun 29 17:16 tmp
-rw-r--r--. 1 root root 37 Jun 29 17:16 version

The configs directory contains the OpenResty (Nginx) configuration file and the Traefik configuration TOML files, along with the acme.json, which holds the TLS certificate from Let's Encrypt.

# ll
total 4
-rw-r--r--. 1 root root 2375 Jun 29 17:16 nginx.conf
drwxr-x---. 2 root root   63 Jun 29 17:16 traefik
# ll traefik/
total 12
-rw-------. 1 root root 3524 Jun 29 17:20 acme.json
-rw-r--r--. 1 root root 1928 Jun 29 17:16 dynamic.toml
-rw-r--r--. 1 root root  740 Jun 29 17:16 traefik.toml

The data directory contains your postgresql, redis, and upload directories. This directory contains all of your Forem content including your members.

# ll data/
total 4
drwx------. 19 polkitd root 4096 Jun 29 17:19 postgresql
drwxr-x---.  2 polkitd root   28 Jun 29 17:19 redis
drwxr-x---.  2 core    core    6 Jun 29 17:16 uploads

The envs directory contains all of the environment variable files that configure the following Forem services:

  • forem-imgproxy.service with imgproxy.env
  • forem-postgresql.service with postgresql.env
  • forem-rails.service, forem-worker.service with rails.env
  • forem-redis.service with redis.env
# ll envs/
total 12
-rw-r-----. 1 root root  319 Jun 29 17:16 imgproxy.env
-rw-r-----. 1 root root   85 Jun 29 17:16 postgresql.env
-rw-r-----. 1 root root 1483 Jun 29 17:16 rails.env
-rw-r-----. 1 root root    0 Jun 29 17:16 redis.env

If you have to make a configuration to a service, you can edit the respective ENV file and restart the service via systemd. For example, systemctl restart forem.service after editing the rails.env file.

The version file is written out by the forem-container.service systemd unit and foremimg script.

Note: Making changes to these files can prevent your Forem from starting and cause downtime. Make changes with care and create backups!

SSH Examples

All of these examples need to be run via SSH on the Fedora CoreOS server as the core or root user. You can access your Forem server via SSH:

ssh core@<SERVER IP ADDRESS>

If your key doesn't have a default name like id_dsa, id_ecdsa, id_rsa, etc. you must specify it with the -i identity_file option. For example, this is the command you need to run for a key named forem:

ssh -i ~/.ssh/forem core@<SERVER IP ADDRESS>

foremctl

We have a helper script (Forem Control) called foremctl. It is used to control your Forem via CLI.

$ foremctl help

Usage: foremctl {console|deploy|help|rake|restart|start|stat|status|stop|update|version}

console         Open a Rails console
deploy          Updates and deploy the most current version of Forem
help            Show this message
rake            Run a rake task
restart         Restart Forem
start           Start Forem
stats           Show CPU, RAM, Disk IO usage of the Forem containers
status          Show the current running Forem containers
stop            Stop Forem
update          Updates Forem to the lastest container
version         Shows information on the current running version of Forem

Update Forem to the latest version and restart

sudo foremctl deploy

Note: The deploy process causes a small amount of downtime while the Forem code restarts.

foremimg

We have a helper script (Forem Image) called foremimg. It is used to control your Forem's version and apply updates. It has to be run as the root user.

# foremimg help

Usage: foremimg {help|rollback|show}

help            Show this message
rollback        Issue a rollback

show            Show tags: current|rollback
  current       Show what image is tagged with current
  rollback      Show what image is tagged with rollback

Running foremimg with no flags will read /opt/forem/version if present for the
container tag or write /opt/forem/version with the default tag quay.io/forem/forem:latest

Running foremimg quay.io/forem/forem:testing will write quay.io/forem/forem:testing
to /opt/forem/version and pull this container and point the local container
image tag 'localhost/forem/forem:current' to 'quay.io/forem/forem:testing'
and point the previous image to 'localhost/forem/forem:rollback'

Rollbacks:
Running 'foremimg rollback' will swap 'localhost/forem/forem:rollback' with 'localhost/forem/forem:current'

Set the Forem container repository and tag

sudo foremimg quay.io/forem/forem:testing

Update Forem to the latest version with no restart

sudo foremimg update

Rollback Forem to the last running version and restart

sudo foremimg rollback
sudo foremctl restart

Update Fedora CoreOS to the latest stable version

Check for updates:

$ sudo rpm-ostree upgrade --check
2 metadata, 0 content objects fetched; 16 KiB transferred in 1 seconds; 0 bytes content written
AvailableUpdate:
        Version: 34.20210529.1.0 (2021-06-01T19:22:39Z)
         Commit: 936a0a142a09ebf8fa25d50a93377d8822c4ab3bfcf477a73781823569dbd33f
   GPGSignature: Valid signature by 8C5BA6990BDB26E19F2A1A801161AE6945719A39
           Diff: 380 upgraded, 22 removed, 17 added

Preview the package updates:

$ sudo rpm-ostree upgrade --preview

Download the packages without deploying them:

$ sudo rpm-ostree upgrade --download-only

To apply the updates and reboot:

$ sudo rpm-ostree upgrade
$ systemctl reboot

Note: Fedora CoreOS is an immutable Linux distribution. You will have to reboot to have the updates take effect. This will cause downtime for your Forem.

If the update causes issues with your Forem, you can issue a rollback with:

sudo rpm-ostree rollback --reboot

Backup your Forem data

You can make a backup of your Forem data by creating gzipped tarball of /opt/forem. You will want to download this file to your local computer via SCP.

foremctl stop
sudo tar czpf ~core/"$(date '+%Y-%m-%d')-forem-data.tar.gz" /opt/forem
foremctl start

Note: Running foremctl stop will cause downtime for your Forem!


Development

To support local development, you will need a Linux workstation with virtualization enabled in the BIOS and KVM installed. You can check your workstation to see if it has support for Intel VT/AMD-V Virtualization with this command:

grep --color "svm\|vmx" /proc/cpuinfo

If that doesn't return anything, you might need to enable virtualization support in your BIOS.

Install Dependencies

In order to set up your development VM, you'll need a Linux workstation or server with the following packages:

Fedora

$ sudo dnf install -y @virtualization butane podman

RHEL/CentOS

$ sudo yum install -y qemu-kvm virt-install virt-manager podman

Ubuntu

$ sudo apt install virt-manager

Debian

$ sudo apt install qemu-kvm libvirt-bin

SSH Key

Before creating your development VM, you must supply an SSH key. SSH is the primary method you'll use to interact with the development VM. Ansible will look for a public key at the following path /${HOME}/.ssh/forem.pub. Creating a symbolic link to your SSH key is a good way to handle this:

ln -s <path_to_your_private_ssh_key> ${HOME}/.ssh/forem.pub

SSH Config

Add this to your ~/.ssh/config file:

Host devel.forem.wtf
  ForwardAgent yes
  StrictHostKeyChecking no
  UserKnownHostsFile=/dev/null

Ansible Vault

In order to encrypt your variables, you need an Ansible Vault password. This password needs to be set once and never changed. If you lose this password or change this password you will need to reset all of your encrypted variables.

mkdir -p ~/.config/forem/
pwgen -1 35 | tee ~/.config/forem/selfhost_ansible_vault_password

Create Forem Ansible Inventory

  1. Copy example Ansible Inventory from inventory/example/setup.yml to inventory/forem/setup.yml
  2. Edit inventory/forem/setup.yml Ansible Inventory with your Forem settings
    • Edit the following Ansible Inventory variables:
      • default_email
      • forem_domain_name
      • forem_subdomain_name
      • forem_server_hostname
    • Generate and save Ansible Inventory secrets:
      • vault_secret_key_base
      • vault_imgproxy_key
      • vault_imgproxy_salt
      • vault_forem_postgres_password

Launch Forem Locally

ansible-playbook -i inventory/forem/setup.yml playbooks/providers/qemu.yml

Local SSH Access

ssh [email protected] -p 2222

selfhost's People

Contributors

akhil-naidu avatar andygeorge avatar benhalpern avatar citizen428 avatar cmgorton avatar creekorful avatar djuber avatar jdoss avatar klardotsh avatar nickytonline avatar tivin-i avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

selfhost's Issues

Fedora CoreOS is compulsory? Why not Ubuntu or centos?

From last 2 hours, I am trying to understand a documents for installation and found that many confusion in the installation flow. I feel it need to rewrite flow.

On top of, Fedora CoreOS is comsulsory? Why not Ubuntu or centos?

Confirmation / Documentation of variables in setup.yml

Hi All,

Understand that the platform is moving fast in terms of development, but is there any documentation around some of the config variables? i.e. What circumstances they are used / what they connect to and for what purpose. I notice theres a slack channel / api - but I can't find out what triggers this.

Cheers,
SCR-20221007-oyz-2

Alex.

Google Cloud missing in requirements.yml

Describe the bug
During the MLH workshop we noticed that Google Cloud is missing from the requirements.yml file so using ansible-galaxy collection install -r requirements.yml as mentioned in the docs would not work to install the Google Cloud collection.

To Reproduce
Steps to reproduce the behavior:

  1. Go to requirements.yml
  2. See that there is no Google Cloud mentioned in the file.

Link in Readme to paid hosting is broken.

Hey folks,

This link is broken. Didn't want to just delete the line via a PR in case y'all have plans for swapping it out. For the record my org would love to chat with you about this option.

no able to connect with ssh

Hello,

I'm unable to connect with shh on the droplet created by Forem.
I've tried with the root and core username but i get this:
Permission denied (publickey,gssapi-with-mic).

"Launch Forem instance for {{ app_domain }}" fails

Hi there, nearly there with this now. Just this error with ec2 instance creation. I have the values that make up app_domain set in my setup.yml file

fatal: [forem]: FAILED! =>
msg: |-
The task includes an option with an undefined variable. The error was: No first item, sequence was empty.

The error appears to be in '/Users/lee/Documents/Productions/Git.nosync/forem/selfhost/selfhost/playbooks/providers/aws.yml': line 170, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  - name: "Launch Forem instance for {{ app_domain }}"
    ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"

fcos_extraction_location is not created before extracting into it

Describe the bug

When installing for QEMU/libvirt on linux.

The fcos_extraction_location defaults to "$HOME/.local/share/libvirt/images".

If this directory does not exist, the "Stat FCOS extract file" step does not fail (shows ok: [forem]), the Extract FCOS image with xz setup fails (because nothing creates the location if it does not exist)

TASK [fcos : Extract FCOS file to $HOME/.local/share/libvirt/images with xz] ****************************
fatal: [forem]: FAILED! => changed=true 
  cmd: xz --decompress -k /home/djuber/src/selfhost/playbooks/providers/images/fedora-coreos-34.20210725.3.0-qemu.x86_64.qcow2.xz -c > $HOME/.local/share/libvirt/images/fedora-coreos-34.20210725.3.0-qemu.x86_64.qcow2
  delta: '0:00:00.001628'
  end: '2021-08-20 11:05:44.692859'
  msg: non-zero return code
  rc: 2
  start: '2021-08-20 11:05:44.691231'
  stderr: '/bin/sh: 1: cannot create /home/djuber/.local/share/libvirt/images/fedora-coreos-34.20210725.3.0-qemu.x86_64.qcow2: Directory nonexistent'
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

To Reproduce
Steps to reproduce the behavior:

  1. rm -rf $HOME/.local/share/libvirt/images - if there is anything you care about in there, maybe mv instead of rm :)
  2. run the qemu install playbook ansible-playbook -i inventory/forem/setup.yml playbooks/providers/qemu.yml
  3. observe the failure on the above step

Expected behavior

The fcos_extract_location directory is checked for existence, and either an earlier error with instructions to create the directory, or automatic directory creation occurs when it's not there.

Screenshots
If applicable, add screenshots to help explain your problem.

OS (please complete the following information):

  • Linux

Cloud Provider (please complete the following information):

  • Other: QEMU/libvirt

Missing AWS key pair pem file

It automatically generates AWS key pair / pem file. However required pem file is missing. Which is needed in order to reach the server through SSH.

SMTP email service is not working

Configured Email Server Settings (SMTP) from from admin panel through Customization/Config with mailgun as service provider. After inviting a member it showed "The invite has been sent to the user's email." but the email did not received and in backend there is a timeout error happening

Steps to reproduce the behaviour :

  1. Go to '/admin/customization/config'
  2. Configured Email Server Settings (SMTP) with mailgun as service provider (Authentication:Plain, Port:465)
  3. Got to '/admin/member_manager/invitations/new' submit email address and it will show the email was sent
  4. Go to the instance console of your cloud provider where the forem is hosted and hit 'journalctl -f -u forem-rails.service' there will be a timeout error
  5. Error log :
    Error log.txt

Expected behaviour :
The email should receive

OS : Linux

Cloud Provider : AWS

Additional context :
Tried with Sendgrid and same timeout error is occurring, Changing port is not making any changes

Feedback & Confusion while installling forem selfhost

I was trying to install forem selfhost in AWS Fedora CoreOs. and following instructions.

Document - https://github.com/forem/selfhost/

Background - I am using following region in AWS with following AMI ID

  • Region: ap-south-1
    Release: 34.20210626.3.1
    Image: ami-0de887f898b8b9edf

Confusion#1 - Big Confusion in "WORKSTATION" and VMs for AWS? Instructions is so confusing where we should run which one?

Confusion#2 - Step 1-7 - I run in AWS VMs of Fedora CoreOS where i am installing forem but Suddenly Step 8 - "on your workstation" change entire senario of my understanding?

Confusion#2 - Soneone need to explin that What you are trying to do?

  1. Are you creating AWS Ec2 instance using ansble script and installing Forem in the NEW AWS EC2 instance created by script??
    or
  2. Are you trying to RUN Step 1-11 in the Ec2 instance where Forem should be installed?

Failed to login using API token, please verify validity of API token

Hello,

I run into an error while I try to run the digitalocean playbook. I followed all the instruction and the dotcli is able to create and remove depletes on DO, but the error is not very specific with the key issue.

Any help please?

[WARNING]: Collection amazon.aws does not support Ansible version 2.11.12

PLAY [Deploy Forem to DigitalOcean] ********************************************************************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************************************************************************
ok: [forem]

TASK [Check for doctl] *********************************************************************************************************************************************************************************************
changed: [forem]

TASK [Fail if doctl is not installed] ******************************************************************************************************************************************************************************
skipping: [forem]

TASK [Check doctl account get] *************************************************************************************************************************************************************************************
changed: [forem]

TASK [Fail if doctl account get fails] *****************************************************************************************************************************************************************************
skipping: [forem]

TASK [Include vars from doctl/config.yaml into the 'doctl_check' variable"] ****************************************************************************************************************************************
ok: [forem]

TASK [Set doctl facts] *********************************************************************************************************************************************************************************************
ok: [forem]

TASK [preflight : Fetch public WAN IPv4 address json] **************************************************************************************************************************************************************
ok: [forem]

TASK [preflight : Set local_wan_ip_address fact] *******************************************************************************************************************************************************************
ok: [forem]

TASK [preflight : Verify Ansible is >= 2.11.0] *********************************************************************************************************************************************************************
ok: [forem] => changed=false 
  msg: All assertions passed

TASK [preflight : Get list of installed Python 3 packages] *********************************************************************************************************************************************************
changed: [forem]

TASK [preflight : Read requirements.txt] ***************************************************************************************************************************************************************************
ok: [forem]

TASK [preflight : Generate list of missing pip prerequisites] ******************************************************************************************************************************************************
ok: [forem]

TASK [preflight : Generate list of missing python packages] ********************************************************************************************************************************************************
ok: [forem]

TASK [preflight : Verify that required Python 3 packages are installed] ********************************************************************************************************************************************
ok: [forem] => changed=false 
  msg: All assertions passed

TASK [Get FCOS facts] **********************************************************************************************************************************************************************************************

TASK [fcos : Get FCOS releases] ************************************************************************************************************************************************************************************
ok: [forem]

TASK [fcos : Set FCOS file download facts] *************************************************************************************************************************************************************************
ok: [forem]

TASK [Gather information about all images] *************************************************************************************************************************************************************************
fatal: [forem]: FAILED! => changed=false 
  msg: Failed to login using API token, please verify validity of API token.

PLAY RECAP *********************************************************************************************************************************************************************************************************
forem  ```

GIFs are broken in Forem Cloud/Self-Host

Check out this post in forem.dev for more information. You can clearly identify that the cover image is not being displayed. Even though the GIF can be seen in the draft.

All the links => Uploaded GIF URL, Resized URL, CoverImage as GIF and Embedded GIF can be seen in the post.

Probable reason

Within imgproxy there is some issue, because I can view the image in the draft and the preview screen. This tell me that there is no problems with uploading and cropping, so it should be related to fetching.

Another reason; Why I think it is related to imgproxy.

Leeawrdslope is a Forem based community, but not using the traditional self-hosting guide. It is based on dokku and doesn't use imgproxy; for image caching and resizing we are using Cloudinaries Immaga Plugin.

Here is a post on Leewardslope, which holds a GIF as cover

S3 permissions not updated on repeated runs leads to server initialization error

Describe the bug
S3 permissions not updated on repeated runs leads to server initialization error.

When I ran ansible for the first time, for some reason I didn't set it up properly and ran it a second time, the S3 permissions were not updated. This resulted in the following image. forem.ign failed to download and resulted in a system initialization error

To Reproduce
Steps to reproduce the behavior:

  1. Run ansible-playbook -i inventory/forem/setup.yml playbooks/providers/aws.yml
  2. Delete the old EC2 Instance
  3. Rerun ansible-playbook -i inventory/forem/setup.yml playbooks/providers/aws.yml
  4. Goto AWS dashboard show system logs
  5. See an error

Screenshots
3hV5IHqnVM

OS (please complete the following information):

  • MacOS

Cloud Provider (please complete the following information):

  • AWS

Additional context
Add any other context about the problem here.

Forem self-host with QEMU error

Hello,

Anyone is getting this issue when deploying using QEMU on Fedora 37 and Fedora 38?

# ansible-playbook -i inventory/forem/setup.yml playbooks/providers/qemu.yml

PLAY [Build Forem on QEMU] ****************************************************************************************************************************

TASK [preflight : Fetch public WAN IPv4 address json] *************************************************************************************************
ok: [forem]

TASK [preflight : Set local_wan_ip_address fact] ******************************************************************************************************
ok: [forem]

TASK [preflight : Verify Ansible is >= 2.11.0] ********************************************************************************************************
ok: [forem] => changed=false
  msg: All assertions passed

TASK [preflight : Get list of installed Python 3 packages] ********************************************************************************************
changed: [forem]

TASK [preflight : Read requirements.txt] **************************************************************************************************************
ok: [forem]

TASK [preflight : Generate list of missing pip prerequisites] *****************************************************************************************
ok: [forem]

TASK [preflight : Generate list of missing python packages] *******************************************************************************************
ok: [forem]

TASK [preflight : Verify that required Python 3 packages are installed] *******************************************************************************
ok: [forem] => changed=false
  msg: All assertions passed

TASK [fcos : Get FCOS facts] **************************************************************************************************************************
included: /opt/services/forem/roles/fcos/tasks/facts.yml for forem

TASK [fcos : Get FCOS releases] ***********************************************************************************************************************
ok: [forem]

TASK [fcos : Set FCOS file download facts] ************************************************************************************************************
ok: [forem]

TASK [fcos : Download FCOS files] *********************************************************************************************************************
included: /opt/services/forem/roles/fcos/tasks/download.yml for forem

TASK [fcos : Check for FCOS file download] ************************************************************************************************************
ok: [forem]

TASK [fcos : Check if fcos_storage_location exists] ***************************************************************************************************
skipping: [forem]

TASK [fcos : Fail if fcos_storage_location does not exist] ********************************************************************************************
skipping: [forem]

TASK [fcos : Create temporary FCOS download directory] ************************************************************************************************
skipping: [forem]

TASK [fcos : Download FCOS files] *********************************************************************************************************************
skipping: [forem] => (item={'url': 'https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/37.20230401.3.0/x86_64/fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2.xz', 'filename': 'fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2.xz'})
skipping: [forem] => (item={'url': 'https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/37.20230401.3.0/x86_64/fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2.xz.sig', 'filename': 'fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2.xz.sig'})
skipping: [forem] => (item={'url': 'https://fedoraproject.org/fedora.gpg', 'filename': 'fedora.gpg'})

TASK [fcos : Get sha256 of FCOS download file] ********************************************************************************************************
skipping: [forem]

TASK [fcos : Import Fedora GPG key] *******************************************************************************************************************
skipping: [forem]

TASK [fcos : Verify FCOS file download via GPG] *******************************************************************************************************
skipping: [forem]

TASK [fcos : Verify sha256sum of FCOS download] *******************************************************************************************************
skipping: [forem]

TASK [fcos : Move FCOS file download to fcos_storage_location] ****************************************************************************************
skipping: [forem]

TASK [fcos : Extract FCOS image] **********************************************************************************************************************
included: /opt/services/forem/roles/fcos/tasks/extract.yml for forem

TASK [fcos : Check for FCOS file download] ************************************************************************************************************
ok: [forem]

TASK [fcos : Fail if /opt/services/forem/playbooks/providers/images/fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2.xz does not exist] ****************
skipping: [forem]

TASK [fcos : Stat FCOS extract file] ******************************************************************************************************************
ok: [forem]

TASK [fcos : Stat FCOS compressed file] ***************************************************************************************************************
ok: [forem]

TASK [fcos : Print skip extraction warning when $HOME/.local/share/libvirt/images/fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2 exists] *************
ok: [forem] =>
  msg: The extracted file $HOME/.local/share/libvirt/images/fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2.xz exists!! Skipping extraction!

TASK [fcos : Check for unxz] **************************************************************************************************************************
skipping: [forem]

TASK [fcos : Fail if unxz is not installed] ***********************************************************************************************************
skipping: [forem]

TASK [fcos : Extract FCOS file to $HOME/.local/share/libvirt/images with xz] **************************************************************************
skipping: [forem]

TASK [Convert butane file to an Ignition file] ********************************************************************************************************

TASK [butane : Check for butane] **********************************************************************************************************************
changed: [forem]

TASK [butane : Fail if butane is not installed] *******************************************************************************************************
skipping: [forem]

TASK [butane : Create temporary butane file] **********************************************************************************************************
changed: [forem]

TASK [butane : Copy Butane YAML into temporary file] **************************************************************************************************
changed: [forem]

TASK [butane : Transpile Butane YAML into JSON] *******************************************************************************************************
changed: [forem]

TASK [butane : Create temporary Butane Ignition JSON file] ********************************************************************************************
changed: [forem]

TASK [butane : Copy Butane input JSON into temporary Butane Ignition file] ****************************************************************************
changed: [forem]

TASK [butane : Gzip ignition data] ********************************************************************************************************************
changed: [forem]

TASK [butane : Register butane_ignition facts] ********************************************************************************************************
ok: [forem]

TASK [butane : Create temporary boot Butane file] *****************************************************************************************************
changed: [forem]

TASK [butane : Copy boot Butane YAML into boot Butane file] *******************************************************************************************
changed: [forem]

TASK [butane : Transpile Butane into Ignition] ********************************************************************************************************
changed: [forem]

TASK [butane : Create temporary boot Ignition file] ***************************************************************************************************
changed: [forem]

TASK [butane : Copy Butane boot JSON into temporary Butane Ignition file] *****************************************************************************
changed: [forem]

TASK [butane : Gzip ignition data] ********************************************************************************************************************
changed: [forem]

TASK [butane : Register butane_boot_ignition facts] ***************************************************************************************************
ok: [forem]

TASK [butane : ansible.builtin.file] ******************************************************************************************************************
skipping: [forem] => (item=/tmp/butane_input_jkaou0yh.bu)
skipping: [forem] => (item=/tmp/butane_input_14_vqcjw.ign)

TASK [Create QEMU Fedora CoreOS VM] *******************************************************************************************************************
fatal: [forem]: FAILED! => changed=true
  cmd: |-
    qemu-kvm -m 2048 -cpu host -snapshot -daemonize -drive if=virtio,file=$HOME/.local/share/libvirt/images/fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2 -fw_cfg name=opt/com.coreos/config,file=/tmp/butane_input_14_vqcjw.ign -nic user,model=virtio,hostfwd=tcp::2222-:22,hostfwd=tcp::9090-:9090
  delta: '0:00:00.262092'
  end: '2023-04-25 10:12:59.793747'
  msg: non-zero return code
  rc: 1
  start: '2023-04-25 10:12:59.531655'
  stderr: gtk initialization failed
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

PLAY RECAP ********************************************************************************************************************************************
forem                      : ok=33   changed=14   unreachable=0    failed=1    skipped=15   rescued=0    ignored=0

[root@forem forem]#

Then, i also tried to run specific command, but getting this error.

[root@forem forem]# qemu-kvm -m 2048 -cpu host -snapshot -daemonize -drive if=virtio,file=$HOME/.local/share/libvirt/images/fedora-coreos-37.20230401.3.0-qemu.x86_64.qcow2 -fw_cfg name=opt/com.coreos/config,file=/tmp/butane_input_14_vqcjw.ign -nic user,model=virtio,hostfwd=tcp::2222-:22,hostfwd=tcp::9090-:9090
gtk initialization failed
[root@forem forem]#

Thank you.

How to access my Forem droplet files trough sftp ?

Hello,

I was able to run a forum instance on a digital ocean droplet.
I'm wondering now how I can access this servers files trough the sftp in FileZilla for example.

I was unable to to replace the .ico file for example or I want to change some text I found on my instance, so I need to access the files from the server in order to modify them.

I was able to connect with FileZilla, but I don't know in what folder the Forem is and also many of the server folder does not open because it says that I do not have access. I'm using the key login with the "core" username.

Any help ? :)

Install error (Linux, AWS)

Describe the bug
When trying to set it up according to the instructions, it crashes at step

fatal: [forem]: FAILED! =>
  msg: |-
    The task includes an option with an undefined variable. The error was: list object has no element 0

    The error appears to be in '/home/makarygo/selfhost/playbooks/providers/aws.yml': line 48, column 5, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:


      - name: Set forem_vpc_id fact
        ^ here

To Reproduce
ansible-playbook -i inventory/forem/setup.yml playbooks/providers/aws.yml

OS (please complete the following information):

  • Linux

Cloud Provider (please complete the following information):

  • AWS

Where are the production logs?

I ran into a 500 error and so I figured I should setup streaming logs to CloudWatch Logs.

When I entered the rails container sudo podman exec -it forem-rails /bin/bash

and I tried to tail the logs tail -f log/production.log They were empty.

I set up HoneyBadger but this is only a temporary solution.

I could not determine where are the logs in the forem.yml.j2. I can see they should get set to Stdout.

Can I have a Linux command and location where I can observe the logs on a self-hosted production server?
I think if I can observe the logs I'll be able to do the rest myself.

Changing the domain URL

Hey guys, First of all, Thanks for the great product. We are exploring the Forem for a couple of weeks now after self-hosting it in AWS with a subdomain of existing domain and it works great. Now, we would like to configure to a new domain, it would be really helpful if you guys could help me to change the domain.

Butane is not installed

Describe the bug
After configuring the setup, and using the playbook to install Forem in DigitalOcean using the command ansible-playbook -i inventory/forem/setup.yml playbooks/providers/digitalocean.yml, I am facing the Ansible execution error:

  msg: 'Butane is not installed or not in your $PATH! You need to install it first. See: https://coreos.github.io/butane/getting-started/'

To Reproduce
Steps to reproduce the behavior:

  1. Follow Forem selfhost setup guide
  2. See error

Expected behavior
The playbook should run successfully.

OS (please complete the following information):

  • Linux (running on Fedora)

Cloud Provider (please complete the following information):

  • DigitalOcean

Additional context
Playbook Execution Log:

[root@e2fdfc5cd8ad selfhost]# ansible-playbook -i inventory/forem/setup.yml playbooks/providers/digitalocean.yml

PLAY [Deploy Forem to DigitalOcean] ***********************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************
ok: [forem]

TASK [Check for doctl] ************************************************************************************************************
changed: [forem]

TASK [Fail if doctl is not installed] *********************************************************************************************
skipping: [forem]

TASK [Check doctl account get] ****************************************************************************************************
changed: [forem]

TASK [Fail if doctl account get fails] ********************************************************************************************
skipping: [forem]

TASK [Include vars from doctl/config.yaml into the 'doctl_check' variable"] *******************************************************
ok: [forem]

TASK [Set doctl facts] ************************************************************************************************************
ok: [forem]

TASK [preflight : Fetch public WAN IPv4 address json] *****************************************************************************
ok: [forem]

TASK [preflight : Set local_wan_ip_address fact] **********************************************************************************
ok: [forem]

TASK [preflight : Verify Ansible is >= 2.11.0] ************************************************************************************
ok: [forem] => changed=false 
  msg: All assertions passed

TASK [preflight : Get list of installed Python 3 packages] ************************************************************************
changed: [forem]

TASK [preflight : Read requirements.txt] ******************************************************************************************
ok: [forem]

TASK [preflight : Generate list of missing pip prerequisites] *********************************************************************
ok: [forem]

TASK [preflight : Generate list of missing python packages] ***********************************************************************
ok: [forem]

TASK [preflight : Verify that required Python 3 packages are installed] ***********************************************************
ok: [forem] => changed=false 
  msg: All assertions passed

TASK [Get FCOS facts] *************************************************************************************************************

TASK [fcos : Get FCOS releases] ***************************************************************************************************
ok: [forem]

TASK [fcos : Set FCOS file download facts] ****************************************************************************************
ok: [forem]

TASK [Gather information about all images] ****************************************************************************************
ok: [forem]

TASK [Create FCOS image] **********************************************************************************************************
skipping: [forem]

TASK [Skip doctl compute image create step if image already exists] ***************************************************************
ok: [forem] => 
  msg: An image named fcos-35.20220410.3.1 already exists. Skipping doctl compute image create step!

TASK [Wait for fcos-35.20220410.3.1 to be created] ********************************************************************************
ok: [forem]

TASK [Set FCOS DO Image ID fact] **************************************************************************************************
ok: [forem]

TASK [Convert butane file to an Ignition file] ************************************************************************************

TASK [butane : Check for butane] **************************************************************************************************
fatal: [forem]: FAILED! => changed=true 
  cmd: which butane
  delta: '0:00:00.002587'
  end: '2022-04-30 16:30:08.723261'
  msg: non-zero return code
  rc: 1
  start: '2022-04-30 16:30:08.720674'
  stderr: 'which: no butane in (/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)'
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>
...ignoring

TASK [butane : Fail if butane is not installed] ***********************************************************************************
fatal: [forem]: FAILED! => changed=false 
  msg: 'Butane is not installed or not in your $PATH! You need to install it first. See: https://coreos.github.io/butane/getting-started/'

PLAY RECAP ************************************************************************************************************************
forem                      : ok=20   changed=4    unreachable=0    failed=1    skipped=3    rescued=0    ignored=1   

setup.yml file is empty

Hello,

After i run the command "./setup" the setup.yml file is empty and probably is cased by ansible-vault

Any help please.

./setup: line 40: xxd: command not found
Reading plaintext input from stdin. (ctrl-d to end input, twice if your content does not already have a newline)
usage: ansible-vault [-h] [--version] [-v] {create,decrypt,edit,view,encrypt,encrypt_string,rekey} ...

encryption/decryption utility for Ansible data files

positional arguments:
  {create,decrypt,edit,view,encrypt,encrypt_string,rekey}
    create              Create new vault encrypted file
    decrypt             Decrypt vault encrypted file
    edit                Edit vault encrypted file
    view                View vault encrypted file
    encrypt             Encrypt YAML file
    encrypt_string      Encrypt a string
    rekey               Re-key a vault encrypted file

options:
  --version             show program's version number, config file location, configured module search path,
                        module location, executable location and exit
  -h, --help            show this help message and exit
  -v, --verbose         verbose mode (-vvv for more, -vvvv to enable connection debugging)

See 'ansible-vault <command> --help' for more information on a specific command.
ERROR! stdin was empty, not encrypting```

Readme updates based on setup feedback

After an internal walkthrough by @cmgorton, we have some feedback to make some things a little clearer in the setup docs:

  • add explicit pip3 install ansible step
  • add ssh-add step after ssh-keygen
  • separate the quick setup steps into macOS vs Linux
  • add notes to each provider that let you know where your Forem VM lives at (looking at you, AWS EC2)
  • add note about Digital Ocean "Authentication contexts" to make that clearer

Failed to parse /var/home/core/selfhost/inventory/forem/setup.yml

`$ ansible-playbook -i inventory/forem/setup.yml playbooks/providers/aws.yml
[WARNING]: * Failed to parse /var/home/core/selfhost/inventory/forem/setup.yml with ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign this is
a YAML file.
[WARNING]: * Failed to parse /var/home/core/selfhost/inventory/forem/setup.yml with yaml plugin: We were unable to read either as JSON nor YAML, these are the errors
we got from each: JSON: Expecting value: line 1 column 1 (char 0) Syntax Error while loading YAML. could not find expected ':' The error appears to be in
'/var/home/core/selfhost/inventory/forem/setup.yml': line 85, column 11, but may be elsewhere in the file depending on the exact syntax problem. The offending line
appears to be: $ANSIBLE_VAULT;1.1;AES256 62376137383864393461613561353234643230666431643935303533346631393537363564366334 ^ here
[WARNING]: Unable to parse /var/home/core/selfhost/inventory/forem/setup.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Deploy Forem to AWS] *********************************************************************************************************************************************
skipping: no hosts matched

PLAY RECAP *************************************************************************************************************************************************************

[core@ip-172-31-9-59 selfhost]$
`

SSH task hangs then fails

At first, I checked the EC2 / security group, it is good to go, 22 is open to local IP.

Here is the error log:

TASK [Wait 300 seconds for port 22 to become open] ********************************************************************

fatal: [forem]: FAILED! => changed=false
  elapsed: 300
  invocation:
    module_args:
      active_connection_states:
      - ESTABLISHED
      - FIN_WAIT1
      - FIN_WAIT2
      - SYN_RECV
      - SYN_SENT
      - TIME_WAIT
      connect_timeout: 5
      delay: 20
      exclude_hosts: null
      host: XX.XX.XX.XX
      msg: null
      path: null
      port: 22
      search_regex: null
      sleep: 1
      state: started
      timeout: 300
  msg: Timeout when waiting for  XX.XX.XX.XX

PLAY RECAP ************************************************************************************************************
forem                      : ok=41   changed=17   unreachable=0    failed=1    skipped=1    rescued=0    ignored=0

I'm not sure what's the error here.

Failed to parse /root/selfhost/inventory/forem/setup.yml with ini plugin

Hello,

I need some help with the error bellow.
I had no error till here following the installation instructions.

# ansible-playbook -i inventory/forem/setup.yml playbooks/providers/digitalocean.yml
[WARNING]:  * Failed to parse /root/selfhost/inventory/forem/setup.yml with ini plugin: Invalid host pattern
'---' supplied, '---' is normally a sign this is a YAML file.
[WARNING]:  * Failed to parse /root/selfhost/inventory/forem/setup.yml with yaml plugin: We were unable to read
either as JSON nor YAML, these are the errors we got from each: JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.   could not find expected ':'  The error appears to be in
'/root/selfhost/inventory/forem/setup.yml': line 85, column 11, but may be elsewhere in the file depending on
the exact syntax problem.  The offending line appears to be:            $ANSIBLE_VAULT;1.1;AES256
33363230656134663261373032636433383638363633383434626166333062326536373339376632           ^ here
[WARNING]: Unable to parse /root/selfhost/inventory/forem/setup.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not
match 'all'

PLAY [Deploy Forem to DigitalOcean] *****************************************************************************
skipping: no hosts matched

PLAY RECAP ******************************************************************************************************

Images not loading behind VPN

Describe the bug
When the host machine has 443 and 80 access to our VPN IP's .Text and everything is working fine. Images get uploaded but they don't show on the page. Once I whitelist 443 and 80 to the world, images starts loading.

I have used ansible script and using AWS for the same.

I am also attaching the screenshot of the errors:

Screenshot 2022-04-07 at 8 20 41 PM

Error for container imgproxy:

WARNING [2022-04-07T14:50:31Z] Completed in 5.000591964s /6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n?i=i request_id=QeiphVP2f5CbLu0wUuna0 method=GET status=404 error="The image request timed out"
INFO [2022-04-07T14:50:31Z] Started /6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n request_id=dU7rTfyAvpxOhzf601AAh method=GET
WARNING [2022-04-07T14:50:36Z] Completed in 5.002901923s /6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n request_id=dU7rTfyAvpxOhzf601AAh method=GET status=404 error="The image request timed out"

Logs for openresty:

127.0.0.1 - - [07/Apr/2022:14:45:01 +0000] "GET /images/6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n HTTP/1.1" 404 27 "{host}/newws-413n" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36" "ip-addr" "/images/6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n" "MISS"

For AWS deployment, is it a good idea to auto assign an elastic IP during the build?

Hi there,

Test deployed into AWS numerous times in various conditions, works great! Just thought of this though:

I noticed that when deployed, the ec2 instance receives a standard nonpersistent public IP that refreshes on reboot and during other conditions.

Have you considered auto-assigning an elastic IP? They are free when attached to an ec2 instance and persist through reboots and changes and can be moved to other instances

bin/startup issue

Hi ,

After i ran the bin/startup i am getting below the error in the browser. Any one let me know the issue.

image

ERROR! couldn't resolve module/action 'amazon.aws.ec2'. This often indicates a misspelling, missing collection, or incorrect module path.

I did this last week for a different client and everything worked as expected (eventually).
I've even nuked the VM I am working from and started completely from scratch five times so far.
I am doing this on the most recent version of Ubuntu Desktop from within a Virtualbox VM.
Please help me. I am at my wits' end.

Here are the steps I performed:
(I have been at this for hours so may have forgotten to document one or more step below)

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
sudo apt install python3-pip
sudo apt install podman
sudo apt install pwgen
podman pull quay.io/coreos/butane:release
sudo apt install git
git clone https://github.com/forem/selfhost.git
cd selfhost
./setup

-- added the vault keys including the silly indents with exactly the correct number of spaces.
-- added the domain, subdomain and default email.

ansible-galaxy collection install -r requirements.yml
ssh-keygen -t rsa
pip3 install boto boto3 botocore

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aws configure --profile forem-selfhost

ansible-playbook -i inventory/forem/setup.yml playbooks/providers/aws.yml

Then I get an error:
_ERROR! couldn't resolve module/action 'amazon.aws.ec2'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/home/doug/selfhost/playbooks/providers/aws.yml': line 170, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  • name: "Launch Forem instance for {{ app_domain }}"
    ^ here
    We could be wrong, but this one looks like it might be an issue with
    missing quotes. Always quote template expression brackets when they
    start a value. For instance:

    with_items:

    • {{ foo }}

Should be written as:

with_items:
  - "{{ foo }}"_

Thanks.
Doug Melvin

The role 'preflight' was not found

Describe the bug

ERROR! the role 'preflight' was not found in amazon.aws:community.aws:community.general:ansible.legacy:/mnt/c/Users/*/selfhost/playbooks/providers/roles:/home/*/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/mnt/c/Users/johnc/selfhost/playbooks/providers

The error appears to be in '/mnt/c/Users/*/selfhost/playbooks/providers/aws.yml': line 24, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
    - preflight
      ^ here

To Reproduce
Steps to reproduce the behavior:

  1. Do the AWS setup
  2. Run AWS playbook

Expected behavior
Proper AWS setup

Screenshots
If applicable, add screenshots to help explain your problem.

OS (please complete the following information):

  • WSL2 on Windows 11

Cloud Provider (please complete the following information):

  • AWS

Additional context
Add any other context about the problem here.

I get 404 page not found after following the guide

Describe the bug
I get 404 page not found instead of creating an admin account page

To Reproduce
Steps to reproduce the behavior:
Follow @jdoss https://www.youtube.com/watch?v=af7N_-M1-3Y and deploy on GCP
As the final step restart traefik service on server
Open domain see no ssl certificate installed and 404 page not found error.

Expected behavior
Register first user page

Screenshots
image

OS (please complete the following information):

  • Ubuntu

Cloud Provider (please complete the following information):

  • Google Cloud Provider

Additional context
Add any other context about the problem here.
This guy has the same problem -> here

forem Install Error: Transpile Butane YAML into JSON

TASK [butane : Transpile Butane YAML into JSON] ************************************************************************************************************************
fatal: [forem]: FAILED! => changed=true
cmd: |-
butane --strict "/tmp/butane_input_ajt1wc2f.bu"
delta: '0:00:00.061281'
end: '2021-07-18 00:11:02.752356'
msg: non-zero return code
rc: 1
start: '2021-07-18 00:11:02.691075'
stderr: 'Error translating config: Error unmarshaling yaml: yaml: line 501: found character that cannot start any token'
stderr_lines:
stdout: ''
stdout_lines:

PLAY RECAP *************************************************************************************************************************************************************
forem : ok=14 changed=4 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0

For AWS, default the EBS from 100 GB to 30GB

Its default is 100 GB and this means snapshots will take a long time when creating AMIs.
EBS snapshots are a common hidden cost that can add up quickly on AWS

  vars:
    fcos_arch: x86_64
    fcos_platform: aws
    fcos_format: vmdk.xz
    fcos_stream: stable
    fcos_aws_region: us-east-1
    fcos_aws_size: t3a.small
    fcos_aws_ebs_size: 100
    fcos_aws_profile: forem-selfhost
    butane_cleanup: true
    ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"

Free Tier is 30 GB, So I would like to suggest this as the default.

Screen Shot 2021-07-22 at 2 27 26 PM

Sir can i use amazon lightsail or vultr to self host forem please reply

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

OS (please complete the following information):

  • Linux
  • MacOS

Cloud Provider (please complete the following information):

  • AWS
  • DigitalOcean
  • Google Cloud Provider
  • Other

Sir can i use amazon lightsail or vultr to self host forem please reply
Additional context
Add any other context about the problem here.

Using /bin/container-setup failed

 Started POST "/__better_errors/3ec715cac561429f/variables" for 172.19.0.1 at 2023-08-17 18:05:58 +0000
forem_seed             | rake aborted!
forem_seed             | NoMethodError: undefined method `protocol' for nil:NilClass
forem_seed             | 
forem_seed             |             "#{request.protocol}#{host}"

Can i add script in head tag?

I would like to add custom script in head and body tag. Is that possible in selfhost?

And also is that any way to upload file in root folder? I would like to upload ads.txt file in root folder.

DigitalOcean provider playbook: doctl compute image create step is not skipped & image creation always fails

I'm trying to set up Forem with the DigitalOcean provider playbook and keep hitting a wall on the "doctl compute image create" step.
I can see that the correct custom image has been created in the first run of the playbook (it's visible with "doctl compute image list" via CLI, and I can see it in the web-based UI at DO), but the playbook keeps insisting on re-creating it (and subsequently times out). Every time I run it, a new image with the same name (at the time of writing, fcos-36.20220806.3.0) is created at my DO custom image store.

Also, the sequence of things looks a little odd to me:

TASK [Create FCOS image] **********************************************************************************************************************************************
changed: [forem]

TASK [Skip doctl compute image create step if image already exists] ***************************************************************************************************
skipping: [forem]

Shouldn't the "Skip" task be executed before the "Create Image" task?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.