add selfoss

This commit is contained in:
Wonderfall 2016-04-24 13:47:47 +02:00
parent 795686b7fc
commit 22cb224fda
7 changed files with 221 additions and 0 deletions

41
selfoss/Dockerfile Normal file
View File

@ -0,0 +1,41 @@
FROM alpine:3.3
MAINTAINER Wonderfall <wonderfall@schrodinger.io>
ENV GID=991 UID=991 VERSION=2.15
RUN echo "@commuedge http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk -U add \
musl \
nginx \
php-fpm \
php-gd \
php-json \
php-zlib \
php-xml \
php-dom \
php-curl \
php-iconv \
php-mcrypt \
php-pdo_sqlite \
php-ctype \
supervisor \
ca-certificates \
tini@commuedge \
&& rm -f /var/cache/apk/* \
&& sed -i -e 's/max_execution_time = 30/max_execution_time = 300/' /etc/php/php.ini
RUN wget -q https://github.com/SSilence/selfoss/releases/download/$VERSION/selfoss-$VERSION.zip -P /tmp \
&& mkdir /selfoss && unzip -q /tmp/selfoss-$VERSION.zip -d /selfoss \
&& rm -rf /tmp/*
COPY nginx.conf /etc/nginx/nginx.conf
COPY php-fpm.conf /etc/php/php-fpm.conf
COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY startup /usr/local/bin/startup
COPY cron /etc/periodic/15min/selfoss
RUN chmod +x /usr/local/bin/startup /etc/periodic/15min/selfoss
VOLUME /selfoss/data
EXPOSE 80
CMD ["tini","--","startup"]

45
selfoss/README.md Normal file
View File

@ -0,0 +1,45 @@
# hardware/selfoss
![selfoss](https://i.imgur.com/8hJyBgk.png "selfoss")
The new multipurpose rss reader, live stream, mashup, aggregation web application.
### Requirement
- Docker 1.0 or higher
### How to use
```
docker run -d \
--name selfoss \
-p 80:80 \
-v /mnt/docker/selfoss:/selfoss/data \
hardware/selfoss
```
### Environment variables
- **VERSION** = selfoss version (*optional*, default: 2.15)
- **GID** = selfoss user id (*optional*, default: 991)
- **UID** = selfoss group id (*optional*, default: 991)
### Docker-compose
#### Docker-compose.yml
```
selfoss:
image: hardware/selfoss
container_name: selfoss
ports:
- "80:80"
volumes:
- /mnt/docker/selfoss:/selfoss/data
```
#### Run !
```
docker-compose up -d
```

3
selfoss/cron Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
su - selfoss -c "/usr/bin/php --file /selfoss/cliupdate.php" > /dev/null 2>&1

81
selfoss/nginx.conf Normal file
View File

@ -0,0 +1,81 @@
user selfoss;
worker_processes auto;
pid /var/run/nginx.pid;
daemon off;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/error.log error;
sendfile on;
keepalive_timeout 15;
keepalive_disable msie6;
keepalive_requests 100;
tcp_nopush on;
tcp_nodelay off;
server_tokens off;
gzip on;
gzip_comp_level 5;
gzip_min_length 512;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_vary on;
gzip_disable "msie6";
gzip_types
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
application/vnd.ms-fontobject
font/truetype
font/opentype
image/svg+xml;
server {
listen 80;
root /selfoss;
index index.php;
charset utf-8;
location ~ ^/favicons/.*$ {
try_files $uri /data/$uri;
}
location ~ ^/thumbnails/.*$ {
try_files $uri /data/$uri;
}
location ~* ^/(data\/logs|data\/sqlite|config\.ini|\.ht) {
deny all;
}
location / {
try_files $uri /public/$uri /index.php$is_args$args;
}
location ~* \.php$ {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
}

16
selfoss/php-fpm.conf Normal file
View File

@ -0,0 +1,16 @@
[global]
daemonize = no
[www]
user = selfoss
group = selfoss
listen = /var/run/php-fpm.sock
listen.owner = selfoss
listen.group = selfoss
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
request_terminate_timeout = 300

24
selfoss/startup Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# Create user and set permission
addgroup -g ${GID} selfoss && adduser -h /selfoss -s /bin/sh -D -G selfoss -u ${UID} selfoss
# Selfoss custom configuration file
rm /selfoss/config.ini
if [ -e /selfoss/data/config.ini ]; then
cp /selfoss/data/config.ini /selfoss/config.ini
else
cp /selfoss/defaults.ini /selfoss/config.ini
fi
# Init data dir
if [ ! "$(ls -A /selfoss/data)" ]; then
cd /selfoss/data/ && mkdir cache favicons logs sqlite thumbnails
fi
# Set permissions
chown -R selfoss:selfoss /selfoss /var/run/php-fpm.sock /var/lib/nginx /tmp
# RUN !
supervisord -c /etc/supervisor/supervisord.conf

11
selfoss/supervisord.conf Normal file
View File

@ -0,0 +1,11 @@
[supervisord]
nodaemon=true
[program:cron]
command=crond -f
[program:php-fpm]
command=php-fpm
[program:nginx]
command=nginx