Advertisement
Guest User

Untitled

a guest
Feb 4th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1.  
  2.  
  3. Do the following steps:
  4.  
  5. Create a new username and password for postgresql on cloud9:
  6.  
  7. $ sudo service postgresql start
  8. $ sudo sudo -u postgres psql
  9. postgres=# CREATE USER username SUPERUSER PASSWORD 'password';
  10. postgres=# \q
  11.  
  12. Create ENV variables on cloud9:
  13.  
  14. $ echo "export USERNAME=username" >> ~/.profile
  15. $ echo "export PASSWORD=password" >> ~/.profile
  16. $ source ~/.profile
  17.  
  18. My database.yml for rails 4.2.0 on cloud9:
  19.  
  20. default: &default
  21. adapter: postgresql
  22. encoding: unicode
  23. pool: 5
  24. username: <%= ENV['USERNAME'] %>
  25. password: <%= ENV['PASSWORD'] %>
  26. host: <%= ENV['IP'] %>
  27.  
  28. development:
  29. <<: *default
  30. database: sample_app_development
  31.  
  32. test:
  33. <<: *default
  34. database: sample_app_test
  35.  
  36. production:
  37. <<: *default
  38. database: sample_app_production
  39.  
  40. Include the gem pg in Gemfile and install:
  41.  
  42. gem 'pg', '~> 0.18.2'
  43.  
  44. $ bundle install
  45.  
  46. Update template1 postgresql for database.yml on cloud9:
  47.  
  48. postgres=# UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
  49. postgres=# DROP DATABASE template1;
  50. postgres=# CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
  51. postgres=# UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
  52. postgres=# \c template1
  53. postgres=# VACUUM FREEZE;
  54. postgres=# \q
  55.  
  56. From command line run:
  57.  
  58. bundle exec rake db:create
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement