From 9dbed072b32f70db98c24e164ca6ee5487ceb97e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 3 Mar 2018 23:49:46 +0100 Subject: Fix documentation links (#1814) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index a95593651..23358d98e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ We are a friendly community. # Documentation * https://freshrss.github.io/FreshRSS/en/ -# [Installation](https://freshrss.github.io/FreshRSS/en/users/01_Installation.html) +# [Installation](https://freshrss.github.io/FreshRSS/en/admins/02_Installation.html) 1. Get FreshRSS with git or [by downloading the archive](https://github.com/FreshRSS/FreshRSS/archive/master.zip) 2. Dump the application on your server (expose only the `./p/` folder) 3. Add write access on `./data/` folder to the webserver user -- cgit v1.2.3 From 71918dbc5a240dfa391491b27cdb482d55b8794a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 4 Mar 2018 01:02:02 +0100 Subject: New Docker (#1813) * Draft of new Docker Based on Alpine Linux. Size ~78MB. https://github.com/FreshRSS/docker-freshrss/issues/4 https://github.com/FreshRSS/FreshRSS/issues/520 https://github.com/FreshRSS/docker-freshrss https://github.com/FreshRSS/docker-freshrss-production * Docker readme * +x execution rights prepare * Docker readme links to hub.docker.com https://hub.docker.com/r/freshrss/freshrss/ --- .dockerignore | 3 ++ Docker/Dockerfile | 22 +++++++++++ Docker/FreshRSS.Apache.conf | 27 ++++++++++++++ Docker/README.md | 91 +++++++++++++++++++++++++++++++++++++++++++++ README.fr.md | 2 + README.md | 3 +- cli/README.md | 3 ++ cli/prepare.php | 37 ++++++++++++++++++ lib/Minz/Request.php | 3 +- 9 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Docker/Dockerfile create mode 100644 Docker/FreshRSS.Apache.conf create mode 100644 Docker/README.md create mode 100755 cli/prepare.php (limited to 'README.md') diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..ab223517d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +*/.git +*/data +*/docs diff --git a/Docker/Dockerfile b/Docker/Dockerfile new file mode 100644 index 000000000..fc753e58d --- /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 :apache ${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 @@ + + LoadModule deflate_module modules/mod_deflate.so + + + LoadModule expires_module modules/mod_expires.so + + + LoadModule headers_module modules/mod_headers.so + + + LoadModule mime_module modules/mod_mime.so + + + LoadModule rewrite_module modules/mod_rewrite.so + + +ServerName freshrss.localhost +Listen 0.0.0.0:80 +DocumentRoot /var/www/FreshRSS/p/ +ErrorLog /dev/stderr +TransferLog /dev/stdout +AllowEncodedSlashes On + + + AllowOverride AuthConfig FileInfo Indexes Limit + Require all granted + diff --git a/Docker/README.md b/Docker/README.md new file mode 100644 index 000000000..d85b9a6f0 --- /dev/null +++ b/Docker/README.md @@ -0,0 +1,91 @@ +# Deploy FreshRSS with Docker +* See also https://hub.docker.com/r/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](https://hub.docker.com/r/freshrss/freshrss/) 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 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 +``` + +## 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 +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 +docker rm freshrss_old +``` + +## Command line + +```sh +sudo docker exec -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 -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/). diff --git a/README.fr.md b/README.fr.md index fc99d0e4c..97ffafb56 100644 --- a/README.fr.md +++ b/README.fr.md @@ -55,6 +55,8 @@ Nous sommes une communauté amicale. 7. Avec Apache, activer [`AllowEncodedSlashes`](https://httpd.apache.org/docs/trunk/mod/core.html#allowencodedslashes) pour une meilleure compatibilité avec les clients mobiles. ## Installation automatisée +* [Docker](./Docker/) +* [![Cloudron](https://cloudron.io/img/button.svg)](https://cloudron.io/button.html?app=org.freshrss.cloudronapp) * [![DP deploy](https://raw.githubusercontent.com/DFabric/DPlatform-ShellCore/gh-pages/img/deploy.png)](https://dfabric.github.io/DPlatform-ShellCore) * [YunoHost](https://github.com/YunoHost-Apps/freshrss_ynh) diff --git a/README.md b/README.md index 23358d98e..8858dd12d 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ We are a friendly community. More information about installation and server configuration can be found in [our documentation](https://freshrss.github.io/FreshRSS/en/admins/02_Installation.html). ## Automated install -* [![Install on Cloudron](https://cloudron.io/img/button.svg)](https://cloudron.io/button.html?app=org.freshrss.cloudronapp) +* [Docker](./Docker/) +* [![Cloudron](https://cloudron.io/img/button.svg)](https://cloudron.io/button.html?app=org.freshrss.cloudronapp) * [![DP deploy](https://raw.githubusercontent.com/DFabric/DPlatform-ShellCore/gh-pages/img/deploy.png)](https://dfabric.github.io/DPlatform-ShellCore) * [YunoHost](https://github.com/YunoHost-Apps/freshrss_ynh) diff --git a/cli/README.md b/cli/README.md index a496aab58..d531b8c3d 100644 --- a/cli/README.md +++ b/cli/README.md @@ -32,6 +32,9 @@ Options in parenthesis are optional. ```sh cd /usr/share/FreshRSS +./cli/prepare.php +# Ensure the needed directories in ./data/ + ./cli/do-install.php --default_user admin ( --auth_type form --environment production --base_url https://rss.example.net/ --language en --title FreshRSS --allow_anonymous --api_enabled --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123 --db-base freshrss --db-prefix freshrss ) # --auth_type can be: 'form' (default), 'http_auth' (using the Web server access control), 'none' (dangerous) # --db-type can be: 'sqlite' (default), 'mysql' (MySQL or MariaDB), 'pgsql' (PostgreSQL) diff --git a/cli/prepare.php b/cli/prepare.php new file mode 100755 index 000000000..2db2da555 --- /dev/null +++ b/cli/prepare.php @@ -0,0 +1,37 @@ +#!/usr/bin/php + Date: Sun, 4 Mar 2018 12:27:14 +0100 Subject: Docker follow-up (#1817) * Docker follow-up https://github.com/FreshRSS/FreshRSS/pull/1813 * Readme links cloud.docker.com does not seem to have a public version of the pages re-add https://hub.docker.com/r/freshrss/freshrss/ * Link to original GitHub readme * Docker readme MySQL PostgreSQL https://github.com/FreshRSS/FreshRSS/pull/1817#issuecomment-370195319 * docker exec username --- Docker/Dockerfile | 2 +- Docker/README.md | 42 +++++++++++++++++++++++++++++++++++------- README.md | 1 + 3 files changed, 37 insertions(+), 8 deletions(-) (limited to 'README.md') diff --git a/Docker/Dockerfile b/Docker/Dockerfile index fc753e58d..993dcea31 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -17,6 +17,6 @@ COPY ./Docker/*.Apache.conf /etc/apache2/conf.d/ EXPOSE 80 CMD php -f ./cli/prepare.php > /dev/null && \ - chown -R :apache ${FRESHRSS_ROOT} && \ + 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/README.md b/Docker/README.md index d85b9a6f0..ccf4ab3f0 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -1,5 +1,7 @@ # Deploy FreshRSS with Docker -* See also https://hub.docker.com/r/freshrss/freshrss/ +* See also: + * https://hub.docker.com/r/freshrss/freshrss/ + * https://cloud.docker.com/app/freshrss/repository/docker/freshrss/freshrss ## Install Docker @@ -9,7 +11,7 @@ sh get-docker.sh ``` ## Optional: Build Docker image of FreshRSS -Optional, as a *less recent* [online image](https://hub.docker.com/r/freshrss/freshrss/) can be automatically fetched during the next step (run), +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 @@ -24,7 +26,7 @@ sudo docker build --tag freshrss/freshrss -f Docker/Dockerfile . ## Run FreshRSS -Example exposing FreshRSS on port 8080. You may have to adapt the network parameters to fit your needs. +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: @@ -39,6 +41,32 @@ sudo docker run -dit --restart unless-stopped --log-opt max-size=10m \ --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 @@ -46,17 +74,17 @@ sudo docker run -dit --restart unless-stopped --log-opt max-size=10m \ sudo docker pull freshrss/freshrss # And then sudo docker stop freshrss -docker rename freshrss freshrss_old +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 -docker rm freshrss_old +sudo docker rm freshrss_old ``` ## Command line ```sh -sudo docker exec -it freshrss php ./cli/list-users.php +sudo docker exec --user apache -it freshrss php ./cli/list-users.php ``` See the [CLI documentation](../cli/) for all the other commands. @@ -68,7 +96,7 @@ Set a cron job up on your host machine, calling the `actualize_script.php` insid Create `/etc/cron.d/FreshRSS` with: ``` -7,37 * * * * root docker exec -it freshrss php ./app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +7,37 * * * * root docker exec --user apache -it freshrss php ./app/actualize_script.php > /tmp/FreshRSS.log 2>&1 ``` ## Debugging diff --git a/README.md b/README.md index 8858dd12d..cacf61fa9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Build Status][travis-badge]][travis-link] +* Read this document on [github.com/FreshRSS/FreshRSS/](https://github.com/FreshRSS/FreshRSS/blob/master/README.md) to get the correct links and pictures. * [Version française](README.fr.md) # FreshRSS -- cgit v1.2.3