Skip to content

Instantly share code, notes, and snippets.

@RickCarlino
Last active October 29, 2017 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RickCarlino/48b0362ccb82dffe5d4a292ee1cc00d2 to your computer and use it in GitHub Desktop.
Save RickCarlino/48b0362ccb82dffe5d4a292ee1cc00d2 to your computer and use it in GitHub Desktop.
Provisioning a FarmBot Web App server, Ubuntu 17.10
# How to install FarmBot Web API on a Fresh Ubuntu 17 machine.
# Remove old (possibly broke) docker versions
sudo apt-get remove docker docker-engine docker.io
# Install docker
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common --yes
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" --yes
sudo apt-get update --yes
sudo apt-get install docker-ce --yes
sudo docker run hello-world # Should run!
# Install RVM
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://get.rvm.io | bash
source /usr/local/rvm/scripts/rvm
rvm install "ruby-2.4.2"
cd .
rvm --default use 2.4.2
# LOG OUT AND LOG BACK IN NOW.
# Image Magick
sudo apt-get install imagemagick --yes
# Install Node
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs --yes
# Install Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
# Install database deps
sudo apt-get install libpq-dev postgresql-contrib --yes
# Install FarmBot Web App
git clone https://github.com/FarmBot/Farmbot-Web-App --depth=10
cd Farmbot-Web-App
gem install bundler
npm install yarn
bundle install
yarn install
cp config/database.example.yml config/database.yml
mv config/application.example.yml config/application.yml
# READ THE FILE AND CHANGE THE VALUES ^
sudo -u postgres psql
# Run this:
# CREATE USER "your_username_here" WITH SUPERUSER;
# \q
rake db:create:all db:migrate db:seed
RAILS_ENV=test rake db:create db:migrate && rspec spec
npm run test
# Run MQTT (new tab, SAME DIRECTORY)
rails mqtt:start
# Run the web server (new tab, SAME DIRECTORY)
rails api:start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment