diff options
| author | 2018-03-04 15:26:24 +0100 | |
|---|---|---|
| committer | 2018-03-04 15:26:24 +0100 | |
| commit | f0fd273199682881b805e968ca36df4ccdbfa7a1 (patch) | |
| tree | 0f87fcc515fb493193f9c58a9a0ed19f4caf07e8 /Docker | |
| parent | 5ebeb9e3e5d46195a83211140c1d28d58be19b2a (diff) | |
| parent | a37b95f6779e6e2035f0efb72cf5144e7fad2ea3 (diff) | |
Merge pull request #1810 from FreshRSS/dev1.10.1
FreshRSS 1.10.1
Diffstat (limited to 'Docker')
| -rw-r--r-- | Docker/Dockerfile | 22 | ||||
| -rw-r--r-- | Docker/FreshRSS.Apache.conf | 27 | ||||
| -rw-r--r-- | Docker/README.md | 119 |
3 files changed, 168 insertions, 0 deletions
diff --git a/Docker/Dockerfile b/Docker/Dockerfile new file mode 100644 index 000000000..993dcea31 --- /dev/null +++ b/Docker/Dockerfile @@ -0,0 +1,22 @@ +FROM alpine:3.7 + +RUN apk add --no-cache \ + apache2 php7-apache2 \ + php7 php7-curl php7-gmp php7-intl php7-mbstring php7-xml php7-zip \ + php7-ctype php7-dom php7-fileinfo php7-json php7-session \ + php7-pdo_sqlite \ + php7-pdo_mysql \ + php7-pdo_pgsql + +ENV FRESHRSS_ROOT /var/www/FreshRSS +RUN mkdir -p ${FRESHRSS_ROOT} /run/apache2/ +WORKDIR ${FRESHRSS_ROOT} + +COPY . ${FRESHRSS_ROOT} +COPY ./Docker/*.Apache.conf /etc/apache2/conf.d/ + +EXPOSE 80 +CMD php -f ./cli/prepare.php > /dev/null && \ + chown -R :www-data ${FRESHRSS_ROOT} && \ + chmod -R g+r ${FRESHRSS_ROOT} && chmod -R g+w ${FRESHRSS_ROOT}/data/ && \ + exec httpd -D FOREGROUND diff --git a/Docker/FreshRSS.Apache.conf b/Docker/FreshRSS.Apache.conf new file mode 100644 index 000000000..59151d749 --- /dev/null +++ b/Docker/FreshRSS.Apache.conf @@ -0,0 +1,27 @@ +<IfModule !deflate_module> + LoadModule deflate_module modules/mod_deflate.so +</IfModule> +<IfModule !expires_module> + LoadModule expires_module modules/mod_expires.so +</IfModule> +<IfModule !headers_module> + LoadModule headers_module modules/mod_headers.so +</IfModule> +<IfModule !mime_module> + LoadModule mime_module modules/mod_mime.so +</IfModule> +<IfModule !rewrite_module> + LoadModule rewrite_module modules/mod_rewrite.so +</IfModule> + +ServerName freshrss.localhost +Listen 0.0.0.0:80 +DocumentRoot /var/www/FreshRSS/p/ +ErrorLog /dev/stderr +TransferLog /dev/stdout +AllowEncodedSlashes On + +<Directory /var/www/FreshRSS/p> + AllowOverride AuthConfig FileInfo Indexes Limit + Require all granted +</Directory> diff --git a/Docker/README.md b/Docker/README.md new file mode 100644 index 000000000..ccf4ab3f0 --- /dev/null +++ b/Docker/README.md @@ -0,0 +1,119 @@ +# Deploy FreshRSS with Docker +* See also: + * https://hub.docker.com/r/freshrss/freshrss/ + * https://cloud.docker.com/app/freshrss/repository/docker/freshrss/freshrss + +## Install Docker + +```sh +curl -fsSL https://get.docker.com/ -o get-docker.sh +sh get-docker.sh +``` + +## Optional: Build Docker image of FreshRSS +Optional, as a *less recent* online image can be automatically fetched during the next step (run), +but online images are not available for as many platforms as if you build yourself. + +```sh +# First time only +git clone https://github.com/FreshRSS/FreshRSS.git + +cd ./FreshRSS/ +git pull +sudo docker pull alpine:3.7 +sudo docker build --tag freshrss/freshrss -f Docker/Dockerfile . +``` + +## Run FreshRSS + +Example using SQLite, and exposing FreshRSS on port 8080. You may have to adapt the network parameters to fit your needs. + +```sh +# You can optionally run from the directory containing the FreshRSS source code: +cd ./FreshRSS/ + +# The data will be saved on the host in `./data/` +mkdir -p ./data/ + +sudo docker run -dit --restart unless-stopped --log-opt max-size=10m \ + -v $(pwd)/data:/var/www/FreshRSS/data \ + -p 8080:80 \ + --name freshrss freshrss/freshrss +``` + +### Examples with external databases + +You may want to use other link methods such as Docker bridges, and use Docker volumes for the data, but here are some simple examples: + +#### MySQL +See https://hub.docker.com/_/mysql/ + +```sh +sudo docker run -d -v /path/to/mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=rootpass -e MYSQL_DATABASE=freshrss -e MYSQL_USER=freshrss -e MYSQL_PASSWORD=pass --name mysql mysql +sudo docker run -dit --restart unless-stopped --log-opt max-size=10m \ + -v $(pwd)/data:/var/www/FreshRSS/data \ + --link mysql -p 8080:80 \ + --name freshrss freshrss/freshrss +``` + +#### PostgreSQL +See https://hub.docker.com/_/postgres/ + +```sh +sudo docker run -d -v /path/to/pgsql-data:/var/lib/postgresql/data -e POSTGRES_DB=freshrss -e POSTGRES_USER=freshrss -e POSTGRES_PASSWORD=pass --name postgres postgres +sudo docker run -dit --restart unless-stopped --log-opt max-size=10m \ + -v $(pwd)/data:/var/www/FreshRSS/data \ + --link postgres -p 8080:80 \ + --name freshrss freshrss/freshrss +``` + +## Update + +```sh +# Rebuild an image (see build section above) or get a new online version: +sudo docker pull freshrss/freshrss +# And then +sudo docker stop freshrss +sudo docker rename freshrss freshrss_old +# See the run section above for the full command +sudo docker run ... +# If everything is working, delete the old container +sudo docker rm freshrss_old +``` + +## Command line + +```sh +sudo docker exec --user apache -it freshrss php ./cli/list-users.php +``` + +See the [CLI documentation](../cli/) for all the other commands. + +### Cron job to refresh feeds +Set a cron job up on your host machine, calling the `actualize_script.php` inside the FreshRSS Docker instance. + +#### Example on Debian / Ubuntu +Create `/etc/cron.d/FreshRSS` with: + +``` +7,37 * * * * root docker exec --user apache -it freshrss php ./app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +``` + +## Debugging + +```sh +# See FreshRSS data (it is on the host) +cd ./data/ +# See Web server logs +sudo docker logs -f freshrss + +# Enter inside FreshRSS docker container +sudo docker exec -it freshrss sh +## See FreshRSS root inside the container +ls /var/www/FreshRSS/ +``` + +## Deployment in production + +Use a reverse proxy on your host server, such as [Træfik](https://traefik.io/) or [nginx](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/), +with HTTPS, for instance using [Let’s Encrypt](https://letsencrypt.org/). |
