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 {
inherit system;
};
py = pkgs.python3.override {
py = pkgs.python311.override {
packageOverrides = final: prev: {
django = prev.django_4;
};
@ -28,16 +28,15 @@
config = {
User = "5000:5000";
Volumes = {
"/static" = { };
"/tmp" = { };
};
WorkingDir = "${self.packages.${system}.healthchecks}/opt/healthchecks";
WorkingDir = "${self.packages.${system}.healthchecks}/app";
Env = [
"LANG=en_US.UTF-8"
"PYTHONPATH=${self.packages.${system}.healthchecks.pythonPath}"
"PYTHONUNBUFFERED=1"
"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 = ''
mkdir -p $out/opt/healthchecks
cp -r . $out/opt/healthchecks
chmod +x $out/opt/healthchecks/manage.py
cp ${localSettings} $out/opt/healthchecks/hc/local_settings.py
mkdir -p $out/app
cp -r . $out/app
chmod +x $out/app/manage.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 = {
@ -113,7 +114,7 @@
name = "healthchecks-smtpd";
config = {
Cmd = [
"${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py"
"${self.packages.${system}.healthchecks}/app/manage.py"
"smtpd"
"--port"
"2525"
@ -131,7 +132,7 @@
name = "healthchecks-sendalerts";
config = {
Cmd = [
"${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py"
"${self.packages.${system}.healthchecks}/app/manage.py"
"sendalerts"
];
ExposedPorts = { };
@ -144,10 +145,10 @@
script = pkgs.writeScript "maintenance" ''
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
${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py prunenotifications
${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py pruneusers
${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py prunetokenbucket
${self.packages.${system}.healthchecks}/opt/healthchecks/manage.py pruneflips
${self.packages.${system}.healthchecks}/app/manage.py prunenotifications
${self.packages.${system}.healthchecks}/app/manage.py pruneusers
${self.packages.${system}.healthchecks}/app/manage.py prunetokenbucket
${self.packages.${system}.healthchecks}/app/manage.py pruneflips
${pkgs.curl}/bin/curl $CURL_OPTIONS http://webserver.healthchecks.svc/ping/$MAINTENANCE_CHECK_UUID
'';
in
@ -178,11 +179,11 @@
processes = 4
enable-threads
threads = 1
chdir = ${self.packages.${system}.healthchecks}/opt/healthchecks
chdir = ${self.packages.${system}.healthchecks}/app
module = hc.wsgi:application
thunder-lock
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
'';
};
@ -191,20 +192,22 @@
pkgs.lib.attrsets.recursiveUpdate baseImage {
name = "healthchecks-webserver";
fakeRootCommands = '';
mkdir /static
chmod 0777 /static
mkdir /tmp
chmod 0777 /tmp
'';
config = {
Cmd = [
"${pkgs.python3Packages.gunicorn}/bin/gunicorn"
"hc.wsgi"
"--bind"
":8000"
"--pythonpath"
self.packages.${system}.healthchecks.pythonPath
"${pkgs.uwsgi}/bin/uwsgi"
"${uwsgi-ini}"
];
# Cmd = [
# "${pkgs.python3Packages.gunicorn}/bin/gunicorn"
# "hc.wsgi"
# "--bind"
# ":8000"
# "--pythonpath"
# self.packages.${system}.healthchecks.pythonPath
# ];
ExposedPorts = {
"8000/tcp" = { };
};