Skip to content
This repository was archived by the owner on Jan 29, 2022. It is now read-only.

Commit

Permalink
Add several additional setup steps
Browse files Browse the repository at this point in the history
  • Loading branch information
dhollinger committed Mar 9, 2020
1 parent ee4af1e commit c30930d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ namespace :db do

desc 'Generate auth token for the application'
task :generate_token do
require './app/models/auth_token'
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: "db/#{ENV['SINATRA_ENV']}.sqlite3"
)
token = SecureRandom.urlsafe_base64
AuthToken.delete_all
AuthToken.create(token: token).save!
Expand Down
12 changes: 12 additions & 0 deletions build/vanagon/components/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
component 'app' do |pkg, _settings, _platform|
pkg.url 'https://github.com/voxpupuli/puppet_webhook'

if platform.is_deb?
pkg.requires 'sqlite3'
elsif platform.is_el?
pkg.requires 'sqlite'
else
raise("Plaform #{platform.name} is not yet supported")
end
pkg.requires 'redis'

pkg.build_requires 'ruby-2.6'
pkg.build_requires 'sqlite3'
pkg.build_requires 'runtime'
Expand All @@ -12,6 +21,7 @@
pkg.add_source 'file://resources/puppet-webhook.service'
pkg.add_source 'file://resources/puppetwebhook'
pkg.add_source 'file://resources/postinst.sh'
pkg.add_source 'file://resources/generate_token'

pkg.install do
[
Expand All @@ -24,6 +34,8 @@
'cp README.md /opt/voxpupuli/webhook/',
'cp Rakefile /opt/voxpupuli/webhook/',
'cp ../postinst.sh /opt/voxpupuli/webhook/bin/',
'cp ../generate_token /opt/voxpupuli/webhook/bin/',
'ln -s /opt/voxpupuli/webhook/bin/generate_token /usr/local/bin/generate_token',
'cp /opt/voxpupuli/webhook/config/config.yml.example /etc/voxpupuli/webhook.yaml',
"echo 'App installed'"
]
Expand Down
2 changes: 1 addition & 1 deletion config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: "db/#{ENV['SINATRA_ENV']}.sqlite"
database: "db/#{ENV['SINATRA_ENV']}.sqlite3"
)

require './lib/puppet_webhook'
Expand Down
2 changes: 1 addition & 1 deletion resources/postinst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export GEM_PATH=$GEM_HOME
export LD_PATH=/opt/voxpupuli/webhook/lib
export PATH=/opt/voxpupuli/webhook/bin:$PATH

cd /opt/voxpupuli/webhook && bin/bundle exec rake db:migrate
cd /opt/voxpupuli/webhook && bin/bundle install && bin/bundle exec rake db:migrate

0 comments on commit c30930d

Please sign in to comment.