-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up rss-bridge service #2788
Conversation
I would need some help to set up the microservice properly, as I have no idea how it is supposed to be set up. I tried to check how other services are set up, but I don't have a clue how they work. If anybody would like to help, the documentation for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Some changes to make this usable in our system.
docker/docker-compose.yml
Outdated
volumes: | ||
- ../config/rss-bridge:/config | ||
ports: | ||
- 3123:80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't bind this to port 80 on the host, as this is occupied by Traefik (our API router). Traefik is responsible for routing all requests to our services via a unified URL structure (e.g., Posts service is at /v1/posts
, the Search service is at /v1/search
, etc.)
This new RSS-Bridge service can be made to follow the same pattern, if we add Traefik routing information to the container. We do that with custom labels. In docker/docker-compose.yml
do this:
rss-bridge:
image: rssbridge/rss-bridge:2022-01-20
container_name: 'rss-bridge'
volumes:
- ../config/rss-bridge:/config
depends_on:
- traefik
labels:
# Enable Traefik
- 'traefik.enable=true'
# Traefik routing for the rss-bridge service at /v1/rss-bridge
- 'traefik.http.routers.search.rule=PathPrefix(`/${API_VERSION}/rss-bridge`)'
# Specify the RSS-Bridge service port
- 'traefik.http.services.search.loadbalancer.server.port=3123'
# Add middleware to this route to strip the /v1/rss-bridge prefix
- 'traefik.http.middlewares.strip_rss_bridge_prefix.stripprefix.prefixes=/${API_VERSION}/rss-bridge'
- 'traefik.http.middlewares.strip_rss_bridge_prefix.stripprefix.forceSlash=true'
- 'traefik.http.routers.rss_bridge.middlewares=strip_search_prefix'
Then in docker/production.yml
add this (to have the container auto-restart if it crashes):
rss-bridge:
restart: unless-stopped
Now when you start the services (pnpm services:start
) you should have http://localhost/v1/rss-bridge available, and similarly on api.telescope.cdot.systems/v1/rss-bridge in production and dev.api.telescope.cdot.systems/v1/rss-bridge in staging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one small problem.
So, I was testing whether the service is working fine, but it seems that it is lacking some static files. Instead of hitting localhost/v1/rss-bridge/static
, the requests hit at localhost/v1/static
. Is there a way to change that with traefik
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you push up the code you have so I can see it? I notice I have a typo above:
- 'traefik.http.routers.rss_bridge.middlewares=strip_search_prefix'
should be:
- 'traefik.http.routers.rss_bridge.middlewares=strip_rss_bridge_prefix'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will push what I have
@humphd could you please take a look on this one? |
Made a PR to fix it dbelokon#1 |
# Traefik routing for the rss-bridge service at /v1/rss-bridge | ||
- 'traefik.http.routers.rss_bridge.rule=PathPrefix(`/${API_VERSION}/rss-bridge`)' | ||
# Specify the RSS-Bridge service port | ||
- 'traefik.http.services.rss_bridge.loadbalancer.server.port=80' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can use port 80 because it's being used by something else. Let's define the port as an environment variable like {RSS_BRIDGE_PORT} and bind it here instead of hardcoding it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The port 80 is the port used inside the container, not in the host, I believe. In the rss-bridge
docker installation instructions, it says something along those lines. If I change it to another port number, it gives a Bad Gateway
response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the port 80 in the host is used by nginx
, by the way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you have to set the port of the running container here, which in the case of rss-bridge
is 80
, since it runs Apache. This is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification, guys :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the Traefik docs 100% crystal clear...once I've spent 4 hours being lost reading them :). It always takes me half-a-day to relearn how it works.
I should probably add a doc to the new doc system...
# Traefik routing for the rss-bridge service at /v1/rss-bridge | ||
- 'traefik.http.routers.rss_bridge.rule=PathPrefix(`/${API_VERSION}/rss-bridge`)' | ||
# Specify the RSS-Bridge service port | ||
- 'traefik.http.services.rss_bridge.loadbalancer.server.port=80' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you have to set the port of the running container here, which in the case of rss-bridge
is 80
, since it runs Apache. This is correct.
Issue This PR Addresses
#2728 This PR sets up the microservice that will provide the Twitch RSS feed
Type of Change
Description
This PR adds a 3rd party microservice, which generates RSS feeds of Twitch channels. This will be used further to close #2728.
Steps to test the PR
pnpm run services:start
-> builds the servicelocalhost:3123
-> a webpage ofrss-bridge
should appearAtom
buttonChecklist