Cool but simple web-app mobile-compatible to gamify your life and self-improvement https://lifepex.sceptique.eu/
Go to file
Arthur POULET e3377979ed
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
logout: change method from GET to POST
closes #35
2021-06-26 14:43:18 +02:00
config Improve registering new users with default value and redirection to today 2021-06-01 20:08:04 +02:00
documentation doc: add a french user guide 2021-06-12 13:14:51 +02:00
init readme: clarify everything in the doc 2021-06-23 19:50:35 +02:00
public recap: disable the line 'total' by default 2021-06-26 12:13:57 +02:00
scripts other: minor script & ci update 2021-06-24 22:24:01 +02:00
src logout: change method from GET to POST 2021-06-26 14:43:18 +02:00
test user_pex: add user pex json api with tests 2021-06-22 23:51:38 +02:00
.drone.yml other: minor script & ci update 2021-06-24 22:24:01 +02:00
.env.sample userpex: improve error and fix test databases 2021-06-24 22:10:58 +02:00
.gitignore boot: add dotenv to load env variables 2021-06-23 19:30:23 +02:00
Gemfile boot: add dotenv to load env variables 2021-06-23 19:30:23 +02:00
Gemfile.lock boot: add dotenv to load env variables 2021-06-23 19:30:23 +02:00
README.md readme: fix readme 2021-06-25 08:45:30 +02:00
Rakefile test: Add basic test framework and POC 2021-06-19 18:18:25 +02:00
config.ru user_pex: add user pex json api with tests 2021-06-22 23:51:38 +02:00

README.md

LifePex

Build Status

Install the software on a server

Install the dependencies

You should have the following systems installed: git ruby 3 AND gems sqlite OR postgresql Git is required to clone the project and fetch the tags in order to expose them in the webapp.

Then make sure you have installed bundler gem install bundler if not already done.

Then install the ruby dependencies.

bundle install

Configuration setup

A sample file contains all the variables you will need in order to start the server. This is the .env.sample file. You should copy it under the name .env.local.

  • LIFEPEX_DB: is an url to your database. It may include a user/password
  • LIFEPEX_BIND: what your socket will listen to (should probably be 127.0.0.1 or 0.0.0.0)
  • LIFEPEX_BASE_URL: base url for the whole app (for local usage you can leave if empty)
  • LIFEPEX_SECRET: you must put randomness in this variable to secure tokens and cookies
  • LIFEPEX_ENV: may be empty, test, or production to avoid showing the stacktrace when there is a bug

Database setup

The recommanded way is simply to init the database you configured with

./init/database.rb

If you have postgresql, you may want to create a specific user/password for this. Since I suck with SGDB administration, this is a sample of what you may do.

TODO: show how to create a simple attribute with full permission on this database

psql -U postgres postgres -c "CREATE USER root WITH PASSWORD 'toor' SUPERUSER;"
psql -U postgres postgres -c "CREATE DATABASE life_pex"
echo LIFEPEX_DB=postgres://root:toor@localhost/life_pex >> .env.local
./init/database.rb

Start

  • configuration: check
  • setup dependencies: check
  • setup database: check

You can simply start the application.

./src/app.rb

Service, update, etc.

You may want to take a look at the scripts/ directory which contains tons of config helper, for nginx, systemd, etc.


recap image today image

Developers

Generate documentation

./init/doc.rb
xdg-open ./public/doc/index.html

Testing

Generate first a specific configuration file

cp .env.local .env.test.local
editor .env.test.local # don't forget to set a new database !!!

Then init the database

LIFEPEX_ENV=test ./init/database.rb

Then if you want to run the test, simply type rake test (you will need the startup env variable to be set first).