LasTres/CONTRIBUTING.md

3.1 KiB

Do you want to contribute?

You came to the correct place, this document will guide in the process of deploying a development version of this project.

Installing

This guide is centered on Debian 12, if you are using a different OS and do not know how to continue ask us.

Postgresql notes.

We are going to use the peer authentication that comes preconfigured in Debian, if you are using other OS you should care of pg_hba.conf to be configured as peer for empty address.

This is how it looks on the Debian I used.

You can also configure it with password if the database server is not the same host that the webserver, it is supported by the software.

local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            scram-sha-256
# IPv6 local connections:
host    all             all             ::1/128                 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256

Installing development deps

sudo apt update && \
sudo apt install git postgresql redis pwgen liblocal-lib-perl libpq-dev nodejs npm sassc

Cloning the project and preparing it.

if ! grep PERL5LIB ~/.profile; then
    perl -Mlocal::lib 2>/dev/null >> ~/.profile ;
fi && \
source ~/.profile && \
rm -fr ~/.cpan && \
( echo y && echo reload cpan && echo o conf commit ) | perl -MCPAN -Mlocal::lib -e shell && \
cd ~ && \
sudo rm -rf LasTres && \
git clone https://git.owlcode.tech/sergiotarxz/LasTres && \
cd LasTres && \
npm install && \
perl Build.PL && \
./Build installdeps && \
cat << EOF > las_tres.yml
secrets:
  - $(pwgen -s 512 1)
database:
  dbname: las_tres 
hypnotoad:
  listen:
    - http://*:3000
EOF

Setup the database

( cat << EOF
create user $(whoami);
create database "las_tres";
grant all privileges on database "las_tres" to $(whoami);
alter database "las_tres" owner to $(whoami);
EOF
) | sudo -u postgres psql

Deploying the database

cd ~/LasTres && \
perl script/install.pl

Common development steps.

Rebuilding the js.

cd ~/LasTres && \
npx webpack

Rebuilding the css

cd ~/LasTres && \
bash build_styles.sh

Starting the development server

cd ~/LasTres && \
perl -Ilib script/las_tres daemon

Create a database update

After updating the Result Classes in this file lib/LasTres/Schema.pm increment our $VERSION = plus one, after that execute the following command:

cd ~/LasTres/
perl -Ilib script/prepare.pl

Apply database updates.

cd ~/LasTres/ && \
perl -Ilib script/upgrade.pl