Skip to content

Commit

Permalink
Incomplete Fig configuration, requires better support for working wit…
Browse files Browse the repository at this point in the history
…h Postgres outside of a Docker container
  • Loading branch information
just3ws committed Nov 3, 2014
1 parent bdfccd6 commit 40571db
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 41 deletions.
6 changes: 0 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ SESSION_SECRET=session_secret

TRUSTED_IP=127.0.0.1

WEB_ROOT=/home/vagrant/web/
WEB_MIN_CONCURRENCY=0
WEB_MAX_CONCURRENCY=16
WEB_WORKERS=8
WEB_PORT=tcp://0.0.0.0:3000

# VCR record mode should only be touched if your adding to or updating api backed tests.
# VCR_RECORD_MODE=none #Modes: [new, once, all]

Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
= yield :head

%body{ id: yield(:body_id) }
hello
= render partial: 'nav_bar'
#main-content
- if main_content_wrapper(yield(:content_wrapper))
Expand Down
35 changes: 28 additions & 7 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
default: &default
adapter: postgresql
encoding: unicode
host: <%= ENV['DEV_POSTGRES_HOST'] || 'localhost' %>
password:
pool: 5
port: <%= ENV['DEV_POSTGRES_PORT'] || 5432 %>
username: <%= ENV['DEV_POSTGRES_USER'] || 'vagrant' %>
<%
if ENV['DOCKER_DATABASE_URL']
database_name = URI(ENV['DOCKER_DATABASE_URL']).path[1..-1]
%>
# url: <%= ENV['DOCKER_DATABASE_URL'] %> Needs Rails 4
# postgresql://user:password@host:port/database


username: <%= URI(ENV['DOCKER_DATABASE_URL']).user %>
<% if URI(ENV['DOCKER_DATABASE_URL']).password.present? %>
password: <%= URI(ENV['DOCKER_DATABASE_URL']).password %>
<% end %>
#host: <%= URI(ENV['DOCKER_DATABASE_URL']).host %>
host: coderwall.local
port: <%= URI(ENV['DOCKER_DATABASE_URL']).port %>
<%
else
database_name = 'coderwall'
%>

username: vagrant
password:
host: localhost
port: 5432
<% end %>

development:
database: <%= "#{database_name}_development" %>
<<: *default
database: coderwall_development

test:
database: <%= "#{database_name}_test" %>
<<: *default
database: coderwall_test

production:
database: <%= "#{database_name}_production" %>
<<: *default
database: coderwall_production
7 changes: 5 additions & 2 deletions docs/getting_started_with_fig.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ Head to [http://www.fig.sh/install.html](http://www.fig.sh/install.html) and ins

## Git'r done

Now let's bootstrap the database and start up the app:
fig pull
fig builu

let's bootstrap the database and start up the app:

$ fig up

Expand All @@ -24,4 +27,4 @@ If you're running `boot2docker` then you can get the address with:

$ boot2docker ip

Then open up http://192.168.59.103:5000
Then open up http://192.168.59.103:5000
56 changes: 31 additions & 25 deletions fig.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
web:
build: .
command: foreman start -p 5000 web
volumes:
- .:/app
ports:
- "5000:5000"
links:
- postgres
- redis
- elasticsearch
- mongo
environment:
- DEV_POSTGRES_USER=postgres
- DEV_POSTGRES_HOST=postgres
- STRIPE_SECRET_KEY=sk_test_BQokikJOvBiI2HlWgH4olfQ2
- STRIPE_PUBLISHABLE_KEY=
- REDIS_URL=redis://redis
- ELASTICSEARCH_URL=http://elasticsearch:9200
- MONGO_URL=mongo:27017

postgres:
image: postgres
ports:
- "5432"
- "5432:5432"

redis:
image: redis
image: redis:2.8.13
ports:
- "6379:6379"

elasticsearch:
image: orchardup/elasticsearch
image: barnybug/elasticsearch:0.90.13
ports:
- "9200:9200"

mongo:
image: mongo
image: mongo:2.4.10
ports:
- "27017:27017"

#web:
#build: .
#command: echo hello # foreman start -p 5000 web
#volumes:
#- .:/app
#ports:
#- "5000:5000"
#links:
#- postgres
#- redis
#- elasticsearch
#- mongo
#environment:
#- DEV_POSTGRES_USER=postgres
#- DEV_POSTGRES_HOST=postgres
#- STRIPE_SECRET_KEY=sk_test_BQokikJOvBiI2HlWgH4olfQ2
#- STRIPE_PUBLISHABLE_KEY=
#- REDIS_URL=redis://redis:6379
#- ELASTICSEARCH_URL=http://elasticsearch:9200
#- MONGO_URL=mongo:27017
37 changes: 37 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
vagrant up
vagrant ssh -c ". /home/vagrant/web/vagrant/run"

#export DOCKER_HOST=tcp://192.168.59.103:2376
#echo $DOCKER_HOST

#export DOCKER_CERT_PATH=/Users/mike/.boot2docker/certs/boot2docker-vm
#echo $DOCKER_CERT_PATH

#export DOCKER_TLS_VERIFY=1
#echo $DOCKER_TLS_VERIFY

#export REDIS_URL=redis://$(echo $DOCKER_HOST | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'):6379
#echo $REDIS_URL

#export POSTGRES_URL=postgres://postgres@$(echo $DOCKER_HOST | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'):5432/postgres
#echo $POSTGRES_URL

#export MONGO_URL=mongodb://$(echo $DOCKER_HOST | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'):27017/badgify
#echo $MONGO_URL

#export DOCKER_DATABASE_URL=$POSTGRES_URL
#echo $DOCKER_DATABASE_URL

#fig build postgres redis mongo
#fig up -d postgres redis mongo

#rvm use ruby@coderwall --install --create
#bundle check || bundle install

#export RAILS_ENV=development
#export RACK_ENV=development

#bundle exec rake db:drop
#bundle exec rake db:create
#bundle exec rake db:migrate
#bundle exec rake db:test:prepare

#bundle exec rails server webrick -p 3000
2 changes: 1 addition & 1 deletion vagrant/coderwall-box/scripts/user-config.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo su - vagrant <<-'EOF'
cd ~/web
rvm requirements
bundle check && bundle install
bundle check || bundle install
cd
rm -rf ~/bootstrap
EOF

0 comments on commit 40571db

Please sign in to comment.