62 Commits

Author SHA1 Message Date
Unrud
9cd9ad9a02 Only register exit function if a PID file was created
The function only deletes the PID file.
2017-05-30 07:41:50 +02:00
Unrud
6762fc1cad Expand user on PID path 2017-05-30 05:10:07 +02:00
Unrud
fcccb3f7af Daemonize after creation of network sockets
The original process should exit after the server is ready.
See also https://www.freedesktop.org/software/systemd/man/daemon.html#SysV%20Daemons
2017-05-30 05:10:07 +02:00
Unrud
360e88f350 Write PID file in original process
This ensures that the PID is written, when the process exists.
2017-05-30 05:10:07 +02:00
Unrud
6ade44c773 Make relative PID path absolute
The daemon changes the current directory to root.
2017-05-30 05:10:07 +02:00
Unrud
65c53df5b3 Keep original exception when PID file creation fails 2017-05-30 05:10:07 +02:00
Unrud
79bcedd4bc Refactor: Extract daemonize function 2017-05-30 05:10:07 +02:00
Guillaume Ayoub
3e0c8cf285 Update copyright years 2017-05-27 17:28:07 +02:00
Unrud
d2a17c36ae Fail if configuration is not found
If a configuration file is passed with a command line argument and the file is not found, Radicale shows a warning and continues with the default configuration.
There is no reason for doing this, Radicale should just fail.

Instead, this PR allows passing an empty string like ``--config ""``. Radicale will use the default configuration in this case, without trying to load the configuration from the common paths. Previously you had to do specify a path that doesn't exist like ``--config /does/not/exist``, which looks a bit ugly and showed a warning message.
2017-05-24 21:01:23 +02:00
Guillaume Ayoub
864eb5931a Merge setup.cfg and pytest.ini, fix tests 2017-04-15 10:51:00 +02:00
Unrud
7d687205bd Use logger for WSGIServer
Log exception from the WSGIServer. Exceptions from socket timeouts are currently written to stderr.
2017-03-10 13:39:26 +01:00
Guillaume Ayoub
3213495245 Merge branch 'url' of https://github.com/Unrud/Radicale into Unrud-url 2017-02-26 14:43:59 +01:00
Guillaume Ayoub
34a82c9b69 Merge pull request #540 from twoodcock/master
remove umask(0) in daemon mode
2017-02-26 14:35:19 +01:00
Tim Woodcock
7f0d717459 remove umask(0) in daemon mode 2016-11-29 16:33:10 -08:00
Guillaume Ayoub
c459d32a19 Use argparse to parse command arguments
This commit also allows users to specify all the config values through
the command line.

Fix #154.
2016-10-12 14:30:18 +02:00
Yohann Rebattu
6d76cfa5aa use dash instead of underscore in options as well 2016-10-12 10:48:14 +02:00
Yohann Rebattu
fb3e733596 use dash instead of underscore 2016-10-12 10:44:13 +02:00
Yohann Rebattu
d6ee788ff5 comment… 2016-10-11 18:22:26 +02:00
Yohann Rebattu
ca2d519345 use group exclusively except for config 2016-10-11 18:21:17 +02:00
Yohann Rebattu
11710f75a8 allow config override from commandline 2016-10-11 18:17:01 +02:00
Unrud
dbaf58dbfe Remove base_prefix and use SCRIPT_NAME instead
This conforms with the WSGI reference (PEP 333)
2016-09-04 22:26:40 +02:00
Guillaume Ayoub
947c57312c Fix a variable name
Fix #494
2016-08-29 12:09:17 +02:00
Guillaume Ayoub
fd1742fcea Fix typo 2016-08-29 12:07:30 +02:00
Unrud
3b71ab960e Log exceptions (Fixes #447)
Exceptions were just written to stderr but not into logs.
2016-08-25 05:24:24 +02:00
Unrud
e2b87d145f Cosmetics: Don't use % for logging 2016-08-10 23:43:32 +02:00
Guillaume Ayoub
8ac3ce1a89 Clean many, many things 2016-08-05 02:14:49 +02:00
Guillaume Ayoub
3e52f34309 Remove pylint 2016-08-02 14:39:20 +02:00
Guillaume Ayoub
ef63865e31 Merge pull request #428 from Unrud/patch-22
Add timeout to connections, limit size of request body and limit number of parallel connections
2016-07-14 02:06:24 +02:00
Guillaume Ayoub
6a4fe6beb5 Add a very, very important full stop. 2016-07-05 18:07:36 +02:00
Florian Mounier
a7549bc652 Split the main run function to allow the use of radicale serving programatically. Add an extra_config parameter to the config load to override config. 2016-07-05 17:50:40 +02:00
Guillaume Ayoub
9300d25d61 Update __main__.py 2016-07-04 14:35:38 +02:00
Florian Mounier
221379ef85 Sort imports 2016-07-04 14:32:33 +02:00
Unrud
83ea9da2b4 Limit number of parallel connections 2016-06-11 13:19:26 +02:00
Unrud
b55d2181ed Add timeout to integrated sever 2016-06-11 13:14:58 +02:00
Guillaume Ayoub
a3c32ee77f Merge pull request #402 from Unrud/locking
Implement locking of whole storage
2016-05-25 14:03:48 +02:00
Unrud
de2f411820 Use nonlocal instead of container
Python 3
2016-05-21 01:49:22 +02:00
Unrud
ff3b31fed6 Use threading in integrated webserver 2016-05-21 01:26:52 +02:00
Guillaume Ayoub
2f97d7d1e1 Remove global state about configuration and logs
Many things have been changed to make this possible, probably leading to
many hidden bugs waiting to be found.

Related to #122.
2016-04-22 11:37:02 +09:00
Guillaume Ayoub
434cb533e9 Remove Python 2 support 2016-03-31 19:57:40 +02:00
Unrud
bbe71c1ad1 Integrated server without threads and busy waiting 2016-01-27 07:17:38 +01:00
Guillaume Ayoub
e7ce00d54f Style 2015-12-31 12:49:41 +01:00
Unrud
367ca6fcbf Replace standard file descriptors of daemon
Overwriting ```sys.stdout``` and ```sys.stderr``` is not sufficient.
(e.g. the logger still uses the old file descriptors)
2015-12-22 08:50:16 +01:00
Unrud
ecb8ad747e Decouple the daemon from its parent environment 2015-12-22 08:50:16 +01:00
Unrud
3a9238f670 Check and create PID file in a race-free manner 2015-12-22 08:50:16 +01:00
Unrud
0a09804821 Close PID file 2015-12-22 08:49:58 +01:00
Guillaume Ayoub
77ad16f2a9 Fix the PID number stored on filesystem 2014-08-07 12:31:51 +02:00
Guillaume Ayoub
cdad148bd0 else if → elif 2014-07-28 10:24:43 +02:00
Mathieu Dupuy
4643112511 deplace pid file creation in child process 2014-07-25 15:52:04 +02:00
Guillaume Ayoub
d38c4d1c1d Fix config files management 2013-06-04 16:59:21 +02:00
Guillaume Ayoub
8adb096de2 Fix the warning if the configuration file is not found 2013-06-04 15:12:06 +02:00