Skip to content

Commit 40571db

Browse files
committedNov 3, 2014
Incomplete Fig configuration, requires better support for working with Postgres outside of a Docker container
1 parent bdfccd6 commit 40571db

File tree

7 files changed

+103
-41
lines changed

7 files changed

+103
-41
lines changed
 

‎.env.example

-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ SESSION_SECRET=session_secret
1818

1919
TRUSTED_IP=127.0.0.1
2020

21-
WEB_ROOT=/home/vagrant/web/
22-
WEB_MIN_CONCURRENCY=0
23-
WEB_MAX_CONCURRENCY=16
24-
WEB_WORKERS=8
25-
WEB_PORT=tcp://0.0.0.0:3000
26-
2721
# VCR record mode should only be touched if your adding to or updating api backed tests.
2822
# VCR_RECORD_MODE=none #Modes: [new, once, all]
2923

‎app/views/layouts/application.html.haml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
= yield :head
3131

3232
%body{ id: yield(:body_id) }
33+
hello
3334
= render partial: 'nav_bar'
3435
#main-content
3536
- if main_content_wrapper(yield(:content_wrapper))

‎config/database.yml

+28-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
11
default: &default
22
adapter: postgresql
33
encoding: unicode
4-
host: <%= ENV['DEV_POSTGRES_HOST'] || 'localhost' %>
5-
password:
64
pool: 5
7-
port: <%= ENV['DEV_POSTGRES_PORT'] || 5432 %>
8-
username: <%= ENV['DEV_POSTGRES_USER'] || 'vagrant' %>
5+
<%
6+
if ENV['DOCKER_DATABASE_URL']
7+
database_name = URI(ENV['DOCKER_DATABASE_URL']).path[1..-1]
8+
%>
9+
# url: <%= ENV['DOCKER_DATABASE_URL'] %> Needs Rails 4
10+
# postgresql://user:password@host:port/database
11+
12+
13+
username: <%= URI(ENV['DOCKER_DATABASE_URL']).user %>
14+
<% if URI(ENV['DOCKER_DATABASE_URL']).password.present? %>
15+
password: <%= URI(ENV['DOCKER_DATABASE_URL']).password %>
16+
<% end %>
17+
#host: <%= URI(ENV['DOCKER_DATABASE_URL']).host %>
18+
host: coderwall.local
19+
port: <%= URI(ENV['DOCKER_DATABASE_URL']).port %>
20+
<%
21+
else
22+
database_name = 'coderwall'
23+
%>
24+
25+
username: vagrant
26+
password:
27+
host: localhost
28+
port: 5432
29+
<% end %>
930

1031
development:
32+
database: <%= "#{database_name}_development" %>
1133
<<: *default
12-
database: coderwall_development
1334

1435
test:
36+
database: <%= "#{database_name}_test" %>
1537
<<: *default
16-
database: coderwall_test
1738

1839
production:
40+
database: <%= "#{database_name}_production" %>
1941
<<: *default
20-
database: coderwall_production

‎docs/getting_started_with_fig.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ Head to [http://www.fig.sh/install.html](http://www.fig.sh/install.html) and ins
66

77
## Git'r done
88

9-
Now let's bootstrap the database and start up the app:
9+
fig pull
10+
fig builu
11+
12+
let's bootstrap the database and start up the app:
1013

1114
$ fig up
1215

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

2528
$ boot2docker ip
2629

27-
Then open up http://192.168.59.103:5000
30+
Then open up http://192.168.59.103:5000

‎fig.yml

+31-25
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
1-
web:
2-
build: .
3-
command: foreman start -p 5000 web
4-
volumes:
5-
- .:/app
6-
ports:
7-
- "5000:5000"
8-
links:
9-
- postgres
10-
- redis
11-
- elasticsearch
12-
- mongo
13-
environment:
14-
- DEV_POSTGRES_USER=postgres
15-
- DEV_POSTGRES_HOST=postgres
16-
- STRIPE_SECRET_KEY=sk_test_BQokikJOvBiI2HlWgH4olfQ2
17-
- STRIPE_PUBLISHABLE_KEY=
18-
- REDIS_URL=redis://redis
19-
- ELASTICSEARCH_URL=http://elasticsearch:9200
20-
- MONGO_URL=mongo:27017
21-
221
postgres:
232
image: postgres
243
ports:
25-
- "5432"
4+
- "5432:5432"
265

276
redis:
28-
image: redis
7+
image: redis:2.8.13
8+
ports:
9+
- "6379:6379"
2910

3011
elasticsearch:
31-
image: orchardup/elasticsearch
12+
image: barnybug/elasticsearch:0.90.13
13+
ports:
14+
- "9200:9200"
3215

3316
mongo:
34-
image: mongo
17+
image: mongo:2.4.10
18+
ports:
19+
- "27017:27017"
20+
21+
#web:
22+
#build: .
23+
#command: echo hello # foreman start -p 5000 web
24+
#volumes:
25+
#- .:/app
26+
#ports:
27+
#- "5000:5000"
28+
#links:
29+
#- postgres
30+
#- redis
31+
#- elasticsearch
32+
#- mongo
33+
#environment:
34+
#- DEV_POSTGRES_USER=postgres
35+
#- DEV_POSTGRES_HOST=postgres
36+
#- STRIPE_SECRET_KEY=sk_test_BQokikJOvBiI2HlWgH4olfQ2
37+
#- STRIPE_PUBLISHABLE_KEY=
38+
#- REDIS_URL=redis://redis:6379
39+
#- ELASTICSEARCH_URL=http://elasticsearch:9200
40+
#- MONGO_URL=mongo:27017

‎run.sh

+37
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
vagrant up
22
vagrant ssh -c ". /home/vagrant/web/vagrant/run"
3+
4+
#export DOCKER_HOST=tcp://192.168.59.103:2376
5+
#echo $DOCKER_HOST
6+
7+
#export DOCKER_CERT_PATH=/Users/mike/.boot2docker/certs/boot2docker-vm
8+
#echo $DOCKER_CERT_PATH
9+
10+
#export DOCKER_TLS_VERIFY=1
11+
#echo $DOCKER_TLS_VERIFY
12+
13+
#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
14+
#echo $REDIS_URL
15+
16+
#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
17+
#echo $POSTGRES_URL
18+
19+
#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
20+
#echo $MONGO_URL
21+
22+
#export DOCKER_DATABASE_URL=$POSTGRES_URL
23+
#echo $DOCKER_DATABASE_URL
24+
25+
#fig build postgres redis mongo
26+
#fig up -d postgres redis mongo
27+
28+
#rvm use ruby@coderwall --install --create
29+
#bundle check || bundle install
30+
31+
#export RAILS_ENV=development
32+
#export RACK_ENV=development
33+
34+
#bundle exec rake db:drop
35+
#bundle exec rake db:create
36+
#bundle exec rake db:migrate
37+
#bundle exec rake db:test:prepare
38+
39+
#bundle exec rails server webrick -p 3000
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo su - vagrant <<-'EOF'
22
cd ~/web
33
rvm requirements
4-
bundle check && bundle install
4+
bundle check || bundle install
55
cd
66
rm -rf ~/bootstrap
77
EOF

0 commit comments

Comments
 (0)
Please sign in to comment.