Skip to content
Snippets Groups Projects
Commit 664438d4 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Merge branch 'install-tutorial' into 'master'

Install tutorial

See merge request portalmec/portalmec!508
parents e2f9c7b0 ed0a3ee9
No related branches found
No related tags found
No related merge requests found
...@@ -22,39 +22,112 @@ along with portalmec. If not, see <http://www.gnu.org/licenses/>. ...@@ -22,39 +22,112 @@ along with portalmec. If not, see <http://www.gnu.org/licenses/>.
## Requirements ## Requirements
* ruby >=2.2
* rvm * rvm
* Dspace server * Using rvm you will install ruby "2.3.1"
* ruby "2.3.1"
* Dspace server "5.x"
* Postgres >=9.4 * Postgres >=9.4
* Elasticsearch * If you will install Dspace, it is recommended to use Postgres "9.4"
* Elasticsearch "5.4"
* Redis * Redis
## Postgres
After the first install, you can run this commands:
* ``` sudo passwd postgres ```
* ```su postgres```
* ``` psql -c "ALTER USER postgres WITH PASSWORD 'your_new_password'" -d template 1 ```
* ``` createuser -h localhost -U postgres -d [user_db] ```
Note: You can ask for the database dump for someone in the project.
You need to modify the file "/etc/postgresql/10/main/pg_hba.conf", the modification is
* comment all lines with "peer" and copy them replacing "peer" with "md5".
After this, run this command:
* ``` systemctl stop postgresql ```
* ``` systemctl start postgresql ```
## Rvm
After finish the installer, you will need to add in your ~/.bashrc this commands:
* ``` export PATH="$PATH:$HOME/.rvm/bin" ```
* ``` source /home/Your_user/.rvm/scripts/rvm ```
After this, run the command ```source ~/.bashrc```.
``` Note ``` : If does not work, you can try modify the commands above, for this:
* ```export PATH="$PATH:/usr/share/rvm/bin" ```
* ```source /usr/share/rvm/scripts/rvm```
## Setup ## Setup
First of all, you need configure the dspace, elasticsearch and redis servers. An user for postgres database will be needed to. First of all, you need to configure the dspace, elasticsearch and redis servers. Create an user for postgres database.
After this setup, open the config files and update some vars: After this setup, open the configuration files inside the project repository and update the following files:
* config/database.yml: change your postgres credentials for development and test environment. * 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/dspace.yml: change your dspace host and credentials for development and test environment.
* config/sidekiq.yml: change your redis hosts and ports. * 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 ) * 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
## Install
After installed the requeriments, the first you will need to do is run:
* ``` bundle install ```
This command will install all required gems for the project.
```Note ```: Sometimes some gems throw errors. That is because there is a chance that you do not have all the required dependecies for the installation of the gem that failed to install. Please install the dependencies and try again.
After all gems were installed succesfuly. Please create the database using the following commands:
* ``` rake db:create ```
* If you have the dump of the database, use it before db:migrate.
* To use the dump, run this commands: ```psql -U [database_user] -d [database_name] < dump_name.sql ```
* ``` rake db:migrate ```
``` Note ``` : You need to load the dump in the database_dev.
This procedure will create and configure all table in the project database
For the search mechanism to works, it is required to copy ``` your_directory_path/portalmec/calculate_score.painless ``` to ``` /etc/elasticsearch/scripts ```. After this is done,
execute the CMD in the portalmec directory ``` rake searchkick:reindex:all ```.
<!--### Development environment-->
<!-- Se algum dia o docker do projeto for arrumado, essa parte deve bastar como explicação -->
<!--
#### Using docker for development env #### Using docker for development env
You can use docker for your development environment. For that, run: You can use docker for your development environment. For that, run:
``` ./bin/docker-setup ``` ./bin/docker-setup
Now, redis, elasticsearch and postgres are running as services and linked to PortalMEC application. Database migrations were execute and the configs (database.yml, sidekiq.yml was replaced by config/docker/...). Now, redis, elasticsearch and postgres are running as services and linked to PortalMEC application. Database migrations were execute and the configs (database.yml, sidekiq.yml was replaced by config/docker/...).
If all development and test vars are set, run: 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:
* ```rake db:create```
This command will install the rubygems, create/reset your database schema, seed some default data and import all dspace data.-->
Once finished, your application is read to be used. To acess it, run CMD:
``` bundle exec rails s ``` ``` bundle exec rails s ```
<!--
Se a rotina de testes descrita pelo rake test for arrumada, o comando a baixo funcionara
### Running tests suite ### Running tests suite
For tests, TestUnit is used, and to run it: For tests, TestUnit is used, and to run it
``` bundle exec rake test ``` ``` bundle exec rake test ```-->
For tests, run this command:
* ``` bundle exec rake spec:acceptance ```
### Production environment ### Production environment
As you set development and test environment vars, now production vars will be needed to be set. As you set development and test environment vars, now production vars will be needed to be set.
...@@ -64,7 +137,6 @@ For that, open the file config/env_vars.sh and set them. After, run: ...@@ -64,7 +137,6 @@ For that, open the file config/env_vars.sh and set them. After, run:
* Redis vars need to be set on config/sidekiq.yml * 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') * 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: Now that your application is ready, you can run it using sames commands used in the install section.
``` ./bin/setup ```
After the setup, link your webserver to the app. Some OS services are in root of the project and can be used. After the setup, link your webserver to the app. Some OS services are in root of the project and can be used.
\ No newline at end of file
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