Farmbot-Web-App/dokku.sh

48 lines
1.9 KiB
Bash
Raw Normal View History

2017-10-12 09:33:56 -06:00
# Start on an empty, clean Ubuntu 17 box.
# RUN UPDATES
apt-get update
apt-get upgrade --yes
# INSTALL DOKKU
wget https://raw.githubusercontent.com/dokku/dokku/v0.10.5/bootstrap.sh;
sudo DOKKU_TAG=v0.10.5 bash bootstrap.sh
# ADD SSH KEYS to the server because passwords are bad.
# Run this locally:
# cat ~/.ssh/id_rsa.pub | ssh user@host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
# xclip -sel clip < ~/.ssh/id_rsa.pub
# Visit your machine in Chrome. Copy/paste clipboard contents into the box
2017-10-12 09:59:35 -06:00
# Bootstrap Dokku, Rails and PostgreSQL
2017-10-12 09:33:56 -06:00
dokku apps:create farmbot
dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create farmbot_database
dokku postgres:link farmbot_database farmbot
2017-10-12 09:59:35 -06:00
# IMPORTANT: Use real values here. See application.example.yml for info.
dokku config:set farmbot MQTT_HOST="1.2.3.4" API_HOST="1.2.3.4" NO_EMAILS="TRUE"
dokku storage:mount farmbot /var/lib/dokku/data/keys:/keys
2017-10-12 09:33:56 -06:00
2017-10-12 09:59:35 -06:00
# You're ready to deploy! On your local machine:
# On your local machine, within the FarmBot-Web-App directory:
2017-10-12 09:33:56 -06:00
# git remote add dokku dokku@___YOUR_HOST_HERE___:farmbot
2017-10-12 09:59:35 -06:00
# git push dokku master
#
# Some deployments have been known to fail unexpectedly on first build (new VMs)
# In those cases, you can often run `git push dokku master` to force a re-build.
2017-10-12 09:33:56 -06:00
2017-10-12 09:59:35 -06:00
# After deploying, bootstrap the database:
2017-10-12 09:33:56 -06:00
dokku run my_app_name rake db:setup
2017-10-12 09:59:35 -06:00
# RUN ONLY IF YOU DO NOT HAVE A DOMAIN NAME (testing)
2017-10-12 09:33:56 -06:00
dokku proxy:ports-add farmbot http:80:5000
# IF YOU NEED TO DEBUG PROBLEMS: redeploy after performing the following:
dokku trace on # sets dokku to debug mode
dokku config:set --global CURL_TIMEOUT=600 # Prevent timeouts
dokku config:set --global CURL_CONNECT_TIMEOUT=30 # Same thing
2017-11-01 12:16:04 -06:00
# TODO: We currently do not have setup instructions for RabbitMQ. Please submit
# a pull request if you wish to contribute RabbitMQ setup instructions.