Skip to content
Snippets Groups Projects
Commit 224e2e02 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

improve readme with deploy steps by env

parent 1075fa5c
No related branches found
No related tags found
No related merge requests found
# Portal MEC # Portal MEC
[![build status](https://ci.gitlab.c3sl.ufpr.br/projects/19/status.png?ref=master)](https://ci.gitlab.c3sl.ufpr.br/projects/19?ref=master)
## Requirements ## Requirements
* ruby >=2.2 * ruby >=2.2
* rvm * rvm
* Dspace server, with solr access allowed * Dspace server
* Postgres * Postgres >=9.4
* OrientDB * Elasticsearch
* Redis
## Setup ## Setup
To setup the rails app, will be needed run active record migrations, First of all, you need configure the dspace, elasticsearch and redis servers. An user for postgres database will be needed to.
orient db migrations and populate active record database: After this setup, open the config files and update some vars:
* config/database.yml: change your postgres credentials for development and test environment.
* config/dspace.yml: change your dspace host and credentials for development and test environment.
* config/sidekiq.yml: change your redis hosts and ports.
* config/initializers/gitlab.rb: change your gitlab host for bug reports and set env var with private token. ( $ export GITLAB_PORTALMEC_PRIVATE_TOKEN=131237128937128937 )
### Development environment
If all development and test vars are set, run:
``` ./bin/setup ```
This command will install the rubygems, create/reset your database schema, seed some default data and import all dspace data.
After this, your application is ready to use and you can access it with:
``` bundle exec rails s ```
### Test environment
For tests, TestUnit is used, and to run it:
``` bundle exec rake test ```
### Production environment
As you set development and test environment vars, now production vars will be needed to be set.
For that, open the file config/env_vars.sh and set them. After, run:
``` ./config/env_vars.sh ```
* Redis vars need to be set on config/sidekiq.yml
* In config/initializers/devise.rb, change the emails addresses. (Ex.: config.mailer_sender = 'suporte@c3sl.ufpr.br')
Now, you can run and your application is ready to use:
``` ./bin/setup ``` ``` ./bin/setup ```
## Definitions After the setup, link your webserver to the app. Some OS services are in root of the project and can be used.
Some definitions and vocabulary of project domain model. \ No newline at end of file
## Deploy
Before deploy to production server, some env vars need be set:
### Application Secrets
The command 'rake secret' can be used for generate random string
* SECRET_TOKEN
* SECRET_KEY_BASE
### Postgres/Active Record credentials
* PORTALMEC_DB_NAME
* PORTALMEC_DB_USERNAME
* PORTALMEC_DB_PASSWORD
### OrientDB credentials
* PORTALMEC_ORIENTDB_HOST
* PORTALMEC_ORIENTDB_DATABASE
* PORTALMEC_ORIENTDB_USERNAME
* PORTALMEC_ORIENTDB_PASSWD
* PORTALMEC_ORIENTDB_PORT
### Dspace credentials
* PORTALMEC_DSPACE_SOLR
* PORTALMEC_DSPACE_REST
* PORTALMEC_DSPACE_PORT
* PORTALMEC_DSPACE_HOST
### Rails environment
* RAILS_SERVE_STATIC_FILES - default is FALSE
* RAILS_ENV: production, test or development
Run:
```
$ mina setup
$ mina deploy
```
\ No newline at end of file
...@@ -10,16 +10,16 @@ Dir.chdir APP_ROOT do ...@@ -10,16 +10,16 @@ Dir.chdir APP_ROOT do
puts "== Installing dependencies ==" puts "== Installing dependencies =="
system "gem install bundler --conservative" system "gem install bundler --conservative"
system "bundle check || bundle install" system "bundle check || bundle install --jobs $(nproc)"
# puts "\n== Copying sample files ==" puts "\n== Checks database config file =="
# unless File.exist?("config/database.yml") unless File.exist?("config/database.yml")
# system "cp config/database.yml.sample config/database.yml" puts "\n You need create config/database.yml. Please follow our README"
# end exit
end
puts "\n== Preparing databases ==" puts "\n== Preparing databases, importing data and setup PortalMEC =="
system "bin/rake db:setup" system "bundle exec rake portalmec:setup"
system "bin/rake orientdb:migrate"
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*" system "rm -f log/*"
......
default: &defaults
adapter: postgresql
encoding: unicode
pool: 5
development: &development
<<: *defaults
database: portalmec_dev
username:
password:
test:
<<: *defaults
host: localhost
database: <%= ENV['POSTGRES_DB'] %>
username: <%= ENV['POSTGRES_USER'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>
production:
<<: *defaults
host: <%= ENV['PORTALMEC_DB_HOST'] %>
database: <%= ENV['PORTALMEC_DB_NAME'] %>
username: <%= ENV['PORTALMEC_DB_USERNAME'] %>
password: <%= ENV['PORTALMEC_DB_PASSWORD'] %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment