From f989f3edd7790c9b1a67dc99f074828211bbbe68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 8 Aug 2020 15:48:38 +0200 Subject: [PATCH] Add Denise aventurier website --- .../buildbot/projects/denise/__init__.py | 35 ++++++++++++++++++- modules/private/default.nix | 1 + modules/private/websites/default.nix | 1 + .../private/websites/denise/aventuriers.nix | 26 ++++++++++++++ nix/sources.json | 12 +++++++ 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 modules/private/websites/denise/aventuriers.nix diff --git a/modules/private/buildbot/projects/denise/__init__.py b/modules/private/buildbot/projects/denise/__init__.py index c07655b..bd460d1 100644 --- a/modules/private/buildbot/projects/denise/__init__.py +++ b/modules/private/buildbot/projects/denise/__init__.py @@ -17,6 +17,9 @@ class E(): OMS_RELEASE_PATH = "/var/lib/buildbot/outputs/denise/oms" OMS_GIT_URL = "gitolite@git.immae.eu:perso/Denise/oms" + AVENTURIERS_RELEASE_PATH = "/var/lib/buildbot/outputs/denise/aventuriers" + AVENTURIERS_GIT_URL = "https://git.immae.eu/perso/Denise/aventuriers.git" + # master.cfg SECRETS_FILE = os.getcwd() + "/secrets" LDAP_URL = "ldaps://ldap.immae.eu:636" @@ -51,11 +54,13 @@ def configure(c): c['workers'].append(worker.LocalWorker("generic-worker-denise")) c['schedulers'].append(hook_scheduler("DeniseOMS", timer=1)) + c['schedulers'].append(hook_scheduler("DeniseAventuriers", timer=1)) c['schedulers'].append(force_scheduler("force_denise", [ - "DeniseOMS_build" + "DeniseOMS_build", "DeniseAventuriers_build" ])) c['builders'].append(denise_oms_factory()) + c['builders'].append(denise_aventuriers_factory()) def denise_oms_factory(): factory = util.BuildFactory() @@ -70,3 +75,31 @@ def denise_oms_factory(): factory.addStep(steps.MasterShellCommand(command="kill $(cat /run/denise_oms/gunicorn.pid)")) return util.BuilderConfig(name="DeniseOMS_build", workernames=["generic-worker-denise"], factory=factory) + +def denise_aventuriers_factory(): + path_env = { + "PATH": os.environ["BUILDBOT_PATH_Aventuriers"] + ":${PATH}" + } + + factory = util.BuildFactory() + factory.addStep(steps.Git(logEnviron=False, repourl=E.AVENTURIERS_GIT_URL, + submodules=True, mode="full", method="copy")) + factory.addStep(steps.ShellCommand(name="build files", + logEnviron=False, haltOnFailure=True, workdir="source", + env=path_env, command=["make", "tout", "encyclo"])) + factory.addStep(steps.MasterShellCommand(command="rm -rf {}".format(E.AVENTURIERS_RELEASE_PATH))) + factory.addStep(steps.DirectoryUpload(workersrc="../source/html", + masterdest=E.AVENTURIERS_RELEASE_PATH, + url="https://aventuriers.syanni.eu")) + factory.addStep(steps.FileUpload(name="upload mobi file", workersrc="aventuriers.mobi", + workdir="source", masterdest=E.AVENTURIERS_RELEASE_PATH + "/aventuriers.mobi", + url="https://aventuriers.syanni.eu/aventuriers.mobi", mode=0o644)) + factory.addStep(steps.FileUpload(name="upload pdf file", workersrc="aventuriers.pdf", + workdir="source", masterdest=E.AVENTURIERS_RELEASE_PATH + "/aventuriers.pdf", + url="https://aventuriers.syanni.eu/aventuriers.pdf", mode=0o644)) + factory.addStep(steps.FileUpload(name="upload encyclo pdf file", workersrc="encyclo.pdf", + workdir="source", masterdest=E.AVENTURIERS_RELEASE_PATH + "/encyclo.pdf", + url="https://aventuriers.syanni.eu/encyclo.pdf", mode=0o644)) + factory.addStep(steps.MasterShellCommand(command="chmod -R a+rX {}".format(E.AVENTURIERS_RELEASE_PATH))) + + return util.BuilderConfig(name="DeniseAventuriers_build", workernames=["generic-worker-denise"], factory=factory) diff --git a/modules/private/default.nix b/modules/private/default.nix index 2c8ae6c..9ea136e 100644 --- a/modules/private/default.nix +++ b/modules/private/default.nix @@ -32,6 +32,7 @@ set = { deniseDenisejeromeProd = ./websites/denise/denisejerome.nix; deniseEvariste = ./websites/denise/evariste.nix; deniseOMS = ./websites/denise/oms.nix; + deniseAventuriers = ./websites/denise/aventuriers.nix; deniseProduction = ./websites/denise/production.nix; emiliaMoodle = ./websites/emilia/moodle.nix; diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index 94506c9..d9665ff 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix @@ -241,6 +241,7 @@ in evariste.enable = true; denisejerome.enable = true; oms.enable = true; + aventuriers.enable = true; production.enable = true; }; diff --git a/modules/private/websites/denise/aventuriers.nix b/modules/private/websites/denise/aventuriers.nix new file mode 100644 index 0000000..33df53e --- /dev/null +++ b/modules/private/websites/denise/aventuriers.nix @@ -0,0 +1,26 @@ +{ lib, config, pkgs, ... }: +let + cfg = config.myServices.websites.denise.aventuriers; + varDir = "/var/lib/buildbot/outputs/denise/aventuriers"; +in { + options.myServices.websites.denise.aventuriers.enable = lib.mkEnableOption "enable Denise's Aventuriers website"; + + config = lib.mkIf cfg.enable { + services.websites.env.production.vhostConfs.denise_aventuriers = { + certName = "denise"; + addToCerts = true; + hosts = [ "aventuriers.syanni.eu" ]; + root = varDir; + extraConfig = [ + '' + + DirectoryIndex index.html + Options Indexes FollowSymLinks MultiViews Includes + AllowOverride None + Require all granted + + '' + ]; + }; + }; +} diff --git a/nix/sources.json b/nix/sources.json index 565d3a4..1722139 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -17,6 +17,18 @@ "url": "https://github.com/NixOS/nixpkgs-channels/archive/fce7562cf46727fdaf801b232116bc9ce0512049.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "buildbot-denise-aventuriers-nixpkgs": { + "branch": "nixos-unstable", + "description": "Frozen nixpkgs snapshot for texlive", + "homepage": "https://github.com/NixOS/nixpkgs", + "owner": "NixOS", + "repo": "nixpkgs-channels", + "rev": "8e2b14aceb1d40c7e8b84c03a7c78955359872bb", + "sha256": "0zzjpd9smr7rxzrdf6raw9kbj42fbvafxb5bz36lcxgv290pgsm8", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs-channels/archive/8e2b14aceb1d40c7e8b84c03a7c78955359872bb.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "buildbot-history-deps": { "ref": "master", "repo": "ssh://gitolite@git.immae.eu/perso/Immae/Sites/History", -- 2.41.0