- изменение для работы с alr
This commit is contained in:
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,7 +1,8 @@
|
|||||||
/lure-updater.toml
|
/alr-updater.toml
|
||||||
/lure-updater
|
/alr-updater
|
||||||
/dist/
|
/dist/
|
||||||
*.star
|
*.star
|
||||||
.gigaide
|
.gigaide/
|
||||||
.idea
|
.idea/
|
||||||
.claude
|
.claude/
|
||||||
|
CLAUDE.md
|
@@ -43,7 +43,7 @@ ALR-Updater — это модульный бот, предназначенный
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Клонирование репозитория
|
# Клонирование репозитория
|
||||||
git clone https://github.com/your-username/ALR-updater.git
|
git clone https://gitea.plemya-x.ru/Plemya-x/ALR-updater.git
|
||||||
cd ALR-updater
|
cd ALR-updater
|
||||||
|
|
||||||
# Сборка
|
# Сборка
|
||||||
@@ -70,7 +70,7 @@ sudo cp alr-updater.example.toml /etc/alr-updater/config.toml
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[git]
|
[git]
|
||||||
repoURL = "https://gitverse.ru/Xpamych/xpamych-alr-repo"
|
repoURL = "https://gitea.plemya-x.ru/Plemya-x/alr-repo.git"
|
||||||
repoDir = "/etc/alr-updater/repo"
|
repoDir = "/etc/alr-updater/repo"
|
||||||
|
|
||||||
[git.commit]
|
[git.commit]
|
||||||
@@ -411,7 +411,7 @@ def update_package_with_notification(package_name, new_version):
|
|||||||
Вы можете использовать переменные окружения вместо файла конфигурации:
|
Вы можете использовать переменные окружения вместо файла конфигурации:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export GIT_REPO_URL="https://gitverse.ru/Xpamych/xpamych-alr-repo"
|
export GIT_REPO_URL="https://gitea.plemya-x.ru/Plemya-x/alr-repo.git"
|
||||||
export GIT_REPO_DIR="/tmp/alr-repo"
|
export GIT_REPO_DIR="/tmp/alr-repo"
|
||||||
export GIT_COMMIT_NAME="ALR Updater"
|
export GIT_COMMIT_NAME="ALR Updater"
|
||||||
export GIT_COMMIT_EMAIL="bot@example.com"
|
export GIT_COMMIT_EMAIL="bot@example.com"
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
[git]
|
[git]
|
||||||
repoURL = "https://gitverse.ru/Xpamych/xpamych-alr-repo"
|
repoURL = "https://gitea.plemya-x.ru/Plemya-x/alr-repo.git"
|
||||||
repoDir = "/etc/alr-updater/repo"
|
repoDir = "/etc/alr-updater/repo"
|
||||||
[git.commit]
|
[git.commit]
|
||||||
# Имя и адрес электронной почты, которые будут использоваться при фиксации git
|
# Имя и адрес электронной почты, которые будут использоваться при фиксации git
|
||||||
name = "CHANGE ME"
|
name = "CHANGE ME"
|
||||||
email = "CHANGE ME"
|
email = "CHANGE ME"
|
||||||
[git.credentials]
|
[git.credentials]
|
||||||
# Имя пользователя и пароль для git push. Используйте личный токен доступа в качестве пароля для Github.
|
# Имя пользователя и пароль для git push. Используйте личный токен доступа в качестве пароля для Gitea.
|
||||||
username = "CHANGE ME"
|
username = "CHANGE ME"
|
||||||
password = "CHANGE ME"
|
password = "CHANGE ME"
|
||||||
|
|
||||||
|
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module lure.sh/lure-updater
|
module gitea.plemya-x.ru/Plemya-x/ALR-updater
|
||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,7 +27,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.elara.ws/logger/log"
|
"go.elara.ws/logger/log"
|
||||||
"lure.sh/lure-updater/internal/config"
|
"gitea.plemya-x.ru/Plemya-x/ALR-updater/internal/config"
|
||||||
"go.starlark.net/starlark"
|
"go.starlark.net/starlark"
|
||||||
"go.starlark.net/starlarkstruct"
|
"go.starlark.net/starlarkstruct"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/vmihailenco/msgpack/v5"
|
"github.com/vmihailenco/msgpack/v5"
|
||||||
"lure.sh/lure-updater/internal/convert"
|
"gitea.plemya-x.ru/Plemya-x/ALR-updater/internal/convert"
|
||||||
"go.starlark.net/starlark"
|
"go.starlark.net/starlark"
|
||||||
"go.starlark.net/starlarkstruct"
|
"go.starlark.net/starlarkstruct"
|
||||||
)
|
)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -36,6 +36,8 @@ var regexModule = &starlarkstruct.Module{
|
|||||||
Members: starlark.StringDict{
|
Members: starlark.StringDict{
|
||||||
"compile": starlark.NewBuiltin("regex.compile", regexCompile),
|
"compile": starlark.NewBuiltin("regex.compile", regexCompile),
|
||||||
"compile_glob": starlark.NewBuiltin("regex.compile_glob", regexCompileGlob),
|
"compile_glob": starlark.NewBuiltin("regex.compile_glob", regexCompileGlob),
|
||||||
|
"find": starlark.NewBuiltin("regex.find", regexFind),
|
||||||
|
"replace": starlark.NewBuiltin("regex.replace", regexReplace),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,3 +145,55 @@ func matchesToStarlark1D(match []string) *starlark.List {
|
|||||||
}
|
}
|
||||||
return starlark.NewList(list)
|
return starlark.NewList(list)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func regexFind(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
|
||||||
|
var pattern, text string
|
||||||
|
err := starlark.UnpackArgs("regex.find", args, kwargs, "pattern", &pattern, "text", &text)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheMtx.Lock()
|
||||||
|
regex, ok := regexCache[pattern]
|
||||||
|
if !ok {
|
||||||
|
regex, err = pcre.Compile(pattern)
|
||||||
|
if err != nil {
|
||||||
|
cacheMtx.Unlock()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
regexCache[pattern] = regex
|
||||||
|
}
|
||||||
|
cacheMtx.Unlock()
|
||||||
|
|
||||||
|
matches := regex.FindStringSubmatch(text)
|
||||||
|
if len(matches) > 1 {
|
||||||
|
return starlark.String(matches[1]), nil
|
||||||
|
}
|
||||||
|
if len(matches) > 0 {
|
||||||
|
return starlark.String(matches[0]), nil
|
||||||
|
}
|
||||||
|
return starlark.String(""), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func regexReplace(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
|
||||||
|
var text, pattern, replacement string
|
||||||
|
err := starlark.UnpackArgs("regex.replace", args, kwargs, "text", &text, "pattern", &pattern, "replacement", &replacement)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheMtx.Lock()
|
||||||
|
regex, ok := regexCache[pattern]
|
||||||
|
if !ok {
|
||||||
|
regex, err = pcre.Compile(pattern)
|
||||||
|
if err != nil {
|
||||||
|
cacheMtx.Unlock()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
regexCache[pattern] = regex
|
||||||
|
}
|
||||||
|
cacheMtx.Unlock()
|
||||||
|
|
||||||
|
result := regex.ReplaceAllString(text, replacement)
|
||||||
|
return starlark.String(result), nil
|
||||||
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,7 +21,7 @@ package builtins
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"lure.sh/lure-updater/internal/config"
|
"gitea.plemya-x.ru/Plemya-x/ALR-updater/internal/config"
|
||||||
"go.etcd.io/bbolt"
|
"go.etcd.io/bbolt"
|
||||||
"go.starlark.net/starlark"
|
"go.starlark.net/starlark"
|
||||||
"go.starlark.net/starlarkjson"
|
"go.starlark.net/starlarkjson"
|
||||||
@@ -35,7 +35,7 @@ type Options struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Register(sd starlark.StringDict, opts *Options) {
|
func Register(sd starlark.StringDict, opts *Options) {
|
||||||
sd["run_every"] = starlark.NewBuiltin("run_every", runEvery)
|
sd["run_every"] = runEveryModule
|
||||||
sd["sleep"] = starlark.NewBuiltin("sleep", sleep)
|
sd["sleep"] = starlark.NewBuiltin("sleep", sleep)
|
||||||
sd["http"] = httpModule
|
sd["http"] = httpModule
|
||||||
sd["regex"] = regexModule
|
sd["regex"] = regexModule
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -100,3 +100,76 @@ func newTickerHandle(handle int) starlark.Value {
|
|||||||
"stop": stopTicker(handle),
|
"stop": stopTicker(handle),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var runEveryModule = &starlarkstruct.Module{
|
||||||
|
Name: "run_every",
|
||||||
|
Members: starlark.StringDict{
|
||||||
|
"minute": starlark.NewBuiltin("run_every.minute", runEveryMinute),
|
||||||
|
"hour": starlark.NewBuiltin("run_every.hour", runEveryHour),
|
||||||
|
"day": starlark.NewBuiltin("run_every.day", runEveryDay),
|
||||||
|
"week": starlark.NewBuiltin("run_every.week", runEveryWeek),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func runEveryMinute(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
|
||||||
|
var fn *starlark.Function
|
||||||
|
err := starlark.UnpackArgs("run_every.minute", args, kwargs, "function", &fn)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return runScheduled(thread, fn, "1m")
|
||||||
|
}
|
||||||
|
|
||||||
|
func runEveryHour(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
|
||||||
|
var fn *starlark.Function
|
||||||
|
err := starlark.UnpackArgs("run_every.hour", args, kwargs, "function", &fn)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return runScheduled(thread, fn, "1h")
|
||||||
|
}
|
||||||
|
|
||||||
|
func runEveryDay(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
|
||||||
|
var fn *starlark.Function
|
||||||
|
err := starlark.UnpackArgs("run_every.day", args, kwargs, "function", &fn)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return runScheduled(thread, fn, "24h")
|
||||||
|
}
|
||||||
|
|
||||||
|
func runEveryWeek(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
|
||||||
|
var fn *starlark.Function
|
||||||
|
err := starlark.UnpackArgs("run_every.week", args, kwargs, "function", &fn)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return runScheduled(thread, fn, "168h")
|
||||||
|
}
|
||||||
|
|
||||||
|
func runScheduled(thread *starlark.Thread, fn *starlark.Function, duration string) (starlark.Value, error) {
|
||||||
|
d, err := time.ParseDuration(duration)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
tickerMtx.Lock()
|
||||||
|
t := time.NewTicker(d)
|
||||||
|
handle := tickerCount
|
||||||
|
tickers[handle] = t
|
||||||
|
tickerCount++
|
||||||
|
tickerMtx.Unlock()
|
||||||
|
log.Debug("Created new scheduled ticker").Int("handle", handle).Str("duration", duration).Stringer("pos", thread.CallFrame(1).Pos).Send()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for range t.C {
|
||||||
|
log.Debug("Calling scheduled function").Str("name", fn.Name()).Stringer("pos", fn.Position()).Send()
|
||||||
|
_, err := starlark.Call(thread, fn, nil, nil)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Error while executing scheduled function").Str("name", fn.Name()).Stringer("pos", fn.Position()).Err(err).Send()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
return newTickerHandle(handle), nil
|
||||||
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/go-git/go-git/v5/plumbing/object"
|
"github.com/go-git/go-git/v5/plumbing/object"
|
||||||
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||||
"go.elara.ws/logger/log"
|
"go.elara.ws/logger/log"
|
||||||
"lure.sh/lure-updater/internal/config"
|
"gitea.plemya-x.ru/Plemya-x/ALR-updater/internal/config"
|
||||||
"go.starlark.net/starlark"
|
"go.starlark.net/starlark"
|
||||||
"go.starlark.net/starlarkstruct"
|
"go.starlark.net/starlarkstruct"
|
||||||
)
|
)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,15 +0,0 @@
|
|||||||
[git]
|
|
||||||
repoURL = "https://github.com/lure-sh/lure-repo.git"
|
|
||||||
repoDir = "/etc/lure-updater/repo"
|
|
||||||
[git.commit]
|
|
||||||
# The name and email to use in the git commit
|
|
||||||
name = "CHANGE ME"
|
|
||||||
email = "CHANGE ME"
|
|
||||||
[git.credentials]
|
|
||||||
# Username and password for git push. Use a personal access token as the password for Github.
|
|
||||||
username = "CHANGE ME"
|
|
||||||
password = "CHANGE ME"
|
|
||||||
|
|
||||||
[webhook]
|
|
||||||
# A hash of the webhook password. Generate one using `lure-updater -g`.
|
|
||||||
pwd_hash = "CHANGE ME"
|
|
14
main.go
14
main.go
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* LURE Updater - Automated updater bot for LURE packages
|
* ALR Updater - Automated updater bot for ALR packages
|
||||||
* Copyright (C) 2023 Elara Musayelyan
|
* Copyright (C) 2025 The ALR Authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,8 +31,8 @@ import (
|
|||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"go.elara.ws/logger"
|
"go.elara.ws/logger"
|
||||||
"go.elara.ws/logger/log"
|
"go.elara.ws/logger/log"
|
||||||
"lure.sh/lure-updater/internal/builtins"
|
"gitea.plemya-x.ru/Plemya-x/ALR-updater/internal/builtins"
|
||||||
"lure.sh/lure-updater/internal/config"
|
"gitea.plemya-x.ru/Plemya-x/ALR-updater/internal/config"
|
||||||
"go.etcd.io/bbolt"
|
"go.etcd.io/bbolt"
|
||||||
"go.starlark.net/starlark"
|
"go.starlark.net/starlark"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
@@ -44,9 +44,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
configPath := pflag.StringP("config", "c", "/etc/lure-updater/config.toml", "Path to config file")
|
configPath := pflag.StringP("config", "c", "/etc/alr-updater/config.toml", "Path to config file")
|
||||||
dbPath := pflag.StringP("database", "d", "/etc/lure-updater/db", "Path to database file")
|
dbPath := pflag.StringP("database", "d", "/etc/alr-updater/db", "Path to database file")
|
||||||
pluginDir := pflag.StringP("plugin-dir", "p", "/etc/lure-updater/plugins", "Path to plugin directory")
|
pluginDir := pflag.StringP("plugin-dir", "p", "/etc/alr-updater/plugins", "Path to plugin directory")
|
||||||
serverAddr := pflag.StringP("address", "a", ":8080", "Webhook server address")
|
serverAddr := pflag.StringP("address", "a", ":8080", "Webhook server address")
|
||||||
genHash := pflag.BoolP("gen-hash", "g", false, "Generate a password hash for webhooks")
|
genHash := pflag.BoolP("gen-hash", "g", false, "Generate a password hash for webhooks")
|
||||||
useEnv := pflag.BoolP("use-env", "E", false, "Use environment variables for configuration")
|
useEnv := pflag.BoolP("use-env", "E", false, "Use environment variables for configuration")
|
||||||
|
@@ -1,37 +1,37 @@
|
|||||||
job "lure-updater" {
|
job "alr-updater" {
|
||||||
region = "global"
|
region = "global"
|
||||||
datacenters = ["dc1"]
|
datacenters = ["dc1"]
|
||||||
type = "service"
|
type = "service"
|
||||||
|
|
||||||
group "lure-updater" {
|
group "alr-updater" {
|
||||||
network {
|
network {
|
||||||
port "webhook" {
|
port "webhook" {
|
||||||
to = 8080
|
to = 8080
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
volume "lure-updater-data" {
|
volume "alr-updater-data" {
|
||||||
type = "host"
|
type = "host"
|
||||||
source = "lure-updater-data"
|
source = "alr-updater-data"
|
||||||
read_only = false
|
read_only = false
|
||||||
}
|
}
|
||||||
|
|
||||||
task "lure-updater" {
|
task "alr-updater" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
volume_mount {
|
volume_mount {
|
||||||
volume = "lure-updater-data"
|
volume = "alr-updater-data"
|
||||||
destination = "/etc/lure-updater"
|
destination = "/etc/alr-updater"
|
||||||
read_only = false
|
read_only = false
|
||||||
}
|
}
|
||||||
|
|
||||||
env {
|
env {
|
||||||
GIT_REPO_DIR = "/etc/lure-updater/repo"
|
GIT_REPO_DIR = "/etc/alr-updater/repo"
|
||||||
GIT_REPO_URL = "https://github.com/lure-sh/lure-repo.git"
|
GIT_REPO_URL = "https://gitea.plemya-x.ru/Plemya-x/alr-repo.git"
|
||||||
GIT_CREDENTIALS_USERNAME = "lure-repo-bot"
|
GIT_CREDENTIALS_USERNAME = "alr-repo-bot"
|
||||||
GIT_CREDENTIALS_PASSWORD = "${GITHUB_PASSWORD}"
|
GIT_CREDENTIALS_PASSWORD = "${GITEA_PASSWORD}"
|
||||||
GIT_COMMIT_NAME = "lure-repo-bot"
|
GIT_COMMIT_NAME = "alr-repo-bot"
|
||||||
GIT_COMMIT_EMAIL = "lure@elara.ws"
|
GIT_COMMIT_EMAIL = "bot@plemya-x.ru"
|
||||||
WEBHOOK_PASSWORD_HASH = "${PASSWORD_HASH}"
|
WEBHOOK_PASSWORD_HASH = "${PASSWORD_HASH}"
|
||||||
|
|
||||||
// Hack to force Nomad to re-deploy the service
|
// Hack to force Nomad to re-deploy the service
|
||||||
@@ -41,25 +41,25 @@ job "lure-updater" {
|
|||||||
|
|
||||||
config {
|
config {
|
||||||
image = "alpine:latest"
|
image = "alpine:latest"
|
||||||
command = "/opt/lure-updater/lure-updater"
|
command = "/opt/alr-updater/alr-updater"
|
||||||
args = ["-DE"]
|
args = ["-DE"]
|
||||||
ports = ["webhook"]
|
ports = ["webhook"]
|
||||||
volumes = ["local/lure-updater/:/opt/lure-updater:ro"]
|
volumes = ["local/alr-updater/:/opt/alr-updater:ro"]
|
||||||
}
|
}
|
||||||
|
|
||||||
artifact {
|
artifact {
|
||||||
source = "https://api.minio.elara.ws/lure-updater/lure-updater-$${attr.cpu.arch}.tar.gz"
|
source = "https://gitea.plemya-x.ru/api/v1/repos/Plemya-x/ALR-updater/releases/latest/alr-updater-$${attr.cpu.arch}.tar.gz"
|
||||||
destination = "local/lure-updater"
|
destination = "local/alr-updater"
|
||||||
}
|
}
|
||||||
|
|
||||||
service {
|
service {
|
||||||
name = "lure-updater"
|
name = "alr-updater"
|
||||||
port = "webhook"
|
port = "webhook"
|
||||||
|
|
||||||
tags = [
|
tags = [
|
||||||
"traefik.enable=true",
|
"traefik.enable=true",
|
||||||
"traefik.http.routers.lure-updater.rule=Host(`updater.lure.sh`)",
|
"traefik.http.routers.alr-updater.rule=Host(`updater.plemya-x.ru`)",
|
||||||
"traefik.http.routers.lure-updater.tls.certResolver=letsencrypt",
|
"traefik.http.routers.alr-updater.tls.certResolver=letsencrypt",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user