From 1d268cef20b52536e29b3b6f7e906faef5be3b99 Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Mon, 12 Sep 2016 15:31:56 -0500 Subject: [PATCH] Move MySQL gem to all groups, not just test/dev --- Gemfile | 4 ++-- deployment.md | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 deployment.md diff --git a/Gemfile b/Gemfile index 64a566612..de3f9dedb 100755 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,7 @@ gem 'active_model_serializers', '~> 0.8.3' gem 'ice_cube' gem 'rack-cors', require: 'rack/cors' gem 'haikunator' # For cool bot names. +gem 'mysql' source 'https://rails-assets.org' do gem 'rails-assets-lodash' @@ -35,8 +36,7 @@ group :development, :test do gem 'factory_girl_rails' gem 'faker' gem 'smarf_doc', github: 'RickCarlino/smarf_doc' - gem 'sqlite3' - gem 'mysql' + # gem 'sqlite3' gem 'rails-erd' end diff --git a/deployment.md b/deployment.md new file mode 100644 index 000000000..4038b12b4 --- /dev/null +++ b/deployment.md @@ -0,0 +1,27 @@ + +# Deployment + +0. Create a fresh Ubuntu 16 server with Dokku (or just use DigitalOcean) + * Make sure you have atleast 1gb. +0. [Install the latest version of Dokku (don't use that DigitalOcean image)](https://github.com/dokku/dokku#installing) +0. Setup Dokku by visiting the server's URL. Follow the directions on screen. +0. `git remote add my_server dokku@138.68.19.190:my-api-name` +0. Install mariaDB plugin: [instructions](https://github.com/dokku/dokku-mariadb). +0. Create a databse: `ssh dokku@your-server mariadb:create my_db` +0. Link the DB: `ssh dokku@your-server mariadb:link my_db my-api-name` +0. Set ENV vars: + * `ssh dokku@staging-next config:set my-api-name DEVISE_SECRET=$(rake secret)` + * `ssh dokku@staging-next config:set my-api-name JS_FILE_URL=//mycdn.org/farmbot-fronted.js` + * `ssh dokku@staging-next config:set my-api-name MQTT_HOST=my-mqtt-server.org` + * `ssh dokku@staging-next config:set my-api-name DATABASE_URL=mysql://dbusername:dbpassword@dburl:dbport/dbname` + +# Old / Legacy Setup + +(Added Sept. 2016) + +0. Create a fresh Ubuntu 14 server with Dokku (or just use DigitalOcean) +0. [Upgrade to the latest version of Dokku](https://github.com/dokku/dokku/blob/master/docs/upgrading.md) (especially if you are on DigitalOcean- their version is out of date) +0. Install dokku-haproxy plugin: `ssh root@YOUR_SERVER dokku plugin:install https://github.com/256dpi/dokku-haproxy.git` +0. Deploy: `git push dokku@YOUR_SERVER:mqtt` +0. Point to correct host/port: `ssh dokku@MQTT_SERVER config:set mqtt PORT=3002 DOKKU_NGINX_PORT=3002 WEB_APP_URL=WEBAPP_URL_HERE` +0. Expose MQTT port: `ssh dokku@MQTT_SERVER ports:add mqtt 1883 web 1883`