Compare commits

5 Commits

Author SHA1 Message Date
ngn
8d018ecfce update: add image name to compose file 2024-08-11 22:33:55 +03:00
ngn
bb701c46dd update: move compose file to the README 2024-08-11 01:10:51 +03:00
ngn
a93feb77d0 new: add pool path option 2024-08-10 23:56:33 +03:00
ngn
9f18a78aa0 fix: add config.ini to gitignore 2024-08-09 03:39:19 +03:00
ngn
ab91344b5f update: add signal handler to serve funtion 2024-08-08 15:43:17 +03:00
7 changed files with 48 additions and 29 deletions

5
.gitignore vendored
View File

@ -1,4 +1,7 @@
./config.ini config.ini
!install/config.ini
docker-compose.yml
compose.yml
*.pot *.pot
*.mo *.mo
dist dist

View File

@ -34,8 +34,22 @@ You can also build the program using docker:
docker build --tag pooler . docker build --tag pooler .
``` ```
And for deployment you can use docker-compose, just make sure you read the compose file And for deployment you can use docker-compose, here is an example configuration:
and place the configuration file and the pools to the right place: ```yaml
version: "3"
services:
pooler:
image: pooler
build:
context: ./
ports:
- "5858:5858/tcp"
volumes:
- "./config.ini:/etc/pooler/config.ini"
```
Just make sure you read the compose file and place the configuration file and the pools
to the right place:
```bash ```bash
docker-compose up -d docker-compose up -d
``` ```

View File

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

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-07 01:48+0300\n" "POT-Creation-Date: 2024-08-10 23:56+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,27 +17,27 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: src/config.c:125 #: src/config.c:130
#, c-format #, c-format
msgid "Unknown configuration option: %s" msgid "Unknown configuration option: %s"
msgstr "" msgstr ""
#: src/config.c:127 #: src/config.c:132
#, c-format #, c-format
msgid "Unknown configuration option: %s/%s" msgid "Unknown configuration option: %s/%s"
msgstr "" msgstr ""
#: src/config.c:135 #: src/config.c:140
#, fuzzy, c-format #, fuzzy, c-format
msgid "Failed to access the configuration file: %s" msgid "Failed to access the configuration file: %s"
msgstr "Kayıt dosyasını açmak başarısız oldu: %s" msgstr "Kayıt dosyasını açmak başarısız oldu: %s"
#: src/config.c:140 #: src/config.c:145
#, fuzzy #, fuzzy
msgid "Failed to parse the configuration" msgid "Failed to parse the configuration"
msgstr "Kayıt dosyasını açmak başarısız oldu: %s" msgstr "Kayıt dosyasını açmak başarısız oldu: %s"
#: src/config.c:147 #: src/config.c:152
#, fuzzy, c-format #, fuzzy, c-format
msgid "Hostname not specified for the pool: %s" msgid "Hostname not specified for the pool: %s"
msgstr "Ana makine adı havuz konfigürasyonunda belirtilmedi, geçiliyor: %s" msgstr "Ana makine adı havuz konfigürasyonunda belirtilmedi, geçiliyor: %s"
@ -118,37 +118,37 @@ msgstr "%s: havuz bilgisi başarıyla yüklendi"
msgid "%s: hostname not specified for pool, skipping" msgid "%s: hostname not specified for pool, skipping"
msgstr "Ana makine adı havuz konfigürasyonunda belirtilmedi, geçiliyor: %s" msgstr "Ana makine adı havuz konfigürasyonunda belirtilmedi, geçiliyor: %s"
#: src/main.c:157 #: src/main.c:163
#, fuzzy, c-format #, fuzzy, c-format
msgid "%s: failed access the pool directory (%s)" msgid "%s: failed access the pool directory (%s)"
msgstr "Havuz dizinine erişilemiyor: %s" msgstr "Havuz dizinine erişilemiyor: %s"
#: src/main.c:162 #: src/main.c:168
#, fuzzy, c-format #, fuzzy, c-format
msgid "%s: failed to add pool to the list (%s)" msgid "%s: failed to add pool to the list (%s)"
msgstr "Havuzu listeye eklemek başarısız oldu: %s" msgstr "Havuzu listeye eklemek başarısız oldu: %s"
#: src/main.c:170 #: src/main.c:176
#, c-format #, c-format
msgid "Failed to sync the pools: %s" msgid "Failed to sync the pools: %s"
msgstr "Havuzları sekronize etmek başarısız oldu: %s" msgstr "Havuzları sekronize etmek başarısız oldu: %s"
#: src/main.c:175 #: src/main.c:181
#, fuzzy #, fuzzy
msgid "None of the pools is available for serving" msgid "None of the pools is available for serving"
msgstr "Havuzların hiçbiri sunmak için müsait değil" msgstr "Havuzların hiçbiri sunmak için müsait değil"
#: src/main.c:179 #: src/main.c:185
#, c-format #, c-format
msgid "Serving %lu pool on %s" msgid "Serving %lu pool on %s"
msgstr "%lu tane havuz %s adresinde sunuluyor" msgstr "%lu tane havuz %s adresinde sunuluyor"
#: src/main.c:179 #: src/main.c:185
#, c-format #, c-format
msgid "Serving %lu pools on %s" msgid "Serving %lu pools on %s"
msgstr "%lu tane havuz %s adresinde sunuluyor" msgstr "%lu tane havuz %s adresinde sunuluyor"
#: src/main.c:182 #: src/main.c:188
#, c-format #, c-format
msgid "Failed to start the server: %s" msgid "Failed to start the server: %s"
msgstr "Sunucuyu başlatmak başarısız oldu: %s" msgstr "Sunucuyu başlatmak başarısız oldu: %s"

View File

@ -110,6 +110,11 @@ int config_load_handler(void *data, const char *_section, const char *_key, cons
config.pools->host = strdup(value); config.pools->host = strdup(value);
} }
else if (eq(key, "path")) {
free(config.pools->path);
config.pools->path = strdup(value);
}
else if (eq(key, "dir")) { else if (eq(key, "dir")) {
free(config.pools->dir); free(config.pools->dir);
config.pools->dir = strdup(value); config.pools->dir = strdup(value);

View File

@ -23,6 +23,7 @@ typedef struct pool_config {
struct pool_config *next; struct pool_config *next;
char *name; char *name;
char *host; char *host;
char *path;
char *dir; char *dir;
} pool_config_t; } pool_config_t;

View File

@ -150,8 +150,14 @@ int main(int argc, char *argv[]) {
goto end_ctx; goto end_ctx;
} }
char url[strlen(pool->host) + 20]; char url[strlen(pool->host) + 20 + (pool->path == NULL ? 0 : strlen(pool->path))];
sprintf(url, "mptp://%s", pool->host);
if (NULL == pool->path)
sprintf(url, "mptp://%s/", pool->host);
else if (pool->path[0] == '/')
sprintf(url, "mptp://%s%s", pool->host, pool->path);
else
sprintf(url, "mptp://%s/%s", pool->host, pool->path);
if (!file_canread(pool->dir)) { if (!file_canread(pool->dir)) {
error(_("%s: failed access the pool directory (%s)"), pool->name, pool->dir); error(_("%s: failed access the pool directory (%s)"), pool->name, pool->dir);
@ -178,7 +184,7 @@ int main(int argc, char *argv[]) {
info(pool_count == 1 ? _("Serving %lu pool on %s") : _("Serving %lu pools on %s"), pool_count, addr); info(pool_count == 1 ? _("Serving %lu pool on %s") : _("Serving %lu pools on %s"), pool_count, addr);
if (!lm_ctx_serve(&ctx, addr, config_get_integer("threads"), serve_callback, NULL)) { if (!lm_ctx_serve(&ctx, addr, config_get_integer("threads"), NULL, serve_callback, NULL)) {
error(_("Failed to start the server: %s"), lm_strerror()); error(_("Failed to start the server: %s"), lm_strerror());
goto end_ctx; goto end_ctx;
} }