rails 部署服务器
安装rvm 和 ruby
sudo apt-get update sudo apt-get install curl \curl -sSL https://get.rvm.io | bash rvm use --install --default 2.1.2
安装postgreSQL
sudo apt-get install postgresql libpq-dev postgresql-contrib sudo gem install pg --no-ri --no-rdoc sudo -u postgres psql -d template1 -c "ALTER USER postgres WITH PASSWORD ‘your_new_password‘;" sudo -u postgres createdb your_database_name
安装passenger + nginX
sudo gem install bundler passenger --no-ri --no-rdoc sudo passenger-install-nginx-module wget -O init-deb.sh http://www.linode.com/docs/assets/1139-init-deb.sh sudo mv init-deb.sh /etc/init.d/nginx sudo chmod +x /etc/init.d/nginx sudo /usr/sbin/update-rc.d -f nginx defaults
添加部署账号deploy
//服务器端useradd -d /home/deploy -m deployadduser deploy sudo passwd deploy //本机, ssh免密码登陆 cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
相关项目路径配置
deploy_to=/usr/local/www/rails mkdir -p ${deploy_to} mkdir ${deploy_to}/{release,shared} chown deploy:deploy ${deploy_to} chmod g+s ${deploy_to}
如果使用figaro,需要配置application.yml, (在deploy_to下)
mkdir config vi config/application.yml
时间: 2024-10-13 20:02:34