Compare commits
No commits in common. "1543895281cf9368c4c0d17fa323bab834d06abd" and "7766d06b509b035199c73799260162962cf5e1e2" have entirely different histories.
1543895281
...
7766d06b50
|
@ -3,6 +3,6 @@ FROM alpine:latest
|
||||||
RUN apk add --no-cache python3 py3-lxml py3-pip py3-wheel git
|
RUN apk add --no-cache python3 py3-lxml py3-pip py3-wheel git
|
||||||
|
|
||||||
ADD . /app
|
ADD . /app
|
||||||
RUN pip3 install --no-cache-dir /app[full] gunicorn
|
RUN pip3 install --no-cache-dir /app gunicorn
|
||||||
|
|
||||||
CMD gunicorn --bind 0.0.0.0:8080 -w 4 --preload --access-logfile - morss
|
CMD gunicorn --bind 0.0.0.0:8080 -w 4 --preload --access-logfile - morss
|
||||||
|
|
27
README.md
27
README.md
|
@ -48,25 +48,28 @@ Some features of morss:
|
||||||
|
|
||||||
### Python package
|
### Python package
|
||||||
|
|
||||||
Simple install (without optional dependencies)
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pip install git+https://git.pictuga.com/pictuga/morss.git
|
pip install git+https://git.pictuga.com/pictuga/morss.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Full installation (including optional dependencies)
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pip install git+https://git.pictuga.com/pictuga/morss.git#[full]
|
|
||||||
```
|
|
||||||
|
|
||||||
The full install includes mysql and redis (possible cache backends). Otherwise,
|
|
||||||
only in-memory and sqlite3 caches are available.
|
|
||||||
|
|
||||||
The dependency `lxml` is fairly long to install (especially on Raspberry Pi, as
|
The dependency `lxml` is fairly long to install (especially on Raspberry Pi, as
|
||||||
C code needs to be compiled). If possible on your distribution, try installing
|
C code needs to be compiled). If possible on your distribution, try installing
|
||||||
it with the system package manager.
|
it with the system package manager.
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
|
||||||
|
- [python](http://www.python.org/) >= 2.6 (python 3 is supported)
|
||||||
|
- [lxml](http://lxml.de/) for xml parsing
|
||||||
|
- [bs4](https://pypi.org/project/bs4/) for badly-formatted html pages
|
||||||
|
- [dateutil](http://labix.org/python-dateutil) to parse feed dates
|
||||||
|
- [chardet](https://pypi.python.org/pypi/chardet)
|
||||||
|
- [six](https://pypi.python.org/pypi/six), a dependency of chardet
|
||||||
|
- pymysql
|
||||||
|
|
||||||
|
You may also need:
|
||||||
|
- Apache, with python-cgi support, to run on a server
|
||||||
|
- a fast internet connection
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
Build & run
|
Build & run
|
||||||
|
@ -372,8 +375,6 @@ will be cleared every time the program is run). Path can be defined with
|
||||||
`SQLITE_PATH`.
|
`SQLITE_PATH`.
|
||||||
- `CACHE=mysql`: MySQL cache. Connection can be defined with the following
|
- `CACHE=mysql`: MySQL cache. Connection can be defined with the following
|
||||||
environment variables: `MYSQL_USER`, `MYSQL_PWD`, `MYSQL_DB`, `MYSQL_HOST`
|
environment variables: `MYSQL_USER`, `MYSQL_PWD`, `MYSQL_DB`, `MYSQL_HOST`
|
||||||
- `CACHE=redis`: Redis cache. Connection can be defined with the following
|
|
||||||
environment variables: `REDIS_HOST`, `REDIS_PORT`, `REDIS_DB`, `REDIS_PWD`
|
|
||||||
|
|
||||||
To limit the size of the cache:
|
To limit the size of the cache:
|
||||||
|
|
||||||
|
|
|
@ -141,23 +141,6 @@ class CappedDict(OrderedDict, BaseCache):
|
||||||
OrderedDict.__setitem__(self, key, data)
|
OrderedDict.__setitem__(self, key, data)
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
import redis # isort:skip
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class RedisCacheHandler(BaseCache):
|
|
||||||
def __init__(self, host='localhost', port=6379, db=0, password=None):
|
|
||||||
self.r = redis.Redis(host=host, port=port, db=db, password=password)
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
return self.r.get(key)
|
|
||||||
|
|
||||||
def __setitem__(self, key, data):
|
|
||||||
self.r.set(key, data)
|
|
||||||
|
|
||||||
|
|
||||||
if 'CACHE' in os.environ:
|
if 'CACHE' in os.environ:
|
||||||
if os.environ['CACHE'] == 'mysql':
|
if os.environ['CACHE'] == 'mysql':
|
||||||
default_cache = MySQLCacheHandler(
|
default_cache = MySQLCacheHandler(
|
||||||
|
@ -176,13 +159,5 @@ if 'CACHE' in os.environ:
|
||||||
|
|
||||||
default_cache = SQLiteCache(path)
|
default_cache = SQLiteCache(path)
|
||||||
|
|
||||||
elif os.environ['CACHE'] == 'redis':
|
|
||||||
default_cache = RedisCacheHandler(
|
|
||||||
host = os.getenv('REDIS_HOST', 'localhost'),
|
|
||||||
port = int(os.getenv('REDIS_PORT', 6379)),
|
|
||||||
db = int(os.getenv('REDIS_DB', 0)),
|
|
||||||
password = os.getenv('REDIS_PWD', None)
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
default_cache = CappedDict()
|
default_cache = CappedDict()
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -14,7 +14,7 @@ setup(
|
||||||
license = 'AGPL v3',
|
license = 'AGPL v3',
|
||||||
packages = [package_name],
|
packages = [package_name],
|
||||||
install_requires = ['lxml', 'bs4', 'python-dateutil', 'chardet'],
|
install_requires = ['lxml', 'bs4', 'python-dateutil', 'chardet'],
|
||||||
extras_require = {'full': ['pymysql', 'redis']},
|
extras_require = {'full': ['pymysql']},
|
||||||
package_data = {package_name: ['feedify.ini']},
|
package_data = {package_name: ['feedify.ini']},
|
||||||
data_files = [
|
data_files = [
|
||||||
('share/' + package_name, ['README.md', 'LICENSE']),
|
('share/' + package_name, ['README.md', 'LICENSE']),
|
||||||
|
|
Loading…
Reference in New Issue