Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Import conf files from openl10n/openl10n (< 0.2.0)
  • Loading branch information
MattKetmo committed Dec 6, 2014
0 parents commit 736c29d
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
BUNDLE_PATH: vendor
BUNDLE_DISABLE_SHARED_GEMS: '1'
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = LF
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/stages/*
!/stages/deploy.rb.dist
/vendor/*
15 changes: 15 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Set the global configuration paths
set :deploy_config_path, "config.rb"
set :stage_config_path, "stages/"

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'
require 'capistrano/composer'
require 'capistrano/symfony'
require 'capistrano/console'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('tasks/*.rb').each { |f| import f }
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem 'capistrano', '~> 3.2.1'
gem 'capistrano-composer'
gem 'capistrano-symfony'
35 changes: 35 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
GEM
remote: https://rubygems.org/
specs:
capistrano (3.2.1)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-composer (0.0.4)
capistrano (>= 3.0.0.pre)
capistrano-file-permissions (0.1.0)
capistrano (>= 3.0.0)
capistrano-symfony (0.4.0)
capistrano (~> 3.1)
capistrano-composer (~> 0.0.3)
capistrano-file-permissions (~> 0.1.0)
i18n (0.6.9)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
rake (10.3.2)
sshkit (1.4.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
term-ansicolor
term-ansicolor (1.3.0)
tins (~> 1.0)
tins (1.3.0)

PLATFORMS
ruby

DEPENDENCIES
capistrano (~> 3.2.1)
capistrano-composer
capistrano-symfony
30 changes: 30 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Config valid only for Capistrano 3.1
lock '3.2.1'

set :application, 'Openl10n'

# Log level
set :log_level, :info

# Shared files
set :linked_files, %w{app/config/parameters.yml}

# Shared directories
set :linked_dirs, %w{app/logs web/uploads node_modules}

set :permission_method, :chgrp
set :use_set_permissions, true
set :file_permissions_roles, :all
set :file_permissions_paths, ['app/logs', 'app/cache']
set :file_permissions_users, ['www-data']
set :file_permissions_groups, ['www-data']
set :file_permissions_chmod_mode, "0777"

# How many releases do we keep online
set :keep_releases, 5

# Hooks before
before 'deploy:starting', 'composer:install_executable'

## Hooks after
after 'deploy:finishing', 'deploy:cleanup'
24 changes: 24 additions & 0 deletions stages/deploy.rb.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Stage name
set :stage, :production

# Github repository
set :repo_url, '[email protected]:openl10n/openl10n.git'
set :branch, 'master'

# Deploy directory
set :deploy_to, '/var/www/translate.mydomain.tld'

# SSHKit configuration
SSHKit.config.command_map[:composer] = "#{shared_path.join("composer.phar")}"
set :default_env, {
path: ["#{shared_path}/node_modules/.bin", "$PATH"].join(":")
}

# Define servers
server 'translate.mydomain.tld', user: 'root', roles: %w{php_fpm nginx}

set :composer_install_flags, '--no-dev --verbose --prefer-dist --optimize-autoloader --no-progress'

# If you are not using nginx with php-fpm you can remove theses lines an replace it by an apache graceful command
after 'deploy:finishing', 'php_fpm:reload'
after 'deploy:finishing', 'nginx:reload'
22 changes: 22 additions & 0 deletions tasks/assets.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace :assets do

task :install do
on release_roles :all do
within release_path do
execute :npm, "install"
end
end
end

task :build do
on release_roles :all do
within release_path do
execute :gulp, "build --prod"
end
end
end

after 'deploy:updated', 'assets:install'
after 'deploy:updated', 'assets:build'

end
10 changes: 10 additions & 0 deletions tasks/database.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace :database do

task :migrate do
invoke 'symfony:console', 'doctrine:schema:update', '--force'
#invoke 'symfony:console', 'doctrine:migrations:migrate', '--no-interaction'
end

after 'deploy:published', 'database:migrate'

end
14 changes: 14 additions & 0 deletions tasks/nginx.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace :nginx do

%w[start stop restart reload].each do |command|
desc "#{command.capitalize} nginx service"
task command do
on roles :nginx do
if command === 'stop' || (test "sudo nginx -t")
execute :sudo, "service nginx #{command}"
end
end
end
end

end
12 changes: 12 additions & 0 deletions tasks/php-fpm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace :php_fpm do

%w[start stop restart reload].each do |command|
desc "#{command.capitalize} php5-fpm service"
task command do
on roles :php_fpm do
execute :sudo, "service php5-fpm #{command}"
end
end
end

end

0 comments on commit 736c29d

Please sign in to comment.