pica/README.md
2023-11-29 20:25:12 -03:00

73 lines
1.5 KiB
Markdown

# Pica - Backend for Megpie budgeting app
... some description
### Prerequisites
- fcgi
- nlohmann_json
### 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 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>
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 2 modules enabled `proxy` and `proxy_fcgi`, usually you need to uncomment following lines in `/etc/httpd/conf/httpd.conf`
```
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 both modules, because module `proxy_fcgi` has module `proxy` as a dependency.
Start apache
```
$ sudo systemctl start httpd
```
#### 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
```