new: add docker and compose files

This commit is contained in:
ngn 2024-07-20 01:52:52 +03:00
parent 8332d9f941
commit 6d175d34d8
8 changed files with 52 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
./config.ini
data
*.pot
*.mo
dist

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM libmp as build
RUN apt update
RUN apt install -y make gcc gettext libinih-dev libsqlite3-dev libarchive-dev
WORKDIR /root
COPY ./Makefile ./
COPY ./install ./install
COPY ./locale ./locale
COPY ./src ./src
RUN make
RUN make install
FROM libmp as main
RUN apt update
RUN apt install -y dumb-init
RUN mkdir -pv /var/lib/pooler
# translations
COPY --from=build /usr/share/locale/tr/LC_MESSAGES/pooler.mo /usr/share/locale/tr/LC_MESSAGES/pooler.mo
# binary and the configuration
COPY --from=build /etc/pooler/config.ini /etc/pooler/config.ini
COPY --from=build /usr/bin/pooler /usr/bin/pooler
ENTRYPOINT ["dumb-init", "/usr/bin/pooler", "/etc/pooler/config.ini"]

View File

@ -57,7 +57,6 @@ uninstall:
rm $(DESTDIR)/$(PREFIX)/share/$$po/pooler.mo ; \
done
format:
clang-format -i -style=file src/*.c src/*.h

View File

@ -34,6 +34,12 @@ You can also build the program using docker:
docker build --tag pooler .
```
And for deployment you can use docker-compose, just make sure you read the compose file
and place the configuration file and the pools to the right place:
```bash
docker-compose up -d
```
### Usage
To start a serving pools, specify a configuration file, default configuration file is
installed in the `/etc/pooler` directory:

12
docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
version: "3"
services:
pooler:
build:
context: ./
ports:
- "5858:5858/udp"
volumes:
- "./config.ini:/etc/pooler/config.ini"
- "./data:/var/lib/pooler"

View File

@ -1,7 +1,7 @@
# default pooler configuration, please see the wiki page for more information
# https://matterlinux.xyz/wiki/pooler
log = /var/lib/pooler/pooler.log
# log = /var/lib/pooler/pooler.log
dir = /var/lib/pooler
addr = 0.0.0.0:5858

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-18 19:32+0300\n"
"POT-Creation-Date: 2024-07-20 01:23+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -122,7 +122,7 @@ int main(int argc, char *argv[]) {
goto end;
if ((logfile = config_get_string("log")) != NULL) {
FILE *log = fopen(logfile, "r");
FILE *log = fopen(logfile, "a");
if (NULL == log)
error(_("Failed to open the log file: %s"), strerror(errno));