Skip to content

Commit

Permalink
add capistrano
Browse files Browse the repository at this point in the history
  • Loading branch information
gseidel committed Aug 12, 2019
1 parent 1a15d57 commit 5485c71
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set :deploy_config_path, 'config/deploy.rb'
set :stage_config_path, 'config/deploy'
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/symfony'
require 'capistrano/file-permissions'
#require 'capistrano/cachetool'
#require 'capistrano/yarn'
Dir.glob('config/capistrano/tasks/*.rake').each { |r| import r }
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-symfony', '~> 2.0.0.pre.alfa2'
gem 'capistrano-yarn'
gem 'capistrano-cachetool'
gem 'ed25519'
gem 'bcrypt_pbkdf'
44 changes: 44 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
GEM
remote: https://rubygems.org/
specs:
bcrypt_pbkdf (1.0.0)
capistrano (3.4.1)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-cachetool (1.0.3)
capistrano-composer (0.0.6)
capistrano (>= 3.0.0.pre)
capistrano-file-permissions (1.0.0)
capistrano (~> 3.0)
capistrano-symfony (2.0.0.pre.alfa2)
capistrano (~> 3.1)
capistrano-composer (~> 0.0.3)
capistrano-file-permissions (~> 1.0)
capistrano-yarn (2.0.2)
capistrano (~> 3.0)
concurrent-ruby (1.1.4)
ed25519 (1.2.4)
i18n (1.5.3)
concurrent-ruby (~> 1.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (5.1.0)
rake (12.3.2)
sshkit (1.18.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)

PLATFORMS
ruby

DEPENDENCIES
bcrypt_pbkdf
capistrano (~> 3.4.0)
capistrano-cachetool
capistrano-symfony (~> 2.0.0.pre.alfa2)
capistrano-yarn
ed25519

BUNDLED WITH
1.12.5
45 changes: 45 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# config valid only for current version of Capistrano
lock '3.4.1'

set :application, 'enhavo-proxy'
set :repo_url, '[email protected]:enhavo/enhavo-proxy.git'
set :deploy_to, '/var/www'
set :composer_install_flags, ''
set :linked_dirs, fetch(:linked_dirs, []).push('var/media').push('var/sessions')
set :keep_releases, 5
set :file_permissions_chmod_mode, "0775"
set :file_permissions_paths, ["var/cache", "var/log", "var", "var/sessions"]
set :file_permissions_groups, ["www-data"]
set :use_sudo, false
set :branch, ENV['BRANCH'] if ENV['BRANCH']

SSHKit.config.command_map[:php] = "php"
SSHKit.config.command_map[:composer] = "php #{shared_path.join("composer.phar")}"
SSHKit.config.command_map[:cachetool] = "php #{shared_path.join("cachetool.phar")}"

namespace :deploy do
after :starting, 'composer:install_executable'
end

namespace :deploy do
task :migrate do
on roles(:db) do
symfony_console('doctrine:migrations:migrate', '--no-interaction')
end
end
task :routes do
on roles(:db) do
execute "cd '#{release_path}'; php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json"
end
end
task :webpack do
on roles(:db) do
execute "cd '#{release_path}'; yarn encore prod"
end
end
end

after 'deploy:updated', 'symfony:assets:install'
after "deploy:updated", "deploy:webpack"
after "deploy:updated", "deploy:routes"
before "deploy:publishing", "deploy:migrate"
1 change: 1 addition & 0 deletions config/deploy/deploy.rb.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
server 'domain.tld', user: 'ssh-user', port: 22

0 comments on commit 5485c71

Please sign in to comment.