Portal MEC
License
Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre Departamento de Informatica - Universidade Federal do Parana
This file is part of portalmec.
portalmec is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
portalmec is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with portalmec. If not, see http://www.gnu.org/licenses/.
Setup with Docker Compose
Requirements
docker >= 20.10.5
git
- ElasticSearch instance
- PostgreSQL
Steps
(Dependending in your docker version, you may need to use docker-compose
instead of docker compose
)
-
Clone the repository.
-
In the root of the repository run
docker compose build
. This will build the necessary images for running PortalMEC. If this command fails, check if you are behind a HTTP Proxy. If that's the case, clean any built images withdocker compose down --rmi all --remove-orphans
and then use-
docker compose build --build-arg HTTP_PROXY="<http proxy url here> --build-arg HTTPS_PROXY="<https proxy url here>"
.
-
-
Make a copy of the
.env.dev
file named.env
and change the necessary configuration. You will need to change at least:PORTALMEC_DB_HOST
PORTALMEC_DB_NAME
PORTALMEC_DB_USERNAME
PORTALMEC_DB_PASSWORD
PORTALMEC_ELASTICSEARCH_HOST
PORTALMEC_ELASTICSEARCH_LOGIN
PORTALMEC_ELASTICSEARCH_PASSWORD
PORTALMEC_ELASTICSEARCH_INDEX_PREFIX
RAILS_ENV
-
This step is only needed if you don't have a database. Run
docker compose run --entrypoint sh app
. This will instantiate a container from theapp
image built in the previous step and run a shell inside it. In the new shell:- Run
bundle exec rake db:create
to create the database.- If you have a database dump, you should use it now. Run in the host:
psql -U <database user> -d <database name> < <dump name>.sql
- If you have a database dump, you should use it now. Run in the host:
- Run
bundle exec rake db:migrate
to create the database schema. - Run
bundle exec rake db:seed
to populate the database with default data. - Run
bundle exec rake searchkick:reindex:all
to index the data in ElasticSearch. - Run
exit
to exit the shell.
- Run
-
Run
docker compose up
.
Local specific configuration
The URL host.docker.internal
inside a docker container is configured to point to the host machine. When you need to use a service running in the host machine (for example a local PostgresSQL installation), you should use this address instead of localhost
.
Old Setup
Requirements
- rvm
- Using rvm you will install ruby "3.0.1"
- ruby "3.0.1"
- Dspace server "6.x"
- Postgres "13"
- Elasticsearch "6.8.13"
- Redis ">=5.0"
- nvm
- Using nvm you will install Node.js "14.15.1"
NVM and Node.js
For install NVM and Node.js, use this follwing commands:
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
$ nvm install 14.15.1
Postgres
After the first install, you can run this commands:
sudo passwd postgres
su postgres
psql -c "ALTER USER postgres WITH PASSWORD '$PASSWORD'" -d template1
createuser -h localhost -U postgres -d $USER_DB
psql -c "ALTER USER $USER_DB WITH PASSWORD '$PASSWORD'" -d template1
Note: You can ask for the database dump for someone in the project.
You need to modify the file "/etc/postgresql/11/main/pg_hba.conf", the modification is
* comment the 1st and 2nd lines with "peer" and copy them replacing "peer" with "md5".
After this, run this command:
systemctl restart postgresql