Adding development docs.

This commit is contained in:
Sergiotarxz 2023-06-30 21:18:30 +02:00
parent 01a098d926
commit 136b2e4940
2 changed files with 148 additions and 1 deletions

137
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,137 @@
# 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
```shell
sudo apt update && \
sudo apt install git postgresql redis pwgen liblocal-lib-perl libpq-dev nodejs npm sassc
```
### Cloning the project and preparing it.
```shell
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
```shell
( 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
```shell
cd ~/LasTres && \
perl script/install.pl
```
## Common development steps.
### Rebuilding the js.
```shell
cd ~/LasTres && \
npx webpack
```
### Rebuilding the css
```shell
cd ~/LasTres && \
bash build_styles.sh
```
### Starting the development server
```shell
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:
```shell
cd ~/LasTres/
perl -Ilib script/prepare.pl
```
### Apply database updates.
```shell
cd ~/LasTres/ && \
perl -Ilib script/upgrade.pl
```

View File

@ -1,5 +1,15 @@
# LasTres
## Contributing
Do you know Perl, Typescript, SCSS or React an want
to get the best of this progran.
You can contribute and make your dreams for
this game real.
[Contributing guide](CONTRIBUTING.md).
## Installation instructions. (Prod)
This is an example, you can configure the server
@ -221,10 +231,10 @@ EOF
```shell
sudo -u las_tres bash -c "$( cat << EOF
source ~/.profile && \
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 ~/LasTres && \