Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# version: 2

# registries:
# github:
# type: git
# url: https://github.com
# username: x-access-token
# password: "${{ secrets.GIT_TOKEN }}"

# updates:
# - package-ecosystem: "bundler"
# directory: '/'
# registries: "*"
# insecure-external-code-execution: allow
# schedule:
# interval: "daily"
# time: "09:00"
# timezone: "Europe/Berlin"
# target-branch: "develop"
# labels:
# - "Ruby dependencies"

version: 2

registries:
github:
type: git
url: https://github.com
username: x-access-token
password: "${{ secrets.GIT_TOKEN }}" # saved as a dependabot secret
updates:
- package-ecosystem: "bundler"
directory: "/"
registries: "*"
insecure-external-code-execution: allow
schedule:
interval: "daily"
target-branch: "develop"
labels:
- "Ruby dependencies"

30 changes: 30 additions & 0 deletions .github/workflows/dependabot-pr-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write
checks: read

jobs:
dependabot-pr-auto-merge:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]'

steps:
- name: Suite Status Checks
id: suite-checks
uses: poseidon/wait-for-status-checks@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
ignore: dependabot-email-notification

- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2

- name: Auto-merge Dependabot PR
run: |
gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/linter_ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint and SAST

on:
pull_request:
workflow_dispatch:

jobs:
lint:
uses: anynines/int-gitops/.github/workflows/linter_ruby.yml@master
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

sast:
uses: anynines/int-gitops/.github/workflows/sast_ruby.yml@master
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugins:
- rubocop-performance
- rubocop-rails
- rubocop-rspec

AllCops:
# Insert your target ruby version
TargetRubyVersion: 3.2.x
NewCops: enable


# Overwrite or add rules to create your own house style
#
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
# Layout/SpaceInsideArrayLiteralBrackets:
# Enabled: false

Layout/IndentationConsistency:
Enabled: true

Layout/IndentationWidth:
Enabled: true

Bundler:
Enabled: true
Gemspec:
Enabled: true
Layout:
Enabled: true
Lint:
Enabled: true
Metrics:
Enabled: true
Naming:
Enabled: true
Performance:
Enabled: true
Exclude:
- "spec/**/*"
Rails:
Enabled: true
Security:
Enabled: true
Style:
Enabled: true
4 changes: 2 additions & 2 deletions Capfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
# load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
# load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ gem 'erubis'
gem 'honeybadger'
gem 'psych', '< 4'

gem "rubocop"
gem "rubocop-rspec"
gem "rubocop-rails-omakase", require: false

group :development, :test do
gem 'rake'
gem 'rspec'
Expand Down
79 changes: 79 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,56 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.2.3)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
amq-protocol (2.3.2)
amqp (1.8.0)
amq-protocol (>= 2.2.0)
eventmachine
ast (2.4.3)
base64 (0.3.0)
benchmark (0.5.0)
bigdecimal (3.3.1)
concurrent-ruby (1.3.5)
connection_pool (2.5.4)
daemon-kit (0.3.3)
eventmachine (>= 0.12.10)
thor
diff-lcs (1.5.0)
drb (2.2.3)
erubis (2.7.0)
eventmachine (1.2.7)
honeybadger (5.0.2)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.15.2)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
minitest (5.26.0)
mocha (2.0.2)
ruby2_keywords (>= 0.0.5)
parallel (1.27.0)
parser (3.3.10.0)
ast (~> 2.4.1)
racc
prism (1.6.0)
psych (3.3.4)
racc (1.8.1)
rack (3.2.4)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.11.3)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -27,8 +64,47 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.47.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-performance (1.26.1)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.47.1, < 2.0)
rubocop-rails (2.33.4)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
rubocop-rails-omakase (1.1.0)
rubocop (>= 1.72)
rubocop-performance (>= 1.24)
rubocop-rails (>= 2.30)
rubocop-rspec (3.7.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
safely (0.3.2)
securerandom (0.4.1)
thor (1.2.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)

PLATFORMS
ruby
Expand All @@ -41,6 +117,9 @@ DEPENDENCIES
psych (< 4)
rake
rspec
rubocop
rubocop-rails-omakase
rubocop-rspec
safely

RUBY VERSION
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../config/boot', __FILE__)
require File.expand_path('../config/boot', __FILE__)

require 'rake'
require 'daemon_kit/tasks'
Expand Down
16 changes: 8 additions & 8 deletions config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Don't change this file!
# Configure your daemon in config/environment.rb

DAEMON_ROOT = "#{File.expand_path(File.dirname(__FILE__))}/.." unless defined?( DAEMON_ROOT )
DAEMON_ROOT = "#{File.expand_path(File.dirname(__FILE__))}/.." unless defined?(DAEMON_ROOT)

require "rubygems"
require "bundler/setup"
Expand All @@ -23,7 +23,7 @@ def pick_boot
end

def vendor_kit?
File.exists?( "#{DAEMON_ROOT}/vendor/daemon-kit" )
File.exist?("#{DAEMON_ROOT}/vendor/daemon-kit")
end
end

Expand All @@ -43,17 +43,17 @@ def load_initializer
class GemBoot < Boot
def load_initializer
begin
require 'rubygems' unless defined?( ::Gem )
require 'rubygems' unless defined?(::Gem)
gem 'daemon-kit'
require 'daemon_kit/initializer'
rescue ::Gem::LoadError => e
msg = <<EOF
rescue ::Gem::LoadError
msg = <<~EOF

You are missing the daemon-kit gem. Please install the following gem:
You are missing the daemon-kit gem. Please install the following gem:

sudo gem install daemon-kit
sudo gem install daemon-kit

EOF
EOF
$stderr.puts msg
exit 1
end
Expand Down
17 changes: 7 additions & 10 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
##### Requirement's #####
require 'bundler/capistrano'
require 'capistrano/ext/multistage'
#require "whenever/capistrano"
# require "whenever/capistrano"

##### Stages #####
set :stages, %w(production)
Expand All @@ -20,13 +20,12 @@
set :repository, "git@github.com:avarteqgmbh/virtual_host_service_worker.git"

##### Additional Settings #####
#set :deploy_via, :remote_cache
# set :deploy_via, :remote_cache
set :ssh_options, { :forward_agent => true }
default_run_options[:pty] = true

##### Overwritten and changed default capistrano tasks #####
namespace :deploy do

task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && DAEMON_ENV=#{env} bundle exec bin/virtual_host_service_worker --pidfile #{pidfile} start"
end
Expand All @@ -36,24 +35,22 @@
end

task :restart, :roles => :app, :except => { :no_release => true } do
stop
start
stop
start
end

desc "Additional Symlinks"
task :additional_symlink, :roles => :app do
run "ln -nfs #{shared_path}/config/amqp.yml #{release_path}/config/amqp.yml"
run "ln -nfs #{shared_path}/config/application.yml #{release_path}/config/application.yml"
end

end

##### After and Before Tasks #####
before "deploy:restart", "deploy:additional_symlink"
after "deploy:restart", "deploy:cleanup"

#require 'config/boot'
#require 'airbrake/capistrano'
# require 'config/boot'
# require 'airbrake/capistrano'

require './config/boot'

2 changes: 1 addition & 1 deletion config/deploy/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
set :user, "deploy"
set :env, "production"
set :pidfile, "tmp/pids/worker.pid"
set :branch, fetch(:branch, "master")
set :branch, fetch(:branch, "master")
3 changes: 1 addition & 2 deletions config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Be sure to restart your daemon when you modify this file

# Uncomment below to force your daemon into production mode
#ENV['DAEMON_ENV'] ||= 'production'
# ENV['DAEMON_ENV'] ||= 'production'

# Boot up
require File.join(File.dirname(__FILE__), 'boot')
Expand All @@ -10,7 +10,6 @@
Bundler.require :default, DaemonKit.env

DaemonKit::Initializer.run do |config|

# The name of the daemon as reported by process monitoring tools
config.daemon_name = 'virtual_host_service_worker'

Expand Down
Loading