Initial commit
This commit is contained in:
43
bin/setup
Normal file
43
bin/setup
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
# path to your application root
|
||||
APP_ROOT = File.expand_path('..', __dir__)
|
||||
VAULT_TOKEN = ENV.fetch('VAULT_TOKEN', 'changeme')
|
||||
|
||||
Dir.chdir APP_ROOT do
|
||||
puts "\n=== Copying config files ==="
|
||||
system 'bin/init_config'
|
||||
|
||||
puts "\n=== Removing old logs and tempfiles ==="
|
||||
system 'rm -f log/* log/daemons/*'
|
||||
system 'bin/rake tmp:clear tmp:create'
|
||||
|
||||
if ENV['JWT_PUBLIC_KEY'].nil?
|
||||
puts "\n=== Creating secrets"
|
||||
system 'bundle exec peatio security keygen --path=config/secrets'
|
||||
end
|
||||
# just done init in alvand project
|
||||
#
|
||||
# puts "\n=== Creting backend ==="
|
||||
# { 'VAULT_TOKEN' => VAULT_TOKEN }.tap do |env|
|
||||
# system(env, 'docker-compose -f config/backend.yml up -Vd')
|
||||
# end
|
||||
# sleep 5
|
||||
# puts "\n=== Initialize InfluxDB ==="
|
||||
# system 'docker-compose -f config/backend.yml exec influxdb bash -c "cat influxdb.sql | influx"'
|
||||
#
|
||||
# puts "\n=== Setup Vault"
|
||||
# system "bin/init_vault"
|
||||
|
||||
# in production we run db:setup as k8s jobs
|
||||
if ENV['RAILS_ENV'] == 'production'
|
||||
puts "\n=== Preparing database schema ==="
|
||||
system 'bin/rake db:schema:dump'
|
||||
else
|
||||
puts "\n=== Setup database ==="
|
||||
system 'bin/rake db:create db:migrate; bin/rake db:seed'
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user