Skip to content

Commit 4ed15cd

Browse files
committed
Merge pull request coderwall#237 from whatupdave/fig
Add fig as an alternative to Vagrant
2 parents 20d310f + 282a541 commit 4ed15cd

File tree

5 files changed

+76
-3
lines changed

5 files changed

+76
-3
lines changed

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM whatupdave/ruby:2.1.4
2+
3+
RUN apt-get update -qq && apt-get install -y nodejs
4+
5+
RUN mkdir /app
6+
WORKDIR /app
7+
8+
COPY Gemfile Gemfile
9+
COPY Gemfile.lock Gemfile.lock
10+
RUN bundle install
11+
12+
ADD . /app

config/database.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
default: &default
22
adapter: postgresql
33
encoding: unicode
4-
host: localhost
4+
host: <%= ENV['DEV_POSTGRES_HOST'] || 'localhost' %>
55
password:
66
pool: 5
77
port: <%= ENV['DEV_POSTGRES_PORT'] || 5432 %>
8-
username: vagrant
8+
username: <%= ENV['DEV_POSTGRES_USER'] || 'vagrant' %>
99

1010
development:
1111
<<: *default

config/mongoid.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ development:
33
default:
44
database: badgify_development
55
hosts:
6-
- localhost:27017
6+
- <%= ENV['MONGO_URL'] || 'localhost:27017' %>
77

88
test:
99
sessions:

docs/getting_started_with_fig.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Getting started with Fig
2+
3+
## Prerequisites
4+
5+
Head to [http://www.fig.sh/install.html](http://www.fig.sh/install.html) and install Docker and Fig. You'll find instructions there for Linux, Mac and Windows.
6+
7+
## Git'r done
8+
9+
Now let's bootstrap the database and start up the app:
10+
11+
$ fig up
12+
13+
This will take a while to download all the Docker images to run Postgres, Redis, Elasticsearch and MongoDB. Once it's all done, kill it with ctrl-c and we'll create the databases:
14+
15+
$ fig run web rake db:setup
16+
17+
Now we're all ready!
18+
19+
$ fig up
20+
21+
If you're running on Linux, you should be able to open up the app at http://0.0.0.0:5000
22+
23+
If you're running `boot2docker` then you can get the address with:
24+
25+
$ boot2docker ip
26+
27+
Then open up http://192.168.59.103:5000

fig.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
22+
postgres:
23+
image: postgres
24+
ports:
25+
- "5432"
26+
27+
redis:
28+
image: redis
29+
30+
elasticsearch:
31+
image: orchardup/elasticsearch
32+
33+
mongo:
34+
image: mongo

0 commit comments

Comments
 (0)