Skip to content

Instantly share code, notes, and snippets.

@X0nic
Last active August 9, 2016 10:32
Show Gist options
  • Save X0nic/36e399f44ec3eaa3250686b531da5c61 to your computer and use it in GitHub Desktop.
Save X0nic/36e399f44ec3eaa3250686b531da5c61 to your computer and use it in GitHub Desktop.
Habitat Rails Sample Comands
# hab studio enter
hab pkg export docker core/postgresql
hab pkg export docker core/ruby-rails-sample
# Terminal - 1
docker run -e HAB_POSTGRESQL='initdb_superuser_password = "rails_sample"' -p 9631:9631 -p 5432:5432 -v rails_pg_data:/hab/svc/postgresql/data -it core/postgresql
# Terminal - 2
psql hab -d postgres -h $(docker-machine ip default) # rails_sample
docker run -p 3000:3000 -it core/ruby-rails-sample --bind database:postgresql.default --peer 172.17.0.2
# hab studio enter
hab config apply --peer 172.17.0.2 ruby-rails-sample.default 1 < rails.toml
# Terminal - 2
docker run -p 3000:3000 -it core/ruby-rails-sample --bind database:postgresql.default --peer 172.17.0.2
psql hab -d postgres -h $(docker-machine ip default)
# psql
CREATE ROLE "ruby-rails-sample" LOGIN;
CREATE DATABASE "ruby-rails-sample_production" ENCODING 'UTF8' OWNER "ruby-rails-sample";
\password "ruby-rails-sample" # rails_sample
# Terminal - 2
docker run -p 3000:3000 -it core/ruby-rails-sample --bind database:postgresql.default --peer 172.17.0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment