Last active
April 26, 2024 18:41
-
-
Save MyklClason/338536e05dcb09e093fca3f562d50bbc to your computer and use it in GitHub Desktop.
Cloud9 workspace setup with Rails and Postgresql | Copy/Pastable Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo service postgresql start | |
sudo sudo -u postgres psql | |
CREATE USER username SUPERUSER PASSWORD 'password'; | |
\q | |
. ~/.bashrc | |
echo "export USERNAME=username" >> ~/.bashrc | |
echo "export PASSWORD=password" >> ~/.bashrc | |
. ~/.bashrc | |
sudo sudo -u postgres psql | |
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1'; | |
DROP DATABASE template1; | |
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE'; | |
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'; | |
\c template1 | |
VACUUM FREEZE; | |
\q |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | |
username: <%= ENV['USERNAME'] %> | |
password: <%= ENV['PASSWORD'] %> | |
host: <%= ENV['IP'] %> | |
development: | |
<<: *default | |
database: Application_development | |
test: | |
<<: *default | |
database: Application_test | |
production: | |
<<: *default | |
database: Application_production | |
username: Application | |
password: <%= ENV['DATABASE_PASSWORD'] %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: You'll need to start a postgres server, sometimes you may need to restart it via stop then start. I recommend stop then start always.
sudo service postgresql stop && sudo service postgresql start
Running this command will also require you to reload your rails console if you have it up via
reload!
.