The kabupaten application is an online resource for anyone interested in Indonesian regional development. Your assistance in developing this project is most welcome.
Ensure you switch to ruby 1.9.3.
– Install postgres ——————–
brew install postgresql ln -sfv /opt/boxen/homebrew/opt/postgresql/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist # Note that the installation creates a postgres database # Initialise database, which creates a role for your username with superuser privileges initdb /opt/boxen/homebrew/var/postgres
When installing the postgres gem, including ARCHFLAGS is recommended:
ARCHFLAGS="-arch x86_64" gem install pg
To have launchd start postgresql at login:
ln -sfv /opt/boxen/homebrew/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Or, if you don’t want/need launchctl, you can just run:
postgres -D /opt/boxen/homebrew/var/postgres
# Create a postgres user ‘root’ with create db privilege createuser -U your-user -d root
# To login to postgres psql postgres
– Setup repo and gems
git clone [email protected]:eddieridwan/kabupaten.git cp config/database{.example,}.yml cp config/app_config{.example,}.yml bundle install
Set up the development database:
bundle exec rake db:create bundle exec rake db:schema:load bundle exec rake db:seed
We are currently using:
-
Rails 3.2
-
Ruby 1.9.3
The app uses subdomains to set the locale (no subdomain: English, ‘id’: Indonesian). To run the app locally, set the following in /etc/hosts:
127.0.0.1 id.kabupaten.local 127.0.0.1 kabupaten.local 127.0.0.1 www.kabupaten.local
In the browser, set the address to one of those local host names, eg
kabupaten.local:5000
Use foreman to run the app locally, to mimic heroku:
-
gem install foreman
-
set environment variables in the file .env
cp .env{.example,}
-
put the following line in the file Procfile
web: bundle exec rails server -p $PORT
-
foreman start (defaults to port 5000)
Notes:
-
warnings in console when using webrick locally: WARN Could not determine content-length of response body. Workaround (but seems to skip displaying some logs) at the bottom of the thread at stackoverflow.com/questions/7082364/what-does-warn-could-not-determine-content-length-of-response-body-mean-and-h Apparently will be fixed in upcoming versions of Ruby
Static translations are managed using the tolk gem. See github.com/tolk/tolk for usage details. The primary locale is :en. Add new translations to en.yml.
rake tolk:sync # sync tolk database with en.yml
Then make edits using tolk. When finished, dump back to locale files:
rake tolk:dump_all
Locally, the url for the tolk UI is:
kabupaten.local:<port>/tolk
There is basic authentication for tolk. Username and password is in the .env file.
Install heroku toolbelt (for deploying to heroku): toolbelt.heroku.com
-
Login to heroku
heroku login
-
Info on heroku cli: devcenter.heroku.com/articles/using-the-cli
-
List apps
heroku apps
-
Check info on existing app
heroku apps:info –app kabupaten
-
Add heroku git to git remote
git remote add heroku [email protected]:kabupaten.git
-
Show current app config variables (some of which would be replicated in .env for the dev environment)
heroku config
-
To deploy to heroku, devcenter.heroku.com/articles/getting-started-with-rails3#local-workstation-setup
git push heroku master