|
本帖最后由 sead 于 2020-8-21 13:35 编辑
- cat /etc/DIR_COLORS | sed 's/01;34/01;36/' > ~/.dir_colors
- yum install -y epel-release yum-utils
- yum-config-manager --enable epel
- curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
- yum install yarn -y
- yum update -y
- yum groupinstall "Development Tools" -y
- yum install ncurses-devel -y
- yum install wget telnet -y
- yum -y install nodejs
- yum -y install libcurl-devel curl-devel
- yum -y install mysql-devel
- yum install -y ImageMagick #ImageMagick-devel
- yum install -y libffi-devel readline-devel ruby sqlite-devel openssl-devel
- useradd deploy
- passwd deploy
- su - deploy
- #https://rvm.io/rvm/install 安装说明
- curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
- curl -L get.rvm.io | bash -s stable
- source ~/.profile
-
- rvm install 2.5.1
- rvm use 2.5.1 --default
-
- gem install rails -v 6.0.1
- rails new cloud_wp -d mysql
复制代码 rails 新手指南 https://ruby-china.github.io/rails-guides/getting_started.html
项目关键配置
- #config/puma.rb
- application_path = "/home/deploy/cloud_wp"
- pidfile "#{application_path}/tmp/pids/puma.pid"
- state_path "#{application_path}/tmp/sockets/puma.state"
- stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
- activate_control_app "unix://#{application_path}/tmp/sockets/puma.sock"
复制代码
数据库设置
- #config/database.yml
- production:
- <<: *default
- database: xxx_production
- username: xxx
- password: <%= ENV['XXX_DATABASE_PASSWORD'] %>
- #设置环境变量
- vi ~/.bashrc
- export RAILS_ENV=production
- export XXX_DATABASE_PASSWORD=your_password
复制代码
#更新环境变量
#产品配置文件,设置缓存方式:redis
- #config/environments/production.rb
- #redis自行安装,根据redis所在服务器设置
- config.cache_store = :redis_cache_store, { url:"redis://0.0.0.0:6379/0/cache" }
- config.session_store = :redis_cache_store, { url:"redis://0.0.0.0:6379/0/session" }
复制代码
Gemfile是rails关键配置,具体看官方说明,以下是站群博客管理系统的配置
- gem "wordpress", github: "seadfeng/cloud_wordpress"
- gem "active_admin_role", github: "seadfeng/active_admin_role"
- gem 'redis'
- gem 'hiredis'
复制代码
Gemfile设置完后进入安装/初始化
- #!/bin/sh
- bundle install
- rails webpacker:install
- rake db:create
- rails g active_admin:install
- rails g wordpress:install
- rake db:migrate
- rake db:seed
- rake wordpress:init
- rake assets:precompile
- #启动项目
- rails s
复制代码
rails 如果能正常启动,下来就是考验nginx和systemctl功底的时候了
启动失败检测各种配置,redis不要忘了安装~
Sidekiq 指南
https://github.com/mperham/sidekiq/wiki/Getting-Started
系统依赖Sidekiq进行任务处理,务必正常安装
|
评分
-
查看全部评分
|