Skip to content

Installation Guide

Lucas Fernando edited this page May 15, 2023 · 19 revisions

This guide will help you configure and run cdms locally on your computer.

1. Requirements

Firstly install the following applications:

Note: Commands started with $ are executed on terminal without super user (sudo).

2. Create workspace folder:

Use the commands below to create and access the new folder:

$ mkdir workspace
$ cd workspace

3. Clone the project

Note: If you intend to contribute to this project, consider follow Setup your Repository guide. If your intent is just run the application, follow the steps below.

If you have ssh set up with git, to clone the cdms project run:

$ git clone git@github.com:MarczalTSIGP/cdms.git

otherwise

$ git clone https://github.com/MarczalTSIGP/cdms.git

4. Access the project folder

Access the cdms folder:

$ cd cdms

Note: If you have Ruby installed locally, you may see the following message bellow at this point. However, since the application will run in containers, you do not need to worry about this warning. You can simply ignore it and continue with the installation guide.

RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /home/linux/workspace/cdms/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

Unknown ruby interpreter version (do not know how to handle): ~>3.2.

5. Build the containers

Before you continue, make sure the Docker is running.

If you are on Mac OS or WLS2:

$ docker build .

If you are on Linux:

$ docker build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) .

Note: The command above ensures that the user who builds the container has the same user and group IDs as the user who is building the image.

6. Setup env variables

Create a file "application.yml" using the example "application.yml.example":

$ cp config/application.yml.example config/application.yml

If necessary, change username, password and host from database settings.
By default, it will work with no changes.

7. Setup mailer (Optional)

In this project is used the mailtrap.io to send emails.

In "config/application.yml" is necessary setup your USERNAME and PASSWORD with your personal mailtrap account data.

mailer.from: 'email@email.com'
mailer.smtp: 'smtp.mailtrap.io'
mailer.smtp.port: '2525'
mailer.smtp.domain: 'smtp.mailtrap.io'
mailer.smtp.username: 'USERNAME'
mailer.smtp.password: 'PASSWORD'
mailer.smtp.authentication: 'cram_md5'

8. Install dependencies

Ruby Gems: To download and install ruby gems dependencies run:

$ docker compose run --rm web bundle install

Yarn: To download and install node dependencies run:

$ docker compose run --rm web yarn install

9. Create database

To create the cdms database run:

$ docker compose run --rm web bundle exec rails db:create

10. Run Migrations

To create the tables schema on cdms database run:

$ docker compose run --rm web bundle exec rails db:migrate

11. Run Seed

To populate the application with required and defaults values:

$ docker compose run --rm web bundle exec rails db:seed

10. Up the container web

$ docker compose up -d web

11. Access the application

In your browser access localhost through the port :3000

12. Login in the application

To finish this installation guide, perform a login on the application using the following credentials:

username: admin@utfpr.edu.br
password: 123456

If all work's as expected, you should be redirected to application Dashboard.

Before start developing

To improve your knowledge about the application we strongly recommend you to read the Tips and Hints.

To contribute to the App

If you are interest to contribute for this project, please access Contribute to the App.