Skip to content

Explained Quick install for development

João Felipe N. Pimentel edited this page Sep 1, 2023 · 10 revisions

Development Environment Quick Setup

This is a simple and fast guide to correctly set the environment to get you going with our platform, so you can develop and contribute.

Remember that this guide will help you to set a development environment. The production environment setup requires a little more care. Its guide can be found here.

You shall move on to other guides and/or tutorials, if you want to know the features of our platform, as soon as you finish this guide.

With no further delay, let us proceed!

Summary

Requirements

To make this tutorial quick, we'll assume that you already have Ruby 3.2.x installed on your machine. We also assume you have wget.

Make sure you're using Ruby's correct version.

With that said, we can proceed smoothly. :)

Configuration

First of all, clone the project by opening the terminal:

$ git clone git@github.com:gems-uff/sapos.git

Then, as the majority of Ruby projects, right after creating a new Rails project, we'll execute:

$ bundle install --without staging production

This command will analise the file Gemfile.lock and install the dependencies of the project. The flag --without just tell what environment(s) shall not have its dependencies installed.

We are almost there! Now we need to make Rails generate the database stuff and, then, we are ready to go.

Notice that the database setup is already preset to use SQLite. If you ant to use any other database engine you may want to check out the FAQ.

Now, to generate the database structure, execute the following command on terminal:

$ rake db:setup

The rake db:setup will create the database of the current environment, creating all the required tables, and then run the db/seed.rb file to insert default data on the database.

With this, the database should be successfully generated, and you should be ready to go!

Execute the following line on your terminal:

$ rails server

This will start a server at a default port (which is, generally, 3000), allowing you to access your web application.

Then, all you have to do is access localhost:3000, sign in using admin@change.me user and admin password, and enjoy the application.

Reminder: Go to Configurations and change the email and password of the user admin@change.me after signing in. See SAPOS User Guide for more details on how to do this.

If you want to test the Notifications feature of SAPOS, you will also need to follow two steps:

  1. Log into SAPOS, go to Configurações, and then Variáveis. Add a variable named redirect_email. As the value of this variable, insert an email address that will receive the notifications (if you do not do this, notifications will be sent to their real destinations, which is probably not desirable during development).

  2. Create a cron file that will check whether there are pending notifications to be sent. The file should be named /etc/cron.daily/sapos and have the following content:

#!/bin/sh
wget --spider --no-check-certificate --quiet https://www.foo.com/sapos/notifications/notify

Remember to replace www.foo.com by your server domain.

Then, add execute permission to the file and make sure it is owned by the root user:

$ cd /etc/cron.daily
$ chmod 700 sapos
$ chown root:root sapos

Clone this wiki locally