Skip to content

Commit 51fd99c

Browse files
committed
update project using docker-compose with version 3.6
1 parent 14332e1 commit 51fd99c

File tree

153 files changed

+866
-3571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+866
-3571
lines changed

app

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker-compose.yml

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
1-
nginx:
2-
build: ./nginx
3-
ports:
4-
- "80:80"
5-
volumes_from:
6-
- web
7-
links:
8-
- web:web
9-
web:
10-
build: ./web
11-
ports:
12-
- "3000:3000"
13-
links:
14-
- db:db
15-
- memcached:memcached
16-
- redis:redis
17-
command: foreman start
18-
db:
19-
image: mysql:latest
20-
environment:
21-
MYSQL_ROOT_PASSWORD: unodostres
22-
MYSQL_USER: root
23-
MYSQL_PASSWORD: unodostres
24-
MYSQL_DATABASE: falcon
25-
ports:
26-
- "3306:3306"
27-
volumes_from:
28-
- mysql_data
29-
memcached:
30-
image: memcached:latest
31-
ports:
32-
- "11211:11211"
33-
redis:
34-
image: redis
1+
version: '3.6'
2+
services:
3+
app:
4+
image: puma
5+
volumes:
6+
- app:/app
7+
nginx:
8+
image: nginx
9+
ports:
10+
- 80:80
11+
volumes:
12+
- app:/app
13+
volumes:
14+
app:

img/example.png

-333 KB
Binary file not shown.

nginx/Dockerfile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
FROM tutum/nginx
2-
RUN rm /etc/nginx/sites-enabled/default
1+
FROM nginx:1.10
32

4-
ADD sites-available/ /etc/nginx/sites-available
5-
RUN ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
6-
7-
RUN ln -sf /dev/stdout /var/log/nginx/access.log
8-
RUN ln -sf /dev/stderr /var/log/nginx/error.log
9-
10-
EXPOSE 80
3+
COPY nginx.conf /etc/nginx/nginx.conf

nginx/nginx.conf

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
worker_processes 4;
2+
3+
events {
4+
worker_connections 1024;
5+
}
6+
7+
http {
8+
upstream app_server {
9+
server unix:/app/sockets/puma.sock fail_timeout=0;
10+
}
11+
12+
server {
13+
listen 80;
14+
15+
access_log /var/log/nginx/access.log;
16+
error_log /var/log/nginx/error.log;
17+
18+
root /app/public;
19+
keepalive_timeout 5;
20+
21+
location /alive {
22+
proxy_set_header X-Real-IP $remote_addr;
23+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24+
proxy_set_header Host $host;
25+
proxy_redirect off;
26+
proxy_pass http://app_server;
27+
}
28+
error_page 404 /index.html;
29+
30+
location ~ ^/(assets|uploads|javascript_widget)/ {
31+
gzip_static on;
32+
expires max;
33+
root /app/public;
34+
add_header Cache-Control public;
35+
}
36+
37+
location /robots.txt {
38+
alias /app/public/robots.txt;
39+
}
40+
41+
location /favicon.ico {
42+
alias /app/public/favicon.ico;
43+
}
44+
45+
location / {
46+
proxy_read_timeout 120;
47+
proxy_send_timeout 120;
48+
proxy_pass http://app_server;
49+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
50+
proxy_set_header Host $http_host;
51+
add_header Machine container;
52+
proxy_redirect off;
53+
}
54+
55+
location /cable {
56+
proxy_pass http://app_server;
57+
proxy_http_version 1.1;
58+
proxy_set_header Upgrade $http_upgrade;
59+
proxy_set_header Connection "Upgrade";
60+
}
61+
62+
error_page 500 502 503 504 /500.html;
63+
client_max_body_size 4G;
64+
}
65+
}

nginx/sites-available/default

Lines changed: 0 additions & 41 deletions
This file was deleted.

web/Dockerfile

Lines changed: 27 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,35 @@
1-
FROM ubuntu:14.04
2-
MAINTAINER Andres Colonia "andreskal@gmail.com"
1+
FROM ruby:2.3.3
2+
MAINTAINER andreskal@gmail.com
33

4-
RUN locale-gen en_US.UTF-8
4+
ENV RAILS_ENV development
55

6-
ENV HOME /root
7-
ENV PATH $HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH
8-
ENV SHELL /bin/bash
9-
ENV LANG en_US.UTF-8
10-
ENV LC_ALL en_US.UTF-8
6+
RUN apt-get update && apt-get install -y \
7+
zlib1g-dev \
8+
build-essential \
9+
libssl-dev \
10+
libyaml-dev \
11+
libsqlite3-dev \
12+
sqlite3 \
13+
libxml2-dev \
14+
libxslt1-dev \
15+
libcurl4-openssl-dev \
16+
python-software-properties \
17+
libffi-dev \
18+
nodejs-legacy \
19+
libreadline-dev \
20+
libmysqlclient-dev
1121

12-
RUN apt-get -y update
22+
RUN mkdir -p /app
23+
RUN mkdir -p /app/tmp/pids
24+
RUN mkdir -p /app/sockets
1325

14-
# install ruby dependencies
15-
RUN apt-get -y install git curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
26+
WORKDIR /app
1627

17-
# install mysql dev
18-
RUN apt-get -y install libmysqlclient-dev
28+
COPY Gemfile Gemfile.lock ./
29+
RUN gem install bundler
1930

20-
# test install mysql client to connect
21-
RUN apt-get -y install mysql-client
31+
RUN bundle install --jobs 20 --retry 5 --without test production
2232

23-
# install rbenv
33+
COPY . ./
2434

25-
RUN git clone https://github.com/sstephenson/rbenv.git /root/.rbenv
26-
RUN git clone https://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build
27-
28-
RUN echo 'eval "$(rbenv init -)"' >> $HOME/.profile
29-
RUN echo 'eval "$(rbenv init -)"' >> $HOME/.bashrc
30-
31-
RUN rbenv install 2.1.5
32-
RUN rbenv global 2.1.5
33-
34-
RUN gem install rails -v 4.0.11
35-
36-
# install npm package
37-
RUN apt-get -y install nodejs nodejs-legacy npm
38-
39-
WORKDIR /tmp
40-
ADD app/Gemfile Gemfile
41-
ADD app/Gemfile.lock Gemfile.lock
42-
RUN bundle install
43-
44-
# install bower
45-
RUN npm install -g bower
46-
47-
# add app
48-
ADD app/ /home/app
49-
50-
# execute bundle install
51-
WORKDIR /home/app
52-
53-
# expose HTTP
54-
EXPOSE 3000
35+
CMD bundle exec puma

web/Gemfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
source 'https://rubygems.org'
2+
3+
git_source(:github) do |repo_name|
4+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
5+
"https://github.com/#{repo_name}.git"
6+
end
7+
8+
9+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
10+
gem 'rails', '~> 5.1.4'
11+
# Use sqlite3 as the database for Active Record
12+
gem 'sqlite3'
13+
# Use Puma as the app server
14+
gem 'puma', '~> 3.7'
15+
# Use SCSS for stylesheets
16+
gem 'sass-rails', '~> 5.0'
17+
# Use Uglifier as compressor for JavaScript assets
18+
gem 'uglifier', '>= 1.3.0'
19+
# See https://github.com/rails/execjs#readme for more supported runtimes
20+
# gem 'therubyracer', platforms: :ruby
21+
22+
# Use CoffeeScript for .coffee assets and views
23+
gem 'coffee-rails', '~> 4.2'
24+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
25+
gem 'turbolinks', '~> 5'
26+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
27+
gem 'jbuilder', '~> 2.5'
28+
# Use Redis adapter to run Action Cable in production
29+
# gem 'redis', '~> 3.0'
30+
# Use ActiveModel has_secure_password
31+
# gem 'bcrypt', '~> 3.1.7'
32+
33+
# Use Capistrano for deployment
34+
# gem 'capistrano-rails', group: :development
35+
36+
group :development, :test do
37+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
38+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
39+
# Adds support for Capybara system testing and selenium driver
40+
gem 'capybara', '~> 2.13'
41+
gem 'selenium-webdriver'
42+
gem 'rspec-rails', '~> 3.5'
43+
end
44+
45+
group :development do
46+
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
47+
gem 'web-console', '>= 3.3.0'
48+
gem 'listen', '>= 3.0.5', '< 3.2'
49+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
50+
gem 'spring'
51+
gem 'spring-watcher-listen', '~> 2.0.0'
52+
end
53+
54+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
55+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

0 commit comments

Comments
 (0)