From 599d015776ba42a9930d6d6eb42b9e74f6c151ed Mon Sep 17 00:00:00 2001 From: Luke Yeager Date: Tue, 27 Sep 2016 17:04:46 -0700 Subject: [PATCH] Add packaging support for Systemd (for 16.04) Various other small packaging changes/improvements Rename nginx to NGINX: https://forum.nginx.org/read.php?2,255874,255879 --- .../deb/extras/custom_http_errors/413.shtml | 6 +-- .../deb/extras/custom_http_errors/502.html | 37 +++++++++++++++---- packaging/deb/extras/digits.nginx-site | 2 +- packaging/deb/templates/control | 2 +- packaging/deb/templates/copyright | 4 +- packaging/deb/templates/digits.default | 2 - packaging/deb/templates/digits.postinst | 4 +- packaging/deb/templates/digits.prerm | 4 +- packaging/deb/templates/digits.service | 15 ++++++++ packaging/deb/templates/digits.templates | 6 +-- packaging/deb/templates/rules | 2 +- 11 files changed, 60 insertions(+), 24 deletions(-) delete mode 100644 packaging/deb/templates/digits.default create mode 100644 packaging/deb/templates/digits.service diff --git a/packaging/deb/extras/custom_http_errors/413.shtml b/packaging/deb/extras/custom_http_errors/413.shtml index 80ec79ca6..53a7cf11f 100644 --- a/packaging/deb/extras/custom_http_errors/413.shtml +++ b/packaging/deb/extras/custom_http_errors/413.shtml @@ -1,7 +1,7 @@ -File too large +Failed to upload file -

Error - File upload too large

+

Error: File upload too large

You attempted to upload a file that exceeded the limit allowed by the NGINX reverse proxy server. @@ -13,7 +13,7 @@ You can try uploading your file directly to the DIGITS server running at

You can also try increasing the value of the client_max_body_size setting -in /etc/nginx/sites-available/digits.site. +in /etc/nginx/sites-available/digits.nginx-site.

diff --git a/packaging/deb/extras/custom_http_errors/502.html b/packaging/deb/extras/custom_http_errors/502.html index efca79730..51a1628fb 100644 --- a/packaging/deb/extras/custom_http_errors/502.html +++ b/packaging/deb/extras/custom_http_errors/502.html @@ -1,18 +1,41 @@ Failed to connect to DIGITS -

Error: Unable to connect to NVIDIA DIGITS

+

Error: Unable to connect to DIGITS

+ +

Restart the server

-To fix this problem, try stopping and restarting the DIGITS server by running -the following two commands: +On Ubuntu 14.04, use this command to restart the server:

-    sudo stop digits
-    sudo start digits
+    sudo service digits restart
 

-If you are still encountering problems after attempting to restart the DIGITS -server, check /var/log/digits/digits.log for errors. +On Ubuntu 16.04, use this command to restart the server:

+
+    sudo systemctl restart digits
+
+ +

Check the logs for errors

+

+If you are still encountering problems after restarting, check the logs for errors. +

+
+    cat /var/log/digits/digits.log
+
+

+

+For additional messsages on Ubuntu 14.04: +

+
+    cat /var/log/upstart/digits.log
+
+

+For additional messages on Ubuntu 16.04: +

+
+    journalctl -u digits.service
+
diff --git a/packaging/deb/extras/digits.nginx-site b/packaging/deb/extras/digits.nginx-site index 21273180c..5454e3194 100644 --- a/packaging/deb/extras/digits.nginx-site +++ b/packaging/deb/extras/digits.nginx-site @@ -1,4 +1,4 @@ -# DIGITS nginx site +# DIGITS NGINX site server { listen 80; #AUTOCONFIG port (DO NOT DELETE THIS LINE) diff --git a/packaging/deb/templates/control b/packaging/deb/templates/control index 5e471c21a..dc9897017 100644 --- a/packaging/deb/templates/control +++ b/packaging/deb/templates/control @@ -4,7 +4,7 @@ Maintainer: #USERNAME# <#EMAIL#> Homepage: https://developer.nvidia.com/digits Vcs-Browser: https://github.com/NVIDIA/DIGITS Priority: optional -Build-Depends: debhelper (>= 9), dh-python, python-all, python-setuptools, debconf +Build-Depends: debhelper (>= 9), dh-python, dh-systemd, python-all, python-setuptools, debconf Standards-Version: #POLICY# Package: digits diff --git a/packaging/deb/templates/copyright b/packaging/deb/templates/copyright index 2c4cff039..3bb17bf62 100644 --- a/packaging/deb/templates/copyright +++ b/packaging/deb/templates/copyright @@ -3,11 +3,11 @@ Upstream-Name: #PACKAGE# Source: https://github.com/NVIDIA/DIGITS Files: * -Copyright: #YEAR# #USERNAME# <#EMAIL#> +Copyright: #YEAR# NVIDIA CORPORATION License: BSD-3-Clause Files: debian/* -Copyright: #YEAR# #USERNAME# <#EMAIL#> +Copyright: #YEAR# NVIDIA CORPORATION License: BSD-3-Clause License: BSD-3-Clause diff --git a/packaging/deb/templates/digits.default b/packaging/deb/templates/digits.default deleted file mode 100644 index 74ef30801..000000000 --- a/packaging/deb/templates/digits.default +++ /dev/null @@ -1,2 +0,0 @@ -export DIGITS_JOBS_DIR=/var/lib/digits/jobs -export DIGITS_LOGFILE_FILENAME=/var/log/digits/digits.log diff --git a/packaging/deb/templates/digits.postinst b/packaging/deb/templates/digits.postinst index 99a691f72..cff9cef8d 100755 --- a/packaging/deb/templates/digits.postinst +++ b/packaging/deb/templates/digits.postinst @@ -14,7 +14,7 @@ case "$1" in # Update permissions on new directories chown www-data /var/lib/digits/jobs /var/log/digits - # Disable default nginx site + # Disable default NGINX site NGINX_NEEDS_RELOAD=false DEFAULT_SITE=/etc/nginx/sites-enabled/default if [ -L "$DEFAULT_SITE" ] @@ -26,7 +26,7 @@ case "$1" in # Enable nginx site SITE_FILE=/etc/nginx/sites-available/digits.nginx-site - SITE_LINK=/etc/nginx/sites-enabled/digits.site + SITE_LINK=/etc/nginx/sites-enabled/digits.nginx-site if [ "$PORT" != "-1" ] then sed "s/.*AUTOCONFIG port.*/ listen ${PORT}; #AUTOCONFIG port (DO NOT DELETE THIS LINE)/" $SITE_FILE -i diff --git a/packaging/deb/templates/digits.prerm b/packaging/deb/templates/digits.prerm index 35e842ca7..fd4d4ff93 100755 --- a/packaging/deb/templates/digits.prerm +++ b/packaging/deb/templates/digits.prerm @@ -3,8 +3,8 @@ set -e case "$1" in remove) - # Disable nginx site - SITE_LINK=/etc/nginx/sites-enabled/digits.site + # Disable NGINX site + SITE_LINK=/etc/nginx/sites-enabled/digits-nginx.site if [ -L "$SITE_LINK" ] then rm -f $SITE_LINK diff --git a/packaging/deb/templates/digits.service b/packaging/deb/templates/digits.service new file mode 100644 index 000000000..bac088090 --- /dev/null +++ b/packaging/deb/templates/digits.service @@ -0,0 +1,15 @@ +# DIGITS systemd service +[Unit] +Description=DIGITS server +After=local-fs.target network.target + +[Service] +User=www-data +Environment="DIGITS_JOBS_DIR=/var/lib/digits/jobs" +Environment="DIGITS_LOGFILE_FILENAME=/var/log/digits/digits.log" +ExecStart=/usr/bin/python -m digits -p 34448 +Restart=on-failure +ExecStop=/bin/kill -INT $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/packaging/deb/templates/digits.templates b/packaging/deb/templates/digits.templates index e300dfec6..88e3255dc 100644 --- a/packaging/deb/templates/digits.templates +++ b/packaging/deb/templates/digits.templates @@ -1,11 +1,11 @@ Template: digits/port Type: string Default: 80 -Description: DIGITS front-end port for nginx reverse proxy (0-65535): +Description: DIGITS front-end port for NGINX reverse proxy (0-65535): The DIGITS backend server runs on port 34448 (DIGIT), but this package also - configures nginx to function as a reverse proxy for DIGITS. + configures NGINX to function as a reverse proxy for DIGITS. . - If you don't want to use nginx as a reverse proxy, choose "-1" and the nginx + If you don't want to use NGINX as a reverse proxy, choose "-1" and the NGINX site will not be installed. Template: digits/port-invalid diff --git a/packaging/deb/templates/rules b/packaging/deb/templates/rules index d381f1d65..502e77b3d 100755 --- a/packaging/deb/templates/rules +++ b/packaging/deb/templates/rules @@ -1,5 +1,5 @@ #!/usr/bin/make -f %: - dh $@ --parallel --with=python2 --buildsystem=pybuild + dh $@ --parallel --with=python2,systemd --buildsystem=pybuild