forked from vieter-v/vieter
Compare commits
3 Commits
5ab60c637b
...
404669c5a7
| Author | SHA1 | Date |
|---|---|---|
|
|
404669c5a7 | |
|
|
fda7063f2f | |
|
|
e840d930e1 |
|
|
@ -23,7 +23,7 @@ RUN if [ -n "${CI_COMMIT_SHA}" ]; then \
|
|||
"https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \
|
||||
chmod +x vieter ; \
|
||||
else \
|
||||
LDFLAGS='-lz -lbz2 -llzma -lexpat -lzstd -llz4 -static' make prod && \
|
||||
LDFLAGS='-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static' make prod && \
|
||||
mv pvieter vieter ; \
|
||||
fi
|
||||
|
||||
|
|
@ -31,10 +31,8 @@ RUN if [ -n "${CI_COMMIT_SHA}" ]; then \
|
|||
FROM busybox:1.35.0
|
||||
|
||||
ENV PATH=/bin \
|
||||
VIETER_REPOS_DIR=/data/repos \
|
||||
VIETER_PKG_DIR=/data/pkgs \
|
||||
VIETER_DOWNLOAD_DIR=/data/downloads \
|
||||
VIETER_REPOS_FILE=/data/repos.json
|
||||
VIETER_DATA_DIR=/data \
|
||||
VIETER_PKG_DIR=/data/pkgs
|
||||
|
||||
COPY --from=builder /app/dumb-init /app/vieter /bin/
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import env
|
|||
struct Config {
|
||||
pub:
|
||||
log_level string = 'WARN'
|
||||
log_file string = 'vieter.log'
|
||||
api_key string
|
||||
address string
|
||||
data_dir string
|
||||
base_image string = 'archlinux:base-devel'
|
||||
max_concurrent_builds int = 1
|
||||
api_update_frequency int = 15
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ module cron
|
|||
import log
|
||||
import cron.daemon
|
||||
import cron.expression
|
||||
import os
|
||||
|
||||
const log_file_name = 'vieter.cron.log'
|
||||
|
||||
// cron starts a cron daemon & starts periodically scheduling builds.
|
||||
pub fn cron(conf Config) ? {
|
||||
|
|
@ -15,7 +18,8 @@ pub fn cron(conf Config) ? {
|
|||
level: log_level
|
||||
}
|
||||
|
||||
logger.set_full_logpath(conf.log_file)
|
||||
log_file := os.join_path_single(conf.data_dir, cron.log_file_name)
|
||||
logger.set_full_logpath(log_file)
|
||||
logger.log_to_console_too()
|
||||
|
||||
ce := expression.parse_expression(conf.global_schedule) or {
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import time
|
|||
import sync.stdatomic
|
||||
import build
|
||||
|
||||
const build_empty = 0
|
||||
|
||||
const build_running = 1
|
||||
|
||||
const build_done = 2
|
||||
const (
|
||||
build_empty = 0
|
||||
build_running = 1
|
||||
build_done = 2
|
||||
)
|
||||
|
||||
// clean_finished_builds removes finished builds from the build slots & returns
|
||||
// them.
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@ import build
|
|||
import docker
|
||||
import db
|
||||
|
||||
// How many seconds to wait before retrying to update API if failed
|
||||
const api_update_retry_timeout = 5
|
||||
|
||||
// How many seconds to wait before retrying to rebuild image if failed
|
||||
const rebuild_base_image_retry_timout = 30
|
||||
const (
|
||||
// How many seconds to wait before retrying to update API if failed
|
||||
api_update_retry_timeout = 5
|
||||
// How many seconds to wait before retrying to rebuild image if failed
|
||||
rebuild_base_image_retry_timout = 30
|
||||
)
|
||||
|
||||
struct ScheduledBuild {
|
||||
pub:
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import net.http
|
|||
import response { new_data_response, new_response }
|
||||
import db
|
||||
|
||||
const repos_file = 'repos.json'
|
||||
|
||||
// get_repos returns the current list of repos.
|
||||
['/api/repos'; get]
|
||||
fn (mut app App) get_repos() web.Result {
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ pub:
|
|||
conf Config [required; web_global]
|
||||
pub mut:
|
||||
repo repo.RepoGroupManager [required; web_global]
|
||||
// This is used to claim the file lock on the repos file
|
||||
git_mutex shared util.Dummy
|
||||
db db.VieterDb
|
||||
db db.VieterDb
|
||||
}
|
||||
|
||||
// server starts the web server & starts listening for requests
|
||||
|
|
|
|||
Loading…
Reference in New Issue