Advertisement
erlantostes

Untitled

Oct 31st, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. Instalação de sistema desenvolvido em ruby no ambiente de produção
  2.  
  3. 1. Liberar execucao no home:
  4.  
  5. mount -o remount,rw,exec /tmp
  6.  
  7. 2. Instalar dependencias
  8.  
  9. sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake libpq-dev git
  10.  
  11. 3. Instalar o RVM
  12.  
  13. curl -sSL https://get.rvm.io | bash
  14. source /home/suez/.rvm/scripts/rvm
  15.  
  16. 4. Configurar variaveis de ambiente git
  17.  
  18. sudo nano ~/.bash_profile
  19.  
  20. Inserir na ultima linha: export GIT_SSL_NO_VERIFY=1
  21.  
  22. source ~/.bash_profile
  23.  
  24. 5. Clonar a aplicacao no /home/suez
  25.  
  26. git clone https://gitlab.ifb.edu.br/cdds-ifb/jifb.git
  27.  
  28. 6. Mover a aplicacao para /opt
  29.  
  30. sudo mv jifb /opt
  31.  
  32. 7. Instalar passenger
  33.  
  34. - Seguir instrucoes do site: https://www.phusionpassenger.com/library/install/nginx/install/oss/stretch/
  35.  
  36. 8. Configuracao nginx
  37.  
  38. Criar arquivo /etc/nginx/sites-available/jifb.hom.ifb.local
  39. server {
  40.  
  41. listen 80;
  42. server_name jifb.hom.ifb.local;
  43. passenger_enabled on;
  44. root /opt/jifb/public;
  45.  
  46. }
  47.  
  48. sudo ln -s /etc/nginx/sites-available/jifb.hom.ifb.local /etc/nginx/sites-enabled/jifb.hom.ifb.local
  49.  
  50. 9. Configurar gems da aplicacao
  51.  
  52. - Criar o arquivo config/setup_load_paths.rb
  53. if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
  54.  
  55. begin
  56.  
  57. gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')
  58. ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global"
  59. require 'rvm'
  60. RVM.use_from_path! File.dirname(File.dirname(FILE))
  61. rescue LoadError
  62. raise "RVM gem is currently unavailable."
  63.  
  64. end
  65.  
  66. end
  67.  
  68. If you're not using Bundler at all, remove lines bellow
  69. ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(FILE))
  70. require 'bundler/setup'
  71.  
  72. - Criar o arquivo .ruby-version com o codigo: 2.3.1
  73.  
  74. - Criar o arquivo .ruby-gemset com o codigo: jifb
  75.  
  76. - Instalar o ruby 2.3.1:
  77. rvm install 2.3.1
  78.  
  79. - Sair e entrar na pasta do projeto:
  80. cd .
  81.  
  82. - Instalar as gems:
  83. gem install bundler
  84. bundle install
  85.  
  86. 10. Criar o arquivo config/database.yml
  87.  
  88. production:
  89.  
  90. adapter: postgresql
  91. database: jifb
  92. host: 10.6.2.18
  93. username: root
  94. password: ***
  95. encoding: utf8
  96. port: 5432
  97.  
  98. 11. Configurar chave secreta da aplicacao:
  99.  
  100. RAILS_ENV=production rake secret # para gerar a chave
  101.  
  102. - Editar arquivo ~/.bash_profile
  103.  
  104. export SECRET_KEY_BASE=<colar chave gerada>
  105.  
  106. 12. Configurar a aplicacao:
  107.  
  108. RAILS_ENV=production rake db:create && RAILS_ENV=production rake db:migrate && RAILS_ENV=production rake assets:precompile && sudo /etc/init.d/nginx restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement