Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apostoldevel/apostol
Apostol is a framework for developing server-side (backend) applications.
https://github.com/apostoldevel/apostol
backend backend-development backend-server http http-server httpd httpd-server postgresql rest rest-api restful restful-api restful-webservices web-server web-service
Last synced: 5 days ago
JSON representation
Apostol is a framework for developing server-side (backend) applications.
- Host: GitHub
- URL: https://github.com/apostoldevel/apostol
- Owner: apostoldevel
- License: mit
- Created: 2019-04-06T13:22:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-11T18:44:27.000Z (8 months ago)
- Last Synced: 2024-03-11T19:58:11.709Z (8 months ago)
- Topics: backend, backend-development, backend-server, http, http-server, httpd, httpd-server, postgresql, rest, rest-api, restful, restful-api, restful-webservices, web-server, web-service
- Language: C++
- Homepage: https://apostoldevel.com
- Size: 7.49 MB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![ru](https://img.shields.io/badge/lang-ru-green.svg)](https://github.com/apostoldevel/apostol/blob/master/README.ru-RU.md)
![image](https://github.com/apostoldevel/apostol/assets/91010417/cf0b289d-185f-4852-a9a9-cd953f4a7199)
# Apostol
**Apostol** is a framework for developing server applications (system services) on the Linux OS.
DESCRIPTION
-
Apostol is developed in the C++ programming language using an asynchronous programming model based on the [epoll API](https://man7.org/linux/man-pages/man7/epoll.7.html) with direct access to the [PostgreSQL](https://www.postgresql.org/) (via the `libpq` library) specifically for high-load systems.The key element of the platform is the built-in HTTP server with direct access to the PostgreSQL DBMS.
The **uniqueness** of the solution lies in the fact that both the HTTP server and PostgreSQL sockets are within a single event processing loop, which allows data to be transmitted instantly from the HTTP server to the database. In other words, there are no intermediaries, typically represented by scripting languages, between the HTTP server and the database. This, in turn, allows database queries to be executed with maximum efficiency and minimal latency.
* The main advantages:
* **Autonomy**: After building, you get a fully ready-to-use binary file in the form of a system service (daemon) under Linux OS;
* **Speed**: Queries to the HTTP server and the database are executed as fast as the operating system and DBMS allow;
* **Connection pool**: Apostol has its own customizable connection pool with [PostgreSQL](https://www.postgresql.org/).
MODULES
-The framework has a modular design, built-in HTTP server, and [PostgreSQL](https://www.postgresql.org/) client.
### This build comes with two modules:
- [WebServer](https://github.com/apostoldevel/module-WebServer) (Web server);
* Provides the [Swagger UI](https://swagger.io/tools/swagger-ui) which will be available at [http://localhost:8080](http://localhost:8080) in your browser after launching **Apostol**.- [PGFetch](https://github.com/apostoldevel/module-PGFetch) (Postgres Fetch);
* Enables receiving and sending `HTTP requests` in the `PL/pgSQL` programming language.
### With additional modules, Apostol can be turned into:- [AuthServer](https://github.com/apostoldevel/module-AuthServer) (Authorization server OAuth 2.0);
- [AppServer](https://github.com/apostoldevel/module-AppServer) (Application server);
- [MessageServer](https://github.com/apostoldevel/process-MessageServer) (Message server: SMTP/FCM/API);
- [FileServer](https://github.com/apostoldevel/module-FileServer) (File server);
- [Replication](https://github.com/apostoldevel/process-Replication) (Database replication);
- [StreamServer](https://github.com/apostoldevel/process-StreamServer) (Streaming data server).Apostol has built-in WebSocket support: [WebSocket API](https://github.com/apostoldevel/module-WebSocketAPI).
Combining all the above, you can create an information system [CRM System](https://github.com/apostoldevel/apostol-crm), [Central system for charging points](https://github.com/apostoldevel/apostol-cs) or [Telegram bot on PL/pgSQL](https://github.com/apostoldevel/apostol-pgtg) why not ;-).
_With Apostol your possibilities are only limited by your imagination._
Projects
-Projects implemented at **Apostol**:
* [CopyFrog](https://copyfrog.ai) (AI-powered platform for creating unique images, Ad Copy, video creatives, marketing descriptions for products and services)
* [OCPP CSS](https://ocpp-css.com) (Central System as Service for Charging Points)
* [BitDeals](https://testnet.bitdeals.org) (Bitcoin payment processing service)
* [Ship Safety ERP](https://ship-safety.ru) (ERP system for organization of production activities of the shipping company)
* [PlugMe](https://plugme.ru) (CRM system for charging stations and owners of electric vehicles)
* [DEBT Master](https://debt-master.ru) (A system for automating debt collection)Docker
-You can build an image yourself or get a ready-made one from Docker Hub:
### Build
~~~
docker build -t apostol .
~~~### Get
~~~
docker pull apostoldevel/apostol
~~~
### RunIf you built it yourself:
~~~
docker run -d -p 8080:8080 -p 8081:8081 -p 5433:5432 --rm --name apostol apostol
~~~If you got a ready-made image:
~~~
docker run -d -p 8080:8080 -p 8081:8081 -p 5433:5432 --rm --name apostol apostoldevel/apostol
~~~[Swagger UI](https://github.com/swagger-api/swagger-ui) will be available at or http://host-ip:8080 in your browser.
[Pgweb](https://github.com/sosedoff/pgweb) is a web-based database explorer for PostgreSQL will be available at or http://host-ip:8081 in your browser.
> Instead of pgweb, you can use any other tool for working with databases. PostgreSQL from the container will be available on port 5433.
DIRECTORY STRUCTURE
-
auto/ contains scripts files
cmake-modules/ contains CMake modules files
conf/ contains configuration files
src/ contains source code files
├─app/ contains source code files: Apostol
├─core/ contains source code files: Apostol Core
├─lib/ contains source code files for libraries
| └─delphi/ contains source code files for the library*: Delphi classes for C++
└─modules/ contains source code files for add-ons (modules)
www/ contains files for the websiteBUILD AND INSTALLATION
-
To install **Apostol**, you will need:1. C++ compiler;
2. [CMake](https://cmake.org) or an Integrated Development Environment (IDE) with [CMake](https://cmake.org) support;
3. [libpq-dev](https://www.postgresql.org/download) library (libraries and headers for C language frontend development);
4. [postgresql-server-dev-all](https://www.postgresql.org/download) library (libraries and headers for C language backend development).### Linux (Debian/Ubuntu)
To install the C++ compiler and necessary libraries on Ubuntu, run:
~~~
sudo apt-get install build-essential libssl-dev libcurl4-openssl-dev make cmake gcc g++
~~~###### A detailed description of how to install C++, CMake, IDE, and other components required for the project build is not included in this guide.
#### PostgreSQL
To install PostgreSQL, use the instructions at [this](https://www.postgresql.org/download/) link.
#### Database
To install the database, you need to perform the following steps:
1. Specify the name of the database in the db/sql/sets.conf file (by default: web)
1. Specify the passwords for the DBMS users [libpq-pgpass](https://postgrespro.ru/docs/postgrespro/13/libpq-pgpass):
~~~
$ sudo -iu postgres -H vim .pgpass
~~~
~~~
*:*:*:http:http
~~~
1. Specify in the configuration file /etc/postgresql/{version}/main/pg_hba.conf:
~~~
# TYPE DATABASE USER ADDRESS METHOD
local web http md5
~~~
1. Apply the settings:
~~~
$ sudo pg_ctlcluster main reload
~~~
1. Execute:
~~~
$ cd db/
$ ./install.sh --make
~~~###### The --make parameter is required to install the database for the first time. After that, the installation script can be run without parameters or with the --install parameter.
To install **Apostol** (without Git), you need to:
1. Download [Apostol](https://github.com/apostoldevel/apostol/archive/master.zip);
2. Unpack it;
3. Configure CMakeLists.txt (if necessary);
4. Build and compile (see below).To install Apostol using Git, execute:
~~~
git clone https://github.com/apostoldevel/apostol.git
~~~###### Build:
~~~
cd apostol
./configure
~~~###### Compilation and installation:
~~~
cd cmake-build-release
make
sudo make install
~~~By default, the apostol binary will be installed in:
~~~
/usr/sbin
~~~The configuration file and files required for operation, depending on the installation option, will be located in:
~~~
/etc/apostol
or
~/apostol
~~~LAUNCH
-
###### If `INSTALL_AS_ROOT` is set to ON.`apostol` is a Linux system service (daemon).
To manage `apostol`, use standard service management commands.To launch `apostol`, execute:
~~~
sudo systemctl start apostol
~~~To check the status, execute:
~~~
sudo systemctl status apostol
~~~The result should be something like this:
~~~
● apostol.service - Apostol
Loaded: loaded (/etc/systemd/system/apostol.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2019-04-06 00:00:00 MSK; 3y ago
Process: 461158 ExecStartPre=/usr/bin/rm -f /run/apostol.pid (code=exited, status=0/SUCCESS)
Process: 461160 ExecStartPre=/usr/sbin/apostol -t (code=exited, status=0/SUCCESS)
Process: 461162 ExecStart=/usr/sbin/apostol (code=exited, status=0/SUCCESS)
Main PID: 461163 (apostol)
Tasks: 2 (limit: 77011)
Memory: 2.6M
CPU: 44ms
CGroup: /system.slice/apostol.service
├─461163 apostol: master process /usr/sbin/apostol
└─461164 apostol: worker process ("pq fetch", "web server")
~~~MANAGEMENT
-`apostol` can be managed using signals.
The main process number is written by default to the `/run/apostol.pid` file.
You can change the name of this file during the build configuration or in the `apostol.conf` `[daemon]` section with the `pid` key.The main process supports the following signals:
|Signal |Action |
|---------|------------------|
|TERM, INT|fast shutdown |
|QUIT |graceful shutdown |
|HUP |configuration change, launching new worker processes with new configuration, graceful shutdown of old worker processes|
|WINCH |graceful shutdown of worker processes|There is no need to manage worker processes individually. Nevertheless, they also support some signals:
|Signal |Action |
|---------|------------------|
|TERM, INT|fast shutdown |
|QUIT |graceful shutdown |