-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ubuntu
committed
Sep 6, 2019
1 parent
3eb3fbd
commit 594d30a
Showing
11 changed files
with
211 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM ruby:2.6.0 | ||
MAINTAINER [email protected] | ||
|
||
# Install apt based dependencies required to run Rails as | ||
# well as RubyGems. As the Ruby image itself is based on a | ||
# Debian image, we use apt-get to install those. | ||
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ | ||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | ||
apt-get update && \ | ||
apt-get install -qq -y build-essential libpq-dev nodejs yarn | ||
|
||
# Configure the main working directory. This is the base | ||
# directory used in any further RUN, COPY, and ENTRYPOINT | ||
# commands. | ||
RUN mkdir -p /app | ||
WORKDIR /app | ||
|
||
# Copy the Gemfile as well as the Gemfile.lock and install | ||
# the RubyGems. This is a separate step so the dependencies | ||
# will be cached unless changes to one of those two files | ||
# are made. | ||
COPY Gemfile Gemfile.lock ./ | ||
RUN gem install bundler && bundle install --jobs 20 --retry 5 | ||
|
||
# Copy the main application. | ||
COPY . ./ | ||
RUN yarn install | ||
# Expose port 3000 to the Docker host, so we can access it | ||
# from the outside. | ||
EXPOSE 3000 | ||
|
||
# The main command to run when the container starts. Also | ||
# tell the Rails dev server to bind to all interfaces by | ||
# default. | ||
#CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"] | ||
CMD ["rails", "server", "-b", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM ruby:2.6.0 | ||
|
||
# throw errors if Gemfile has been modified since Gemfile.lock | ||
# RUN bundle config --global frozen 1 | ||
|
||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
EXPOSE 3000 | ||
CMD ["rails", "server", "-b", "0.0.0.0"] | ||
|
||
RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/* | ||
RUN apt-get update && apt-get install -y mysql-client postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ | ||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | ||
apt-get update && \ | ||
apt-get install -qq -y build-essential libpq-dev yarn | ||
|
||
COPY Gemfile /usr/src/app/ | ||
|
||
# Uncomment the line below if Gemfile.lock is maintained outside of build process | ||
COPY Gemfile.lock /usr/src/app/ | ||
|
||
|
||
RUN bundle install | ||
|
||
COPY . /usr/src/app | ||
|
||
RUN yarn install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class DashboardsController < ApplicationController | ||
def index | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
Welcome to Ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,19 @@ | ||
# PostgreSQL. Versions 9.3 and up are supported. | ||
# | ||
# Install the pg driver: | ||
# gem install pg | ||
# On macOS with Homebrew: | ||
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config | ||
# On macOS with MacPorts: | ||
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config | ||
# On Windows: | ||
# gem install pg | ||
# Choose the win32 build. | ||
# Install PostgreSQL and put its /bin directory on your path. | ||
# | ||
# Configure Using Gemfile | ||
# gem 'pg' | ||
# | ||
default: &default | ||
adapter: postgresql | ||
encoding: unicode | ||
# For details on connection pooling, see Rails configuration guide | ||
# https://guides.rubyonrails.org/configuring.html#database-pooling | ||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | ||
adapter: mysql2 | ||
encoding: utf8mb4 | ||
collation: utf8mb4_bin | ||
reconnect: false | ||
pool: 50 | ||
username: <%= ENV['DB_USERNAME'] %> | ||
password: <%= ENV['DB_PASSWORD'] %> | ||
port: <%= ENV['DB_PORT'] %> | ||
host: <%= ENV['DB_HOST'] %> | ||
socket: /var/run/mysqld/mysqlx.sock | ||
|
||
development: | ||
<<: *default | ||
database: sample_rails6_app_development | ||
<<: *default | ||
database: <%= ENV['DB_DATABASE'] %>_development | ||
|
||
# The specified database role being used to connect to postgres. | ||
# To create additional roles in postgres see `$ createuser --help`. | ||
# When left blank, postgres will use the default role. This is | ||
# the same name as the operating system user that initialized the database. | ||
#username: sample_rails6_app | ||
|
||
# The password associated with the postgres role (username). | ||
#password: | ||
|
||
# Connect on a TCP socket. Omitted by default since the client uses a | ||
# domain socket that doesn't need configuration. Windows does not have | ||
# domain sockets, so uncomment these lines. | ||
#host: localhost | ||
|
||
# The TCP port the server listens on. Defaults to 5432. | ||
# If your server runs on a different port number, change accordingly. | ||
#port: 5432 | ||
|
||
# Schema search path. The server defaults to $user,public | ||
#schema_search_path: myapp,sharedapp,public | ||
|
||
# Minimum log levels, in increasing order: | ||
# debug5, debug4, debug3, debug2, debug1, | ||
# log, notice, warning, error, fatal, and panic | ||
# Defaults to warning. | ||
#min_messages: notice | ||
|
||
# Warning: The database defined as "test" will be erased and | ||
# re-generated from your development database when you run "rake". | ||
# Do not set this db to the same as development or production. | ||
test: | ||
<<: *default | ||
database: sample_rails6_app_test | ||
|
||
# As with config/credentials.yml, you never want to store sensitive information, | ||
# like your database password, in your source code. If your source code is | ||
# ever seen by anyone, they now have access to your database. | ||
# | ||
# Instead, provide the password as a unix environment variable when you boot | ||
# the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database | ||
# for a full rundown on how to provide these environment variables in a | ||
# production deployment. | ||
# | ||
# On Heroku and other platform providers, you may have a full connection URL | ||
# available as an environment variable. For example: | ||
# | ||
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" | ||
# | ||
# You can use this database configuration with: | ||
# | ||
# production: | ||
# url: <%= ENV['DATABASE_URL'] %> | ||
# | ||
production: | ||
<<: *default | ||
database: sample_rails6_app_production | ||
username: sample_rails6_app | ||
password: <%= ENV['SAMPLE_RAILS6_APP_DATABASE_PASSWORD'] %> | ||
<<: *default | ||
database: <%= ENV['DB_DATABASE'] %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# PostgreSQL. Versions 9.3 and up are supported. | ||
# | ||
# Install the pg driver: | ||
# gem install pg | ||
# On macOS with Homebrew: | ||
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config | ||
# On macOS with MacPorts: | ||
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config | ||
# On Windows: | ||
# gem install pg | ||
# Choose the win32 build. | ||
# Install PostgreSQL and put its /bin directory on your path. | ||
# | ||
# Configure Using Gemfile | ||
# gem 'pg' | ||
# | ||
default: &default | ||
adapter: postgresql | ||
encoding: unicode | ||
# For details on connection pooling, see Rails configuration guide | ||
# https://guides.rubyonrails.org/configuring.html#database-pooling | ||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | ||
|
||
development: | ||
<<: *default | ||
database: sample_rails6_app_development | ||
|
||
# The specified database role being used to connect to postgres. | ||
# To create additional roles in postgres see `$ createuser --help`. | ||
# When left blank, postgres will use the default role. This is | ||
# the same name as the operating system user that initialized the database. | ||
#username: sample_rails6_app | ||
|
||
# The password associated with the postgres role (username). | ||
#password: | ||
|
||
# Connect on a TCP socket. Omitted by default since the client uses a | ||
# domain socket that doesn't need configuration. Windows does not have | ||
# domain sockets, so uncomment these lines. | ||
#host: localhost | ||
|
||
# The TCP port the server listens on. Defaults to 5432. | ||
# If your server runs on a different port number, change accordingly. | ||
#port: 5432 | ||
|
||
# Schema search path. The server defaults to $user,public | ||
#schema_search_path: myapp,sharedapp,public | ||
|
||
# Minimum log levels, in increasing order: | ||
# debug5, debug4, debug3, debug2, debug1, | ||
# log, notice, warning, error, fatal, and panic | ||
# Defaults to warning. | ||
#min_messages: notice | ||
|
||
# Warning: The database defined as "test" will be erased and | ||
# re-generated from your development database when you run "rake". | ||
# Do not set this db to the same as development or production. | ||
test: | ||
<<: *default | ||
database: sample_rails6_app_test | ||
|
||
# As with config/credentials.yml, you never want to store sensitive information, | ||
# like your database password, in your source code. If your source code is | ||
# ever seen by anyone, they now have access to your database. | ||
# | ||
# Instead, provide the password as a unix environment variable when you boot | ||
# the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database | ||
# for a full rundown on how to provide these environment variables in a | ||
# production deployment. | ||
# | ||
# On Heroku and other platform providers, you may have a full connection URL | ||
# available as an environment variable. For example: | ||
# | ||
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" | ||
# | ||
# You can use this database configuration with: | ||
# | ||
# production: | ||
# url: <%= ENV['DATABASE_URL'] %> | ||
# | ||
production: | ||
<<: *default | ||
database: sample_rails6_app_production | ||
username: sample_rails6_app | ||
password: <%= ENV['SAMPLE_RAILS6_APP_DATABASE_PASSWORD'] %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
Rails.application.routes.draw do | ||
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html | ||
|
||
resources :dashboards | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: '3' | ||
|
||
services: | ||
db: | ||
image: mysql:5.7 | ||
volumes: | ||
- db_data:/var/lib/mysql | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: sample_rails6_app_production | ||
MYSQL_USER: sample_rails6_app | ||
MYSQL_PASSWORD: apppass | ||
|
||
web: | ||
depends_on: | ||
- db | ||
image: rubyapp:latest | ||
ports: | ||
- "80:3000" | ||
restart: always | ||
environment: | ||
RAILS_ENV: production | ||
SECRET_KEY_BASE: secret | ||
DB_USERNAME: sample_rails6_app | ||
DB_PASSWORD: apppass | ||
DB_DATABASE: sample_rails6_app_production | ||
DB_PORT: 3306 | ||
DB_HOST: db | ||
RAILS_MAX_THREADS: 5 | ||
|
||
volumes: | ||
db_data: |