Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Posselt committed Apr 3, 2016
0 parents commit 700dfbd
Show file tree
Hide file tree
Showing 14 changed files with 1,425 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.idea
*.iml

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
#*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask instance folder
instance/

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject
674 changes: 674 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.rst requirements.txt LICENSE.txt example-config.ini
58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
all: install


install: install-systemd


clean:
rm -rf dist
rm -rf MANIFEST
rm -rf build
rm -rf owncloud_news_updater.egg-info


update: clean
pip3 uninstall owncloud_news_updater
python3 setup.py install


preinitsetup: clean
mkdir -p /etc/owncloud/news
cp $(CURDIR)/example-config.ini /etc/owncloud/news/updater.ini
python3 setup.py install --install-scripts=/usr/bin


install-systemd: preinitsetup
cp $(CURDIR)/systemd/owncloud-news-updater.service /etc/systemd/system/

@echo ""
@echo "Installed files. Please edit your config in /etc/owncloud/news/updater.ini and run:"
@echo " systemctl enable owncloud-news-updater.service"
@echo " systemctl start owncloud-news-updater.service"
@echo "to run the updater on startup and:"
@echo " systemctl restart owncloud-news-updater.service"
@echo "to reload the changes if you change the config in /etc/owncloud/news/updater.ini"


install-sysvinit: preinitsetup
cp $(CURDIR)/sysvinit/owncloud-news-updater /etc/init.d/

@echo ""
@echo "Installed files. Please edit your config in /etc/owncloud/news/updater.ini and run:"
@echo " sudo update-rc.d owncloud-news-updater defaults"
@echo " sudo /etc/init.d/owncloud-news-updater start"
@echo "to run the updater on startup and:"
@echo " sudo /etc/init.d/owncloud-news-updater restart"
@echo "to reload the changes if you change the config in /etc/owncloud/news/updater.ini"


uninstall: clean
rm -rf /etc/owncloud/news/updater.ini
rm -rf /etc/systemd/systemd/owncloud-news-updater.service
rm -rf /etc/init.d/owncloud-news-updater
pip3 uninstall owncloud_news_updater

@echo ""
@echo "Uninstalled files. Please run: "
@echo " systemctl disable owncloud-news-updater"
@echo "to remove it from boot"
134 changes: 134 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
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 significantly.

This can be done by using a script that uses the `updater REST API <https://github.com/owncloud/news/wiki/Cron-1.2>`_
or (new in 8.1.0) the console based update API

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

Then install the following packages (my vary depending on your distribution):

* python3-pip
* python3-setuptools
* make

If you are **on Debian 7** you want to create a symlink for pip to make use of the Makefile::

sudo ln -s /usr/bin/pip-3.2 /usr/bin/pip3


Updating
--------

.. note:: In general it is recommended to update the updater after every News app update

If you have installed the updater on your system you can update it by running::

sudo make update

The **init and config files won't be updated** and you need to update them manually in case there is a breaking change therefore follow the `CHANGELOG.md <https://github.com/owncloud/news/blob/master/CHANGELOG.md>`_ to stay up to date with the updater changes.

Finally reload the systemd service::

sudo systemctl restart owncloud-news-updater


No installation
---------------

If you do not want to install the script at all you can call it directly using::

python3 -m owncloud_news_updater -c /path/to/config.ini

.. note:: Keep in mind that you need to restart the script if you want to run a new version


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


To see all config options run::

owncloud-news-updater -h

.. note:: Keep in mind that you need to restart the script if you want to run a new version


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-updater.service
sudo systemctl start owncloud-news-updater.service

If you make changes to the **updater.ini** file don't forget to reload the service with::

sudo systemctl restart owncloud-news-updater.service


Uninstallation
--------------

To uninstall the updater run::

sudo make uninstall


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.


Debugging
---------

If you are using JournalD which is included in SystemD you can read the error log using::

journalctl -u owncloud-news-updater.service


Development
-----------

If you want to edit the python code and test it run::

python3 -m owncloud_news_updater -c /path/to/config.ini
11 changes: 11 additions & 0 deletions example-config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# all values are optional and can be left out to require the argument being
# passed in from the command line

[updater]
user = admin
password = admin
threads = 10
interval = 900
loglevel = error
testrun = false
url = http://localhost/owncloud
Empty file.
3 changes: 3 additions & 0 deletions owncloud_news_updater/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from owncloud_news_updater.application import main

main()
Loading

0 comments on commit 700dfbd

Please sign in to comment.