From c10e692ca24e4141f7deba688f7b7bfbd312bff0 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 9 Jun 2015 17:29:01 +0200 Subject: [PATCH] systemd start script and use netifaces from pip Fix #59, #229 --- README.rst | 18 ++++++++++++++++-- init/gns3.service.systemd | 14 ++++++++++++++ setup.py | 2 ++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 init/gns3.service.systemd diff --git a/README.rst b/README.rst index d8bb0b43..2ec6bcd1 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ You must be connected to the Internet in order to install the dependencies. Dependencies: -- Python 3.3 or above +- Python 3.4 or above - aiohttp - setuptools - netifaces @@ -53,7 +53,6 @@ The following commands will install some of these dependencies: .. code:: bash sudo apt-get install python3-setuptools - sudo apt-get install python3-netifaces Finally these commands will install the server as well as the rest of the dependencies: @@ -82,6 +81,12 @@ Usefull options: * --log logfile: store output in a logfile * --pid pidfile: store the pid of the running process in a file and prevent double execution +All the init script require the creation of a GNS3 user. You can change it to another user. + +.. code:: bash + + sudo adduser gns3 + upstart ~~~~~~~ @@ -95,6 +100,15 @@ You need to copy init/gns3.conf.upstart to /etc/init/gns3.conf sudo service gns3 start +systemd +~~~~~~~~ +You need to copy init/gns3.service.systemd to /lib/systemd/system/gns3.service + +.. code:: bash + + sudo chown root /lib/systemd/system/gns3.service + sudo + Windows ------- diff --git a/init/gns3.service.systemd b/init/gns3.service.systemd new file mode 100644 index 00000000..2a041a92 --- /dev/null +++ b/init/gns3.service.systemd @@ -0,0 +1,14 @@ +[Unit] +Description=GNS3 server + +[Service] +Type=forking +Environment=statedir=/var/cache/gns3 +PIDFile=/var/run/gns3.pid +ExecStart=/usr/local/bin/gns3server --log /var/log/gns3.log \ + --pid /var/run/gns3.pid --daemon +Restart=on-abort +User=gns3 + +[Install] +WantedBy=multi-user.target diff --git a/setup.py b/setup.py index 59a3d669..fb5ceaf4 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,7 @@ from setuptools.command.test import test as TestCommand if sys.version_info < (3, 4): raise SystemExit("Python 3.4 or higher is required") + class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) @@ -38,6 +39,7 @@ class PyTest(TestCommand): dependencies = [ + "netifaces>=0.10.4", "jsonschema>=2.4.0", "aiohttp>=0.15.1", "Jinja2>=2.7.3",