Magpie backend
Go to file
2024-11-08 13:36:48 +03:00
cmake task manager, license formatting 2023-12-30 19:42:11 -03:00
database update delete and list transaction requests 2024-04-17 18:37:15 -03:00
handler update delete and list transaction requests 2024-04-17 18:37:15 -03:00
request some ideas of updates delivery 2024-01-13 20:57:42 -03:00
response debug, deleting assets 2024-01-21 16:23:48 -03:00
server update delete and list transaction requests 2024-04-17 18:37:15 -03:00
stream task manager, license formatting 2023-12-30 19:42:11 -03:00
taskmanager scheduler canceling, sessiion query, didn't test yet! 2024-01-03 19:20:01 -03:00
utils some ideas about database structure, began assets fetching request 2024-01-11 18:33:46 -03:00
CMakeLists.txt task manager, license formatting 2023-12-30 19:42:11 -03:00
config.h.in task manager, license formatting 2023-12-30 19:42:11 -03:00
CONTRIBUTORS.md licensed, a bit better file handling, a bit better migration handling 2023-12-10 20:23:15 -03:00
default.conf add default.conf 2024-11-08 13:30:53 +03:00
LICENSE.md licensed, a bit better file handling, a bit better migration handling 2023-12-10 20:23:15 -03:00
main.cpp task manager, license formatting 2023-12-30 19:42:11 -03:00
README.md first what so ever registration 2023-12-20 19:42:13 -03:00
run.sh.in Small fixes, update asset method 2024-04-07 20:03:10 -03:00

Pica - Backend for Megpie budgeting app

... some description

Prerequisites

  • fcgi
  • nlohmann_json
  • mariadb-client
  • argon2

Building

$ git clone https://git.macaw.me/blue/pica
$ cd pica
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .

Usage

Webserver

First you need a webserver. In this example I'm going to use apache.

Install apache (apache2, httpd) from your package manager.

Create a file like this in apache config dir (in my case it's /etc/httpd/conf/extra/fcgi-pica.conf)

<Location /pica>
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
        Header set Access-Control-Allow-Headers: "*"
    </IfModule>

    ProxyPass "unix:/run/pica/pica.sock|fcgi://localhost"
    ProxyPassReverse "http://localhost"
</Location>

Incude this file from apache config file (in my case it's /etc/httpd/conf/httpd.conf)

Include conf/extra/fcgi-pica.conf

Also you need to have 3 modules enabled:

  • proxy
  • proxy_fcgi
  • headers

Usually you need to uncomment following lines in /etc/httpd/conf/httpd.conf

LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

In case you use debian-like distro (ubuntu) you should use a2enmod command instead:

# a2enmod proxy_fcgi

This should enable all modules, because module proxy_fcgi has module proxy as a dependency, and headers are supposed to be enabled.

Start apache

$ sudo systemctl start httpd

Database

You're also goint to need a database server. For now only MySQL/Mariadb is supported. I'm going to use Mariadb as an example.

First - install mariadb (the server!). Set it up, edit config, run whatever it asks you to run on installation. Making configurations, make sure it creates a unix socket at /run/mysqld/mysqld.sock and user running pica has permissions to write to this socket! By default it does, so, you're probably okay with default configuration.

Next you need to login to mariadb database server, usually it's done like so:

$ mariadb -u root -p

It will query your password, and then you should see mariadb propt. There you need to execute following commands:

CREATE DATABASE pica;
CREATE USER 'pica'@'localhost' IDENTIFIED BY 'pica';
GRANT ALL PRIVILEGES ON pica.* TO 'pica'@'localhost';
FLUSH PRIVILEGES;

Flushing privileges is not really needed, but it's typicaly written. After that just quit mariadb with quit; command.

Creating a directory

Next you need to create a directory for pica socket file

# mkdir /run/pica
# chown <your user> /run/pica

Running an app

At this stage we're redy to run an app

$ cd build
$ ./pica