[5 Mins Docker] Deploy A Free RSS Aggregator Website - Miniflux - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Sunday, January 22, 2023

[5 Mins Docker] Deploy A Free RSS Aggregator Website - Miniflux

I have been looking for a free online web service which can aggregate the updates from hundreds of websites I collected in my bookmark. I even built my own bookmark site for easily managing the collections. Click through hundreds of website to see the updates is a really pain to me and since lots of websites are not updating that often, but once they updated , I really want to check out their contents since that is usually interesting to me. 

I found RSS aggregator service could help for my this problem. But all of this kind of online service are not free or not free enough for me to get what I need. I decided to look for a self-hosted RSS aggregator solution. That is how I started this post. 



Demo site: https://rss.51sec.org/ (demo/demodemo)

Introduction

I have searched online and found following two posts helps me to narrow down the scope for the applications. 
If you want to check out all other solutions, you can check above sites to get more. For me, I have not check out too much, but following three are most interesting ones I tried a bit:
  • Tiny Tiny RSS
  • FreshRSS
  • miniflux
  • Stringer

miniflux

Actually it is hard decide which one is best for all above four I mentioned. I do not have much time to go through all of them deep so from the simlicity of installation point of view, I choosed miniflux to use as my daily RSS reader.
It also has other benefits:
- easy to read cross multiple devices.
- free, open source, light weight for resource usage

Websites:

Self Hosted Docker Installation Pre-requirements

Free resources you might need to complete this docker project:


Pre-installed services:

  • Docker, 
    • apt update
    • apt install docker.io
    • apt install docker-compose
    • apt upgrade docker.io
    • mkdir /root/data/docker_data/<docker_name>
  • Docker-Compose (Using Ubuntu OS for the commands)
    • Docker-compose down
    • Optional command : use following command to backup your Docker data. You might need to change your folder name based on your docker configuraiton
      • cp -r /root/data/docker_data/<docker_name> /root/data/docker_data_backup/<docker_name>
    • docker-compose pull
    • docker-compose up -d
    • docker image prune
  • Portainer (Optional)
    • docker volume create portainer_data
    • docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
  • Install some applications: apt install wget curl sudo vim git (Optional)
  • aapanel with Nginx (Optional)
  • Nginx Proxy Manager (Optional)
  • Install screen (Optional)
    • Install screen (Depends on the Linux Distribution if it came pre installed or not) : yum install screen
    • Initiate a Screen : screen or  screen -S <screen name> <command to execute>
    • Detach from the screen : "CTRL+A,D" not "CTRL+A+D"
    • List all the screen currently working : screen -ls
    • Reattach to a screen : screen  -r  <session number> or screen -r <screen name>
    • Kill specific screen: screen -X -S <screen name> quit
    • Kill all screens : pkill screen


Installation from Docker

Docker Registries:


Docker Architectures:

  • amd64
  • arm64
  • arm/v7
  • arm/v6

Using 

1 Log in to Play With Dcker website and create a new instance

URL: https://labs.play-with-docker.com/


2 In the new instance session command line, create a new file: basic.yml

You can find out this basic.yml file and other version's yml file from this url:

https://github.com/miniflux/v2/tree/master/contrib/docker-compose

  • vi basic.yml

3 In this new basic.yml file, paste into follow text:

version: '3.4'
services:
  miniflux:
    image: miniflux/miniflux:latest
    ports:
      - "80:8080"
    depends_on:
      - db
    environment:
      - DATABASE_URL=postgres://miniflux:secret@db/miniflux?sslmode=disable
      - RUN_MIGRATIONS=1
      - CREATE_ADMIN=1
      - ADMIN_USERNAME=admin
      - ADMIN_PASSWORD=test123
  db:
    image: postgres:15
    environment:
      - POSTGRES_USER=miniflux
      - POSTGRES_PASSWORD=secret
    volumes:
      - miniflux-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "miniflux"]
      interval: 10s
      start_period: 30s
volumes:
  miniflux-db:
Notes: For Docker Playground website:
Copy:  Ctrl+Insert
Paste:  Ctrl+Shift+V

4 start dockers

[node1] (local) [email protected] ~
$ docker-compose -f basic.yml up -d
[+] Running 2/2
 â ¿ Container postgres  Started                                                                                                   2.0s
 â ¿ Container miniflux  Started                                                                                                    3.5s
[node1] (local) [email protected] ~

5 Open Port 80 to visit this website


6 Log in with default credential admin / test123





Installation from Portainer

 

1 Log into your portainer website



2 Create a new custom template with following texts

You can find out this basic.yml template file and other version's yml file from this url:

https://github.com/miniflux/v2/tree/master/contrib/docker-compose


version: '3.4'
services:
  miniflux:
    image: ${MINIFLUX_IMAGE:-miniflux/miniflux:latest}
    container_name: miniflux
    restart: always
    ports:
      - "8010:8080"
    depends_on:
      - db
    environment:
      - DATABASE_URL=postgres://miniflux:secret@db/miniflux?sslmode=disable
      - RUN_MIGRATIONS=1
      - CREATE_ADMIN=1
      - ADMIN_USERNAME=admin
      - ADMIN_PASSWORD=test123
      - DEBUG=1
    # Optional health check:
    # healthcheck:
    #  test: ["CMD", "/usr/bin/miniflux", "-healthcheck", "auto"]
  db:
    image: postgres:15
    container_name: postgres
    environment:
      - POSTGRES_USER=miniflux
      - POSTGRES_PASSWORD=secret
    volumes:
      - miniflux-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "miniflux"]
      interval: 10s
      start_period: 30s
volumes:
  miniflux-db:




Note: you might want to change following two things in the texts:
  • Ports: default port is 80, you might already used 80 for something else, I would suggest change it to others, such as , 8010. 
    • You might also need to change your VPS's firewall port to allow 8010
  • Default password for user admin.



2 Deploy Template and check dockers running state



3 Visit your miniflux on port 8010

You might want to set up your admin account for administrator, and also set up your demo account for guest user.

Integrate with your own domain and enable HTTPS

You can find out this traefik.yml file as template for your reverse proxy configuration to integrate your own domain and enable https to your URL:

https://github.com/miniflux/v2/tree/master/contrib/docker-compose


You might need to change following thre highlighted places in following textbox:

version: '3.4'
services:
  traefik:
    image: "traefik:v2.3"
    container_name: traefik
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.tlschallenge=true"
      - "--certificatesresolvers.myresolver.acme.email=[email protected]"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    depends_on:
      - miniflux
    ports:
      - "443:443"
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
  miniflux:
    image: ${MINIFLUX_IMAGE:-miniflux/miniflux:latest}
    container_name: miniflux
    depends_on:
      - db
    expose:
      - "8080"
    environment:
      - DATABASE_URL=postgres://miniflux:secret@db/miniflux?sslmode=disable
      - RUN_MIGRATIONS=1
      - CREATE_ADMIN=1
      - ADMIN_USERNAME=admin
      - ADMIN_PASSWORD=test123
      - BASE_URL=https://rss.51sec.org
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.miniflux.rule=Host(`rss.51sec.org`)"
      - "traefik.http.routers.miniflux.entrypoints=websecure"
      - "traefik.http.routers.miniflux.tls.certresolver=myresolver"
  db:
    image: postgres:15
    container_name: postgres
    environment:
      - POSTGRES_USER=miniflux
      - POSTGRES_PASSWORD=secret
    volumes:
      - miniflux-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "miniflux"]
      interval: 10s
      start_period: 30s
volumes:
  miniflux-db:

Of course, rss.51sec.org will need to point to your this vps 's public ip address. This can be done by adding a new A record in your DNS administratration center, such as Cloudflare. 



Other Deployments


Deploy Miniflux on Heroku 

Since the version 2.0.6, you can deploy Miniflux on Heroku in few seconds.

  • Clone the repository on your machine: git clone https://github.com/miniflux/v2.git
  • Switch to latest stable version git checkout $(git describe --tags --abbrev=0) (master is the development branch)
  • Commit to master git checkout -B master (Heroku only deploy master by default)
  • Create a new Heroku application: heroku apps:create
  • Add the Postgresql addon: heroku addons:create heroku-postgresql:hobby-dev

Defines the environment variables to configure the application:

# Creates all tables in the database.
heroku config:set RUN_MIGRATIONS=1

# Creates the first user.
heroku config:set CREATE_ADMIN=1
heroku config:set ADMIN_USERNAME=admin
heroku config:set ADMIN_PASSWORD=test123

Then, deploy the application to Heroku:

git push heroku master

Once the application is deployed successfully, you don’t need these variables anymore:

heroku config:unset CREATE_ADMIN
heroku config:unset ADMIN_USERNAME
heroku config:unset ADMIN_PASSWORD
  • To watch the logs, use heroku logs.
  • You can also run a one-off container to run the commands manually: heroku run bash. The Miniflux binary will be located into the bin folder.
  • To update Miniflux, pull the new version from the repository and push to Heroku again.



Deploy Miniflux on Google App Engine 

If you have experience with Terraform and want a setup that works out of the box, consider using this Terraform module. Alternatively, you can follow these instructions:

  • Create a Postgresql instance via Google Cloud SQL, then create a user and a new database
  • Clone the repository and create a app.yaml file in the project root directory
runtime: go111
env_variables:
    CLOUDSQL_CONNECTION_NAME: INSTANCE_CONNECTION_NAME
    CLOUDSQL_USER: replace-me
    CLOUDSQL_PASSWORD: top-secret

    CREATE_ADMIN: 1
    ADMIN_USERNAME: foobar
    ADMIN_PASSWORD: test123
    RUN_MIGRATIONS: 1
    DATABASE_URL: "user=replace-me password=top-secret host=/cloudsql/INSTANCE_CONNECTION_NAME dbname=miniflux"

Replace the values according to your project configuration. As you can see, the database connection is made over a Unix socket on App Engine.

Last step, deploy your application:

gcloud app deploy

Refer to Google Cloud documentation for more details:

Running Miniflux on Google App Engine should work but it's considered experimental.
Notes: https://miniflux.app/docs/howto.html#oauth2

Videos

 


References


Relate blog posts for Docker:
More can be found from this category: https://blog.51sec.org/search/label/Docker or from Sietmap

Related blog posts for free domain, free vps

No comments:

Post a Comment