update
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jeffrey C. Ollie 2023-04-16 16:45:58 -05:00
parent 6998e2f87f
commit dab061c471
Signed by: jeff
GPG key ID: 6F86035A6D97044E

View file

@ -13,7 +13,7 @@
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
}; };
py = pkgs.python3.override { py = pkgs.python311.override {
packageOverrides = final: prev: { packageOverrides = final: prev: {
django = prev.django_4; django = prev.django_4;
}; };
@ -28,16 +28,15 @@
config = { config = {
User = "5000:5000"; User = "5000:5000";
Volumes = { Volumes = {
"/static" = { };
"/tmp" = { }; "/tmp" = { };
}; };
WorkingDir = "${self.packages.${system}.healthchecks}/opt/healthchecks"; WorkingDir = "${self.packages.${system}.healthchecks}/app";
Env = [ Env = [
"LANG=en_US.UTF-8" "LANG=en_US.UTF-8"
"PYTHONPATH=${self.packages.${system}.healthchecks.pythonPath}" "PYTHONPATH=${self.packages.${system}.healthchecks.pythonPath}"
"PYTHONUNBUFFERED=1" "PYTHONUNBUFFERED=1"
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"STATIC_ROOT=/static" "STATIC_ROOT=${self.packages.${system}.healthchecks}/static"
]; ];
}; };
}; };
@ -85,10 +84,12 @@
}; };
installPhase = '' installPhase = ''
mkdir -p $out/opt/healthchecks mkdir -p $out/app
cp -r . $out/opt/healthchecks cp -r . $out/app
chmod +x $out/opt/healthchecks/manage.py chmod +x $out/app/manage.py
cp ${localSettings} $out/opt/healthchecks/hc/local_settings.py cp ${localSettings} $out/app/hc/local_settings.py
DEBUG=False SECRET_KEY=build-key STATIC_ROOT=$out/static ${py}/bin/python $out/app/manage.py collectstatic --noinput
DEBUG=False SECRET_KEY=build-key STATIC_ROOT=$out/static ${py}/bin/python $out/app/manage.py compress
''; '';
passthru = { passthru = {
@ -113,7 +114,7 @@
name = "healthchecks-smtpd"; name = "healthchecks-smtpd";
config = { config = {
Cmd = [ Cmd = [
"${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py" "${self.packages.${system}.healthchecks}/app/manage.py"
"smtpd" "smtpd"
"--port" "--port"
"2525" "2525"
@ -131,7 +132,7 @@
name = "healthchecks-sendalerts"; name = "healthchecks-sendalerts";
config = { config = {
Cmd = [ Cmd = [
"${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py" "${self.packages.${system}.healthchecks}/app/manage.py"
"sendalerts" "sendalerts"
]; ];
ExposedPorts = { }; ExposedPorts = { };
@ -144,10 +145,10 @@
script = pkgs.writeScript "maintenance" '' script = pkgs.writeScript "maintenance" ''
CURL_OPTIONS="--fail --silent --show-error --max-time 10 --retry 5 --output /dev/null" CURL_OPTIONS="--fail --silent --show-error --max-time 10 --retry 5 --output /dev/null"
${pkgs.curl}/bin/curl $CURL_OPTIONS http://webserver.healthchecks.svc/ping/$MAINTENANCE_CHECK_UUID/start ${pkgs.curl}/bin/curl $CURL_OPTIONS http://webserver.healthchecks.svc/ping/$MAINTENANCE_CHECK_UUID/start
${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py prunenotifications ${self.packages.${system}.healthchecks}/app/manage.py prunenotifications
${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py pruneusers ${self.packages.${system}.healthchecks}/app/manage.py pruneusers
${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py prunetokenbucket ${self.packages.${system}.healthchecks}/app/manage.py prunetokenbucket
${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py pruneflips ${self.packages.${system}.healthchecks}/app/manage.py pruneflips
${pkgs.curl}/bin/curl $CURL_OPTIONS http://webserver.healthchecks.svc/ping/$MAINTENANCE_CHECK_UUID ${pkgs.curl}/bin/curl $CURL_OPTIONS http://webserver.healthchecks.svc/ping/$MAINTENANCE_CHECK_UUID
''; '';
in in
@ -178,11 +179,11 @@
processes = 4 processes = 4
enable-threads enable-threads
threads = 1 threads = 1
chdir = ${self.packages.${system}.healthchecks}/opt/healthchecks chdir = ${self.packages.${system}.healthchecks}/app
module = hc.wsgi:application module = hc.wsgi:application
thunder-lock thunder-lock
disable-write-exception disable-write-exception
static-map = /static=${self.packages.${system}.healthchecks}/opt/healthchecks/static-collected static-map = /static=${self.packages.${system}.healthchecks}/static
buffer-size = 32768 buffer-size = 32768
''; '';
}; };
@ -191,20 +192,22 @@
pkgs.lib.attrsets.recursiveUpdate baseImage { pkgs.lib.attrsets.recursiveUpdate baseImage {
name = "healthchecks-webserver"; name = "healthchecks-webserver";
fakeRootCommands = ''; fakeRootCommands = '';
mkdir /static
chmod 0777 /static
mkdir /tmp mkdir /tmp
chmod 0777 /tmp chmod 0777 /tmp
''; '';
config = { config = {
Cmd = [ Cmd = [
"${pkgs.python3Packages.gunicorn}/bin/gunicorn" "${pkgs.uwsgi}/bin/uwsgi"
"hc.wsgi" "${uwsgi-ini}"
"--bind"
":8000"
"--pythonpath"
self.packages.${system}.healthchecks.pythonPath
]; ];
# Cmd = [
# "${pkgs.python3Packages.gunicorn}/bin/gunicorn"
# "hc.wsgi"
# "--bind"
# ":8000"
# "--pythonpath"
# self.packages.${system}.healthchecks.pythonPath
# ];
ExposedPorts = { ExposedPorts = {
"8000/tcp" = { }; "8000/tcp" = { };
}; };