This article is published under a SIGNATURE 4.0 International (CC BY 4.0) license. Signature 4.0 International (CC BY 4.0)

Author: Su Yang

Create time: January 6, 2019 statistical word count: 3745 words reading time: 8 minutes to read this article links: soulteary.com/2019/01/06/…


Build your own RSS service with Docker (Stringer)

In a world of algorithmic recommendations, customizing access to information is a bit of an alternative, but it can be a more efficient approach.

This article, Stringer, is the second of three common ways to build AN RSS service that I mentioned earlier.

If you’ve read any of my previous posts, it should take 3 minutes or less to put together this article. If you haven’t, you can click on the relevant article TAB to read previous posts.

About the Stringer

Stringer is an RSS service written in Ruby. It has a simpler architecture and a more modern interface than Feedbin, also written for Ruby.

The main reasons I used it before were:

  • Support limited time offline cache.
  • Fever API support, allowing users to read on the client reader.
  • Small amount of code, simple technology stack.

But it also has some problems:

  • Documentation is not rich enough, optimization debugging, need to turn over the code.
  • The maintainer is still updating, but not very active.
  • If you want to take images offline, you may need to modify the code implementation or wrap a layer of your own Feed source.

If you want to learn more, you can visit here, if you just want to use, then read on.

Encapsulate a new Docker container image

Why encapsulate a new container?

There are some good people in the community who have submitted new code for the current version, but it is not incorporated into the trunk, there are also comments that some security risks need to be fixed, and the code content of the official container image is old.

And compare the difference between their own encapsulation mirror and the official mirror, found that the size of the file is also nearly double. In addition, the official database version is relatively old (PQ V9.5). In the process of use, it is also necessary to manually enter the container for auxiliary operation, which is not environmentally friendly.

REPOSITORY TAG IMAGE ID CREATED SIZE docker.lab.com/stringer stable dc8210ef3209 5 hours ago 603MB stringer 3712cf21 F1d712553750 5 hours ago 603MB MDswanson/Stringer Latest 6858330DB397 2 hours ago 1.01GBCopy the code

You can use the following configuration to build your own new image.

FROM Ruby :2.3.3-alpine ENV RACK_ENV=production ENV PORT=8080 ENV LANG= en_us.utf-8 \ LANGUAGE= en_US.utf-8 \ LC_CTYPE=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 EXPOSE 8080# skip installing gem documentation
RUN mkdir -p /usr/local/etc \
  && { \
    echo 'install: --no-document'; \
    echo 'update: --no-document'; \
  } >> /usr/local/etc/gemrc RUN apk add --no-cache --virtual \ build-dependencies build-base linux-headers tzdata supervisor postgresql-dev sqlite-dev nodejs curl bash dcron && \ rm -rf /var/cache/apk/* /tmp/* && \ ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime WORKDIR /app ADD Gemfile Gemfile.lock /app/ RUN bundle install - deployment ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.3/supercronic-linux-amd64  \ SUPERCRONIC=supercronic-linux-amd64 \ SUPERCRONIC_SHA1SUM=96960ba3207756bb01e6892c978264e5362e117e RUN curl -fsSLO"$SUPERCRONIC_URL" \
 && echo "${SUPERCRONIC_SHA1SUM}  ${SUPERCRONIC}" | sha1sum -c - \
 && chmod +x "$SUPERCRONIC" \
 && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
 && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic

ADD docker/supervisord.conf /etc/supervisord.conf
ADD docker/start.sh /app/
ADD . /app

RUN addgroup -S stringer && \
    adduser -S -G stringer stringer && \
    chown -R stringer:stringer /app

USER stringer

CMD /app/start.sh
Copy the code

Here I will mirror after building named docker.lab.com/stringer:stable, follow-up of service choreography, will use.

Use Docker and Traefik to provide services

Below is the service application configuration I provided, defining the Chinese interface and updating frequency every 15 minutes.

version: '2'Services: DB: Image: Postgres :10.4- Alpine Expose: -5432 Restart: Always Networks: -Traefik Volumes: - ./data/postgresql:/var/lib/postgresql# This needs explicit mapping due to https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
      - ./data/postgresql_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=pass
      - POSTGRES_USER=user
      - POSTGRES_DB=stringer

  web:
    image: docker.lab.com/stringer:stable
    depends_on:
      - db
    restart: always
    networks:
      - traefik
    expose:
      - 8080
    environment:
      - SECRET_TOKEN=YOUR_SECRET_TOKEN
      - PORT=8080
      - DATABASE_URL=postgresql://user:pass@db:5432/stringer
      - LOCALE=zh-CN
      - LOG_LEVEL=INFO
      - FETCH_FEEDS_CRON="*/15 * * * *"
      #- CLEANUP_CRON="0 0 * * *"
    labels:
      - "traefik.enable=true"
      - "traefik.port=8080"
      - "traefik.frontend.rule=Host:rss.lab.com"
      - "traefik.frontend.entryPoints=http,https"

networks:
  traefik:
    external: true
Copy the code

Once docker-compose up is up and running, open your browser, go to rss.lab.com, set your password, and you will have a powerful and user-friendly RSS subscription service.

Default no data sources, so you need to add a data source, if you before is RSS users, can be directly using OPML bulk import your subscription data import, each element of a list of red and green dot represents the site data is unobstructed, if you subscribe to the site because the network reason cannot access at home, You can network it yourself and add a subscription.

Stringer is different from other readers in that it promotes reading, requiring users to use additional software to organize and store articles for a month by default.

The last

When I wrote my articles before, I always considered the students who had no basic knowledge of reading and ignored the students who had been subscribing and paying attention to me. In the future, I will give a brief guide just like this article, which will not repeat the basic construction but only talk about the core parts related to the theme.

Although this service is completed, it cannot serve us well, because in the current network environment, more and more websites are “forced to close up” and no longer support the RSS subscription mode. As for how to solve this problem, please wait patiently for the solution I provide after the end of these three articles.

– EOF


I now have a small toss group, which gathered some like to toss small partners.

In the case of no advertisement, we will talk about software, HomeLab and some programming problems together, and also share some technical salon information in the group from time to time.

Like to toss small partners welcome to scan code to add friends. (Please specify source and purpose, otherwise it will not be approved)

All this stuff about getting into groups