summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore8
-rw-r--r--CHANGELOG.md4
-rw-r--r--bin/updater/Makefile27
-rw-r--r--bin/updater/REAME.rst71
-rw-r--r--bin/updater/example-config.ini (renamed from bin/example_config.ini)0
-rw-r--r--bin/updater/owncloud_news/__init__.py0
-rw-r--r--bin/updater/owncloud_news/__main__.py3
-rwxr-xr-xbin/updater/owncloud_news/application.py (renamed from bin/updater.py)1
-rw-r--r--bin/updater/requirements.txt (renamed from bin/requirements.txt)0
-rw-r--r--bin/updater/setup.py39
-rw-r--r--bin/updater/systemd/owncloud-news.service9
11 files changed, 160 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 2eae6a664..1010a20f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,14 @@ js/*.xml
.rvm
*.clover
+# python
+PKG-INFO
+*pyc
+*~
+__pycache__
+dist/
+ocdev.egg-info
+
# just sane ignores
.*.sw[po]
*.bak
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77858a9ee..bbd2d5e96 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
-owncloud-news (4.2.7)
+owncloud-news (4.3.0)
+* **Backwards incompatible change**: Move updater.py from bin/ to bin/updater
* **Enhancement**: Add metronieuws.nl article enhancer
+* **Enhancement**: Ship a systemd unit file and makefile to run the updater on boot
owncloud-news (4.2.6)
* **Bugfix**: Wording fixes
diff --git a/bin/updater/Makefile b/bin/updater/Makefile
new file mode 100644
index 000000000..5e16847e7
--- /dev/null
+++ b/bin/updater/Makefile
@@ -0,0 +1,27 @@
+all: install
+
+install: install-systemd
+
+install-systemd:
+ mkdir -p /etc/owncloud/news
+
+ # install systemd unit file
+ cp $(CURDIR)/example-config.ini /etc/owncloud/news/updater.ini
+ cp $(CURDIR)/systemd/owncloud-news.service /etc/systemd/system/
+ python3 setup.py install
+
+ @echo "Installed files. Please edit your config in /etc/owncloud/news/updater.ini and run:"
+ @echo " systemctl enable owncloud-news"
+ @echo " systemctl start owncloud-news"
+ @echo "to run the updater on startup and:"
+ @echo " systemctl restart owncloud-news"
+ @echo "if you change the config in /etc/owncloud/news/updater.ini"
+
+make uninstall:
+ rm -rf /etc/owncloud/news
+ rm -rf /etc/systemd/systemd/owncloud-news.service
+ python3 setup.py uninstall
+
+ @echo "Uninstalled files. Please run: "
+ @echo " systemctl disable owncloud-news"
+ @echo "to remove it from boot" \ No newline at end of file
diff --git a/bin/updater/REAME.rst b/bin/updater/REAME.rst
new file mode 100644
index 000000000..454c7554f
--- /dev/null
+++ b/bin/updater/REAME.rst
@@ -0,0 +1,71 @@
+ownCloud News Updater
+=====================
+
+ownCloud does not require people to install threading or multiprocessing libraries. Because the feed update process is mainly limited by I/O, parallell fetching of RSS feed updates can speed up the updating process a lot. In addition the cronjob can get `into a deadlock <https://github.com/owncloud/core/issues/3221>`_ which will halt cause your feeds not to be updated. This can be soled by using a script that uses the `updater API <https://github.com/owncloud/news/wiki/Cron-1.2>`_
+
+Preinstallation
+---------------
+
+To run the updates via an external threaded script the cron updater has to be disabled. To do that go to the admin section an uncheck the "Use ownCloud cron" checkbox or open **owncloud/data/news/config/config.ini** set:
+
+::
+ useCronUpdates = true
+
+to
+
+::
+ useCronUpdates = false
+
+
+Installation: No init system
+----------------------------
+
+If you decide against using an init system to run the script simply run::
+
+ sudo setup.py install
+
+Then you can run the updater daemon using::
+
+ owncloud-news-updater --user USERNAME --password PASSWORD http://yourcloud.com
+
+or if you are using a config file::
+
+ owncloud-news-updater -c /path/to/config
+
+
+
+Installation: SystemD
+---------------------
+
+To install the script for systemd run::
+
+ sudo make install-systemd
+
+Then edit the config in **/etc/owncloud/news/updater.ini** with your details and run::
+
+ owncloud-news-updater -c /etc/owncloud/news/updater.ini
+
+to test your settings. If everything worked out fine, enable the systemd unit with::
+
+ sudo systemctl enable owncloud-news
+ sudo systemctl start owncloud-news
+
+Finally turn off the cron updates in the owncloud admin interface
+
+
+Self signed certificates
+------------------------
+
+Should you use a self signed certificate over SSL, first consider getting a free valid cert signed by `StartSSL <http://startssl.com>`_. If you don't want to get a valid certificate, you need to add it to the installed certs::
+
+ cat /path/to/your/cert/cacert.pem >> /usr/local/lib/python3.X/dist-packages/requests/cacert.pem
+
+The directories might vary depending on your distribution and Python version.
+
+
+Development
+-----------
+
+If you want to edit the python code and test it run::
+
+ python3 -m owncloud_news -c /path/to/config.ini \ No newline at end of file
diff --git a/bin/example_config.ini b/bin/updater/example-config.ini
index 67e9299b4..67e9299b4 100644
--- a/bin/example_config.ini
+++ b/bin/updater/example-config.ini
diff --git a/bin/updater/owncloud_news/__init__.py b/bin/updater/owncloud_news/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/bin/updater/owncloud_news/__init__.py
diff --git a/bin/updater/owncloud_news/__main__.py b/bin/updater/owncloud_news/__main__.py
new file mode 100644
index 000000000..695c2d19b
--- /dev/null
+++ b/bin/updater/owncloud_news/__main__.py
@@ -0,0 +1,3 @@
+from owncloud_news.application import main
+
+main() \ No newline at end of file
diff --git a/bin/updater.py b/bin/updater/owncloud_news/application.py
index bb003983a..1235f00f2 100755
--- a/bin/updater.py
+++ b/bin/updater/owncloud_news/application.py
@@ -4,7 +4,6 @@ Updater script for the news app which allows multiple feeds to be updated at
once to speed up the update process. Built in cron has to be disabled in the
news config, see the README.rst file in the top directory for more information.
"""
-
__author__ = 'Bernhard Posselt'
__copyright__ = 'Copyright 2012-2014, Bernhard Posselt'
__license__ = 'AGPL3+'
diff --git a/bin/requirements.txt b/bin/updater/requirements.txt
index f572f1c8d..f572f1c8d 100644
--- a/bin/requirements.txt
+++ b/bin/updater/requirements.txt
diff --git a/bin/updater/setup.py b/bin/updater/setup.py
new file mode 100644
index 000000000..8c1173587
--- /dev/null
+++ b/bin/updater/setup.py
@@ -0,0 +1,39 @@
+from os import exit
+from xml.etree import ElementTree
+
+try:
+ from setuptools import setup, find_packages
+except ImportError as e:
+ print('Could not find setuptools. Did you install the package?')
+ exit(1)
+
+with open('requirements.txt', 'r') as infile:
+ install_requires = infile.read().split('\n')
+
+with open('README.rst', 'r') as infile:
+ long_description = infile.read()
+
+# parse version from info.xml
+tree = ElementTree.parse('../../appinfo/info.xml')
+for element in tree.findall('version'):
+ version = element.text
+
+setup (
+ name = 'owncloud-news-updater',
+ version = version,
+ description = 'ownCloud news updater',
+ long_description = long_description,
+ author = 'Bernhard Posselt',
+ author_email = 'dev@bernhard-posselt.com',
+ url = 'https://github.com/owncloud/news',
+ packages = find_packages(),
+ include_package_data = True,
+ license = 'AGPL',
+ install_requires = install_requires,
+ keywords = ['owncloud', 'news', 'updater'],
+ entry_points = {
+ 'console_scripts': [
+ 'owncloud-news-updater = owncloud_news.application:main'
+ ]
+ }
+)
diff --git a/bin/updater/systemd/owncloud-news.service b/bin/updater/systemd/owncloud-news.service
new file mode 100644
index 000000000..84c9cf132
--- /dev/null
+++ b/bin/updater/systemd/owncloud-news.service
@@ -0,0 +1,9 @@
+[Unit]
+After=default.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/python3 /usr/local/bin/owncloud-news-updater -c /etc/owncloud/news/config.ini
+
+[Install]
+WantedBy=default.target \ No newline at end of file