From 295fc0e612904637a6e34d167d5a282ba33a6854 Mon Sep 17 00:00:00 2001 From: June Rhodes Date: Sun, 27 Nov 2016 13:39:46 +1100 Subject: [PATCH] Add dev_start.sh to let people get a development environment started quickly --- .gitignore | 2 ++ config/database.yml | 6 ++++- dev_start.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 dev_start.sh diff --git a/.gitignore b/.gitignore index 5dabc59d94..158c5a9eba 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ public/assets .env.* node_modules/ neo4j/ +.secret.keybase +.secret.paperclip diff --git a/config/database.yml b/config/database.yml index 52c26f599c..62c844f92f 100644 --- a/config/database.yml +++ b/config/database.yml @@ -6,7 +6,11 @@ default: &default development: <<: *default - database: mastodon_development + database: <%= ENV['DB_DEV_NAME'] || 'mastodon_development' %> + username: <%= ENV['DB_USER'] || 'mastodon' %> + password: <%= ENV['DB_PASS'] || '' %> + host: <%= ENV['DB_HOST'] || 'localhost' %> + port: <%= ENV['DB_PORT'] || 5432 %> # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". diff --git a/dev_start.sh b/dev_start.sh new file mode 100644 index 0000000000..0b0566dd88 --- /dev/null +++ b/dev_start.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e + +# Environment variables +export REDIS_HOST=localhost +export REDIS_PORT=6379 +export DB_HOST=localhost +export DB_USER=postgres +export DB_DEV_NAME=postgres +export DB_PASS=postgres +export DB_PORT=5432 + +# Federation +export LOCAL_DOMAIN=localhost +export LOCAL_HTTPS=false + +# Application secrets +if [ ! -f .secret.paperclip ]; then + echo "$(rake secret)" > .secret.paperclip +fi +if [ ! -f .secret.keybase ]; then + echo "$(rake secret)" > .secret.keybase +fi +export PAPERCLIP_SECRET=$(<.secret.paperclip) +export SECRET_KEY_BASE=$(<.secret.keybase) + +# E-mail configuration +export SMTP_SERVER=smtp.mailgun.org +export SMTP_PORT=587 +export SMTP_LOGIN= +export SMTP_PASSWORD= +export SMTP_FROM_ADDRESS=notifications@example.com + +# Set the rails environment to development. +export RAILS_ENV=development + +# Install dependencies +#bundle install + +# Install Node.js dependencies +if [ ! -d node_modules ]; then + yarn +fi + +# Upgrade database +rails db:migrate + +# Compile assets; if you set RAILS_ENV to production, you +# need to uncomment this line. +#rails assets:precompile + +# Run web server +rails server \ No newline at end of file