From 2b4440ab8106fb930f153fcd358d618ea93eeddf Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 16 Apr 2023 22:14:38 +0100 Subject: [PATCH] update, - net7.0 --- README.md | 29 +++++--- contrib/isn | 3 - contrib/isnd | 110 ------------------------------- contrib/isnd.service | 28 ++++++++ contrib/upgrade-isn-isnd.sh | 13 ---- src/isnd/Views/Home/Index.cshtml | 7 +- 6 files changed, 54 insertions(+), 136 deletions(-) delete mode 100755 contrib/isn delete mode 100644 contrib/isnd create mode 100644 contrib/isnd.service delete mode 100755 contrib/upgrade-isn-isnd.sh diff --git a/README.md b/README.md index f606271..a5c83e3 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ wget http://localhost:5000/package/index.json?q=your&prerelease=true&semVerLevel ## Installation +### Compilation + Depuis le dossier de la solution, compiler la solution : ````bash @@ -25,19 +27,31 @@ dotnet build /restore -c Release dotnet publish -c Release ```` -### Déploiement +### Déploiement du serveur + +Commençont par la livraison initiale, aujourd'hui : ````bash sudo mkdir -p /srv/www/isnd -sudo cp -a src/isnd/bin/Release/net6.0/publish/* /srv/www/isnd -sudo cp contrib/isnd /etc/init.d/isnd -sudo chmod +x /etc/init.d/isnd -sudo chown -R www-data.www-data /srv/www/isnd +sudo cp -a src/isnd/bin/Release/net7.0/publish/* /srv/www/isnd +sudo cp contrib/isnd.service /etc/systemd/system sudo systemctl daemon-reload ```` -* Créer une base de donées Postgresql, -* ajuster un fichier de configuration `/srv/www/isnd/appsettings.Production.json` +Une base de donées Postgresql est requise, avec, pour faire simple, +son utilisateur, et le droit de créer des tables (ce dernier droit pourrait expirer, mais gare aux mises à jour). + +Il faudra éditer la configuration pour indiquer : + +* la connextion à une base de donnée Postresgql, sous la forme : + `"Server=;Port=;Database=;Username=;Password=;"` +* la connection au serveur de messagerie, +* l'URL du ou des sites à propulser, +* Les autres détails. + +Pour faire ceci, vous pourrez éditer une copie du fichier `appsettings.json` vers `appsettings.Production.json`, +pour renseigner toutes les valeurs spécifiées. + * Démarrer le serveur : ````bash @@ -50,7 +64,6 @@ sudo systemctl start isnd sudo systemctl enable isnd ```` - ### Installation du client ````bash diff --git a/contrib/isn b/contrib/isn deleted file mode 100755 index 8197043..0000000 --- a/contrib/isn +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -/usr/bin/mono /usr/local/lib/isn/isn.exe $* diff --git a/contrib/isnd b/contrib/isnd deleted file mode 100644 index 76c5486..0000000 --- a/contrib/isnd +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -### BEGIN INIT INFO -# Provides: isnd -# Required-Start: $local_fs $network $named $time $syslog $postgresql -# Required-Stop: $local_fs $network $named $time $syslog $postgresql -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Description: Script to run asp.net 5 application in background -### END INIT INFO - -# Author: Ivan Derevianko aka druss -# Modified by: Paul Schneider - -. /lib/init/vars.sh -. /lib/lsb/init-functions - -NAME=isnd - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -TMP_SAVE_runlevel_VAR=$runlevel -unset runlevel - -running() { - if [ -f $PIDFILE ] - then - PID=$(cat $PIDFILE) - if kill -0 $PID 2>/dev/null - then - return 0 - fi - fi - return 1 -} - - -export WWW_USER=www-data -export ROOT=/srv/www/${NAME} -export DESC="$NAME" -export PIDFILE=/var/run/kestrel-${NAME}.pid -export LOGDIR=/var/log -export DOTNET_CLI_HOME=$ROOT -export ASPDOTNETCORE_ENVIRONMENT=Production -export ASPDOTNETCORE_LOGLEVEL=Information -status() { - if running; - then - echo "Service running $DESC ($NAME; pid: $PID)" - else - echo "Service stopped $DESC ($NAME)" - fi - echo WWW_USER: $WWW_USER ROOT:$ROOT DESC: $DESC NAME: $NAME PIDFILE: $PIDFILE LOGDIR=$LOGDIR -} - - -start() { - if running; then - echo "Service already running $DESC" "$NAME" - log_end_msg 0 - else - cd $ROOT - log_daemon_msg "Starting service $NAME for user $WWW_USER" - if ! start-stop-daemon -SbmCv -u $WWW_USER -p $PIDFILE -d $ROOT -g www-data -x /usr/bin/dotnet isnd.dll run > "${LOGDIR}/kestrel-${NAME}.log" - then - log_daemon_msg "Could not start $NAME : $?, see ${LOGDIR}/kestrel-${NAME}.log" - log_end_msg 2 - else - log_daemon_msg "Service $DESC started ($NAME), logs: ${LOGDIR}/kestrel-${NAME}.log" - log_end_msg 0 - fi - fi - -} - -stop() { - if running - then - log_daemon_msg "Stopping service $NAME" - start-stop-daemon -K -p "$PIDFILE" - log_daemon_msg "$DESC stopped" - log_end_msg 0 - else - log_daemon_msg "$DESC Service not running" - log_end_msg 1 - fi -} - - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - status) - status - ;; - - *) - echo "Usage: $0 {start|stop|restart}" -esac - -export runlevel=$TMP_SAVE_runlevel_VAR - - diff --git a/contrib/isnd.service b/contrib/isnd.service new file mode 100644 index 0000000..e5e3479 --- /dev/null +++ b/contrib/isnd.service @@ -0,0 +1,28 @@ +[Unit] +Description=isnd - a Nuget package repository daemon +After=syslog.target +After=network.target + +Wants=postgresql.service +After=postgresql.service + +[Service] +RestartSec=5s +Type=simple +User=isn +Group=isn +WorkingDirectory=/srv/www/isnd/ +# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file +# (manually creating /run/gitea doesn't work, because it would not persist across reboots) +#RuntimeDirectory=gitea +ExecStart=/srv/www/isnd/isnd +Restart=always +Environment=HOME=/srv/www/isnd + +#CapabilityBoundingSet=CAP_NET_BIND_SERVICE +AmbientCapabilities=CAP_NET_BIND_SERVICE + +[Install] +WantedBy=multi-user.target + + diff --git a/contrib/upgrade-isn-isnd.sh b/contrib/upgrade-isn-isnd.sh deleted file mode 100755 index 8a93152..0000000 --- a/contrib/upgrade-isn-isnd.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -e - -# compiler tout -dotnet build -c Release -dotnet publish -c Release -f netcoreapp2.1 src/isnd -# MAJ du serveur -sudo systemctl stop isnd -sudo cp -a src/isnd/bin/Release/netcoreapp2.1/publish/* /srv/www/isnd -sudo systemctl start isnd -# MAJ du client -sudo cp -a src/isn/bin/Release/netcoreapp2.1/* /usr/local/lib/isn -sudo chown -R root.root /usr/local/lib/isn diff --git a/src/isnd/Views/Home/Index.cshtml b/src/isnd/Views/Home/Index.cshtml index 98148f3..d6b8afe 100644 --- a/src/isnd/Views/Home/Index.cshtml +++ b/src/isnd/Views/Home/Index.cshtml @@ -5,7 +5,10 @@

Bienvenue

Bienvenue dans isn

+

@Model.PkgCount identifiant(s) de paquet dans le SI +

- - \ No newline at end of file +
+ +
\ No newline at end of file