问题描述
我已经在这里待了大约16个小时,然后扔了毛巾。之前,我已经成功地使用capistrano部署了Rails应用程序,并且最初复制了所有内容,但无法获得过去的资产:预编译。迁移也不起作用,但在当时是一回事。
df = df[df.isin([1,0])].dropna()
# display(df)
AB AC CB DE FA CD AF
1 1.0 0 0 1.0 0 0 0.0
3 0.0 0 0 0.0 0 1 0.0
Capfile
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# Include tasks from other gems included in your Gemfile
#
# For documentation on these,see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
require "capistrano/rbenv"
#require "capistrano/bundler"
require "capistrano/rails"
#require "capistrano/rails/assets"
#require "capistrano/rails/migrations"
require 'capistrano/puma'
install_plugin Capistrano::Puma
install_plugin Capistrano::Puma::Nginx
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
config/deploy.rb
set :application,'livelyteams'
set :repo_url,'https://github.com/unusualslim/livelyteams'
set :puma_threads,[4,16]
set :puma_workers,0
set :rbenv_ruby,'2.6.5'
set :rails_env,'production'
append :linked_files,"config/master.key"
append :linked_dirs,'log','tmp/pids','tmp/cache','tmp/sockets','vendor/bundle','.bundle','public/system','public/uploads'
# append :linked_dirs,%w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# Default branch is :master
# ask :branch,`git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to,'/home/dev/apps/livelyteams'
set :rbenv_type,:user # or :system,depends on your rbenv setup
set :rbenv_ruby,File.read('.ruby-version').strip
set :rbenv_prefix,"RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :default_env,{
PATH: '$HOME/.npm-packages/bin/:$PATH',NODE_ENVIRONMENT: 'production'
}
# Default value for :scm is :git
# set :scm,:git
# Default value for :format is :pretty
# set :format,:pretty
# Default value for :log_level is :debug
# set :log_level,:debug
# Default value for :pty is false
# set :pty,true
# Default value for :linked_files is []
# set :linked_files,fetch(:linked_files,[]).push('config/database.yml','config/secrets.yml')
# Default value for linked_dirs is []
# set :linked_dirs,fetch(:linked_dirs,[]).push('log','public/system')
# Default value for default_env is {}
# set :default_env,{ path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
# set :keep_releases,5
before "deploy:assets:precompile","deploy:yarn_install"
namespace :deploy do
desc 'Run rake yarn:install'
task :yarn_install do
on roles(:web) do
within release_path do
execute("cd #{release_path} && yarn install")
end
end
end
end
namespace :deploy do
namespace :check do
before :linked_files,:set_master_key do
on roles(:app),in: :sequence,wait: 10 do
unless test("[ -f #{shared_path}/config/master.key ]")
upload! 'config/master.key',"#{shared_path}/config/master.key"
end
end
end
end
end
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app) do
execute "#{fetch(:rbenv_prefix)} pumactl -P ~/app/current/tmp/pids/puma.pid phased-restart"
end
end
end
after 'deploy:publishing','deploy:restart'
我认为这与RAILS_ENV = production有关,但是我已经尝试了所有我能想到的东西。
和capistrano.log
config/deploy/production.rb
set :stage,:production
set :branch,"master"
server 'livelyteams.com',user: "dev",port: 22,roles: %w{app db web},primary: true
解决方法
Rails抱怨您的class attack
import sys
ciphertextWithTag = bytes.fromhex(sys.argv[1])
if len(ciphertextWithTag) < 16+16+32:
print("Ciphertext is too short!")
sys.exit(0)
iv = ciphertextWithTag[:16]
ciphertext = ciphertextWithTag[:len(ciphertextWithTag)-32]
tag = ciphertextWithTag[len(ciphertextWithTag)-32:]
# TODO: Modify the input so the transfer amount is more lucrative to the recipient
# TODO: Print the new encrypted message
# you can change the print content if necessary
print(ciphertext.hex() + tag.hex())
文件。首先(备份它们,以防万一)config/master.key
和rm config/credentials.yml.enc
,然后尝试运行rm config/master.key
。
我的解决方案最终是摧毁当前的生产服务器并创建新的服务器。现在,我的项目像应有的那样通过capistrano进行部署。