Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
constantine-nikolaou committed Nov 30, 2016
0 parents commit 7effe90
Show file tree
Hide file tree
Showing 134 changed files with 2,528 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore Byebug command history file.
.byebug_history

# Ignore test reports
/brakeman-output.*
/coverage

# Ignore results of `rake assets:precompile`.
/public/assets/

# Never check passwords into source control!
/config/database.yml
/.env
44 changes: 44 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Use this file to configure the Overcommit hooks you wish to use. This will
# extend the default configuration defined in:
# https://github.com/brigade/overcommit/blob/master/config/default.yml
#
# At the topmost level of this YAML file is a key representing type of hook
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
# customize each hook, such as whether to only run it on certain files (via
# `include`), whether to only display output if it fails (via `quiet`), etc.
#
# For a complete list of hooks, see:
# https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
#
# For a complete list of options that you can use to customize hooks, see:
# https://github.com/brigade/overcommit#configuration
#
# Uncomment the following lines to make the configuration take effect.

gemfile: Gemfile

PreCommit:
BundleCheck:
enabled: true

LocalPathsInGemfile:
enabled: true

RailsSchemaUpToDate:
enabled: true

RuboCop:
enabled: true
on_warn: fail

TrailingWhitespace:
enabled: true
exclude:
- "**/db/structure.sql"

YamlSyntax:
enabled: true

PostCheckout:
ALL:
quiet: true
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.0
8 changes: 8 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "simplecov"
SimpleCov.start("rails") do
add_filter("/bin/")
add_filter("/lib/tasks/auto_annotate_models.rake")
add_filter("/lib/tasks/coverage.rake")
end
SimpleCov.minimum_coverage(90)
SimpleCov.use_merging(false)
15 changes: 15 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

# Include tasks from other gems included in your Gemfile
require "airbrussh/capistrano"
require "capistrano/bundler"
require "capistrano/rails"
require "capistrano/mb"
require "capistrano-nc/nc"

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
84 changes: 84 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# How to deploy mena-devs_com

This document covers the steps need to deploy the application to an existing environment. To create a new environment, refer to `PROVISIONING.md`.

* **Developers:** this project is built and deployed using Capistrano, which is the `cap` command. Refer to the *Capistrano* section.
* **System administrators:** once deployed, the various processes and configuration can be maintained with familiar Linux commands. Refer to the *Server maintenance* section.


## Capistrano

### Environments

* **staging** is deployed from the `development` branch.
* **production** is deployed from the `master` branch.

### Prerequisites

Capistrano runs on your local machine and uses SSH to perform the deployment on the remote server. Therefore:

* The Capistrano gem must be installed (see `README.md` for project setup instructions).
* You must have SSH access to the production/staging server.
* Your SSH key must be installed on the server in `~deployer/.ssh/authorized_keys`.
* You must have SSH access to Git repository (using your SSH key).

### Performing a graceful deployment (no migrations)

This will deploy the latest code from `development`. Make sure to `git push` your changes first, or they will not apply.

```
bundle exec cap production deploy
```

### Performing a full deployment

If there are data migrations or other changes that require downtime, perform the deployment using the following task:

```
bundle exec cap production deploy:migrate_and_restart
```

This will stop the app and display a maintenance page during the deployment.


## Server maintenance

This application consists of two executables that run as the `deployer` user:

* Unicorn is the application server that services Rails HTTP requests
* Sidekiq is the background worker that services the job queue stored in Redis

These in turn rely on the following services:

* PostgreSQL
* Redis
* Nginx

### Controlling processes

All processes are set up to start automatically when the server boots, and can be controlled using the standard Ubuntu `service` command:

```
sudo service postgresql <start|stop|restart>
sudo service nginx <start|stop|restart>
sudo service unicorn_mena_devs_com <start|stop|restart>
sudo service sidekiq_mena_devs_com <start|stop>
```

Note that Unicorn and Sidekiq require access to PostgreSQL and Redis, so those supporting services should be started first.

### Configuration

All configuration values required by the application can be changed here:

```
/home/deployer/apps/mena_devs_com/shared/.env.production
```

After making changes to this file, be sure to restart the application:

```
sudo service unicorn_mena_devs_com restart
sudo service sidekiq_mena_devs_com stop
sudo service sidekiq_mena_devs_com start
```
71 changes: 71 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
source "https://rubygems.org"

gem "active_type", ">= 0.3.2"
gem "autoprefixer-rails", ">= 5.0.0.1"
gem "bcrypt", "~> 3.1.7"
gem "bootstrap_form", "~> 2.3"
gem "bootstrap-sass", "~> 3.3"
gem "bootscale", :require => false
gem "coffee-rails", "~> 4.2"
gem "dotenv-rails", ">= 2.0.0"
gem "font-awesome-rails"
gem "jquery-rails"
gem "mail", ">= 2.6.3"
gem "marco-polo"
gem "pg", "~> 0.18"
gem "pgcli-rails"
gem "rails", "5.0.0.1"
gem "redis-namespace"
gem "sass-rails", "~> 5.0"
gem "secure_headers", "~> 3.0"
gem "sidekiq", ">= 4.2.0"
gem "turbolinks", "~> 5"

group :production, :staging do
gem "postmark-rails"
gem "unicorn"
gem "unicorn-worker-killer"
end

group :development do
gem "annotate", ">= 2.5.0"
gem "awesome_print"
gem "better_errors"
gem "binding_of_caller"
gem "brakeman", :require => false
gem "bundler-audit", ">= 0.5.0", :require => false
gem "capistrano", "~> 3.6", :require => false
gem "capistrano-bundler", "~> 1.2", :require => false
gem "capistrano-mb", ">= 0.22.2", :require => false
gem "capistrano-nc", :require => false
gem "capistrano-rails", :require => false
gem "guard", ">= 2.2.2", :require => false
gem "guard-livereload", :require => false
gem "guard-minitest", :require => false
gem "letter_opener"
gem "listen", "~> 3.0.5"
gem "overcommit", :require => false
gem "puma", "~> 3.0"
gem "rack-livereload"
gem "rb-fsevent", :require => false
gem "rubocop", :require => false
gem "simplecov", :require => false
gem "spring"
gem "sshkit", "~> 1.8", :require => false
gem "spring-watcher-listen", "~> 2.0.0"
gem "terminal-notifier", :require => false
gem "terminal-notifier-guard", :require => false
gem "xray-rails", ">= 0.1.18"
end

group :test do
gem "capybara"
gem "connection_pool"
gem "launchy"
gem "minitest-capybara"
gem "minitest-reporters"
gem "mocha"
gem "poltergeist"
gem "shoulda-context"
gem "shoulda-matchers", ">= 3.0.1"
end
Loading

0 comments on commit 7effe90

Please sign in to comment.