1
0
mirror of https://github.com/IEEE-SB-Passau/pelican-deployment-system.git synced 2017-09-06 16:35:38 +02:00
Files
pelican-deployment-system/example_config.py

88 lines
3.4 KiB
Python
Raw Normal View History

2016-06-17 01:26:56 +02:00
Copyright 2016 Peter Dahlberg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2016-06-11 00:51:12 +02:00
import os
2016-06-13 00:58:13 +02:00
import logging
2016-06-13 10:27:18 +02:00
from apscheduler.triggers.cron import CronTrigger
2016-06-15 00:15:11 +02:00
from apscheduler.triggers.date import DateTrigger
2016-06-11 00:51:12 +02:00
2016-06-10 21:59:52 +02:00
if __name__ == "__main__":
raise SystemExit("Not meant to be run directly!")
def _rsync_cmd(dest):
cmd = ("rsync --delete-delay --recursive --times --stats "
"'{output}/' '{dest}'")
return cmd.format(dest=dest, output="{output}")
2016-06-13 00:58:13 +02:00
# configure the logger
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')
2016-06-11 22:04:27 +02:00
# make sure git does not block giving pw prompts, git 2.3+ only
2016-06-11 00:51:12 +02:00
os.environ["GIT_TERMINAL_PROMPT"] = "0"
os.environ["GIT_ASKPASS"] = "echo" # also to avoid interactiveness
os.environ["GIT_EDITOR"] = "true" # also to avoid interactiveness
os.environ["GIT_PAGER"] = "cat" # also to avoid interactiveness
# avoid system config, we want default behaviour
os.environ["GIT_CONFIG_NOSYSTEM"] = "yes"
2016-06-11 00:51:12 +02:00
2016-06-12 04:17:54 +02:00
# needs to be a byte like object
GITHUB_SECRET = b"changetosomethingrandomlong"
2016-06-10 21:59:52 +02:00
RUNNERS = {
2016-06-12 04:17:54 +02:00
# unique name of the runner, avoid spaces and other obscure characters
2016-06-10 21:59:52 +02:00
"website_master": {
2016-06-11 22:04:27 +02:00
# directory where building takes place, will be created if not there
# multiple runners may point to the same one
2016-06-10 21:59:52 +02:00
"working_directory": "/tmp/test",
2016-06-11 22:04:27 +02:00
# upstream url of the repository which contains the website
# use https://git::@github.com... to avoid pw prompts and instead fail
# (e.g. if github gives errornously 401 temporarily, git would block)
# os.environ["GIT_TERMINAL_PROMPT"] = "0" does the same but git 2.3+only
"clone_url": "https://git::@github.com/IEEE-SB-Passau/pelican-ieee-passau.git",
# branch which will be built
2016-06-10 21:59:52 +02:00
"git_branch": "master",
2016-06-11 22:04:27 +02:00
# command which installs the generated directory tree to it's final
# destination (the wwwroot) e.g. rsync. {output} will be replaced by
# the path to the generator output
"final_install_command": _rsync_cmd("/tmp/testroot"),
2016-06-11 22:04:27 +02:00
# command which builds the website
# important: specify {output} as output path of the generator
2016-06-16 23:21:05 +02:00
# if you use toy you may use {toxresult} as the path to the result.json
"build_command": ('tox -e pelican --result-json "{toxresult}" '
2016-06-14 03:29:01 +02:00
'--recreate -- -d --output "{output}"'),
2016-06-11 22:04:27 +02:00
# will be added to env when running build_command
"build_env": {"PELICAN_SITEURL": "//apu:800"}
2016-06-10 21:59:52 +02:00
}
}
2016-06-13 10:27:18 +02:00
# define crojobs as sequence of (runner, trigger) pairs, for cron triggers see
# http://apscheduler.readthedocs.io/en/latest/modules/triggers/cron.html
SCHEDULED_BUILD_JOBS = [
2016-06-15 00:15:11 +02:00
("website_master", CronTrigger(minute="*/30")),
("website_master", DateTrigger()) # once at start
2016-06-13 10:27:18 +02:00
]
2016-06-16 23:42:28 +02:00
# user, pass for /status/... subpages, if not set or None no auth is done
2016-06-15 00:15:11 +02:00
def STATUS_AUTH_BASIC_FN(user, passw):
return user == "powerpoint" and passw == "karaoke"