Skip to content
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

MonitoRSS Heroku manual deploy guide #95

Closed
infinitepower18 opened this issue Mar 17, 2019 · 21 comments
Closed

MonitoRSS Heroku manual deploy guide #95

infinitepower18 opened this issue Mar 17, 2019 · 21 comments
Labels

Comments

@infinitepower18
Copy link
Contributor

infinitepower18 commented Mar 17, 2019

HEROKU IS ENDING THEIR FREE SERVICES ON NOVEMBER 28 2022

This tutorial will guide you through deploying MonitoRSS (previously called Discord.RSS) on Heroku manually (without using the deploy button).

The deploy button method would require you to verify your Heroku account using your credit card despite it being free. So if you want to try out the bot and see if you like it for example you can follow this guide. Do note that Heroku gives you 550 free hours every month if you don't verify with a credit card. So if you want the bot to run 24/7 you will need to verify with your credit card to increase your hours to 1000, enough to run the bot for a whole month provided you don't have any other applications running on your Heroku account.

This guide is based on v6 and the information/screenshots are accurate at the time of this writing.

1. Create Discord bot application

Go to https://discord.com/developers/applications/, create a new application and name it. Then go to the Bot tab, select Add Bot, confirm then name your bot and upload an avatar. This is what your bot will look like in Discord.

If you don't want others to be able to add your bot turn off the Public Bot setting.

On that same page you will find your Token. You will need this later. Do not share this token with anyone else!!!!

2. Invite the bot

Use one of the below URLs replacing the INSERTHERE with the Client ID from the Discord developer portal to invite the bot to your server.

With Role: https://discord.com/oauth2/authorize?client_id=INSERTHERE&scope=bot&permissions=19456
Without Role: https://discord.com/oauth2/authorize?client_id=INSERTHERE&scope=bot

3. Create MongoDB Atlas Database

Go to https://www.mongodb.com/cloud/atlas and create an account if you don't already have one. Once you're logged in follow the instructions to create a cluster. Select Shared Clusters, then choose a server region (I suggest on AWS). Make sure the Cluster Tier is M0 and press Create Cluster.

Cluster selection

Server selection

Your cluster will take a few minutes to get ready. During this time go to the Database Access located at the left, press Add New Database User. Choose a username and a password (you will need the password later), check that the User Privileges are set to "Read and Write to any database" and press Add User.

Next you want to go to Network Access, add IP and select Allow Access from Anywhere. Click Confirm.

After your cluster is ready click Connect found in the Overview screen.

image

Select Connect Your Application, set Driver to Node.js and Version 3.6 or later. You will need the connection string later on in this tutorial.

4. Set up Redis database (required for web dashboard)

Next, you will need to set up your free redislabs account. You need to do this if you want the web dashboard. If you are not going to use the web dashboard you can skip this.

First, create an account at https://app.redislabs.com. Select Cloud as your deployment option.

image

Once you have logged in, click the Create your subscription button.

image

Select Essentials, and then the Standard 30 MB free option.

image

On the next screen, ensure the protocol is set to Redis, and that Redis password is enabled (you will need the password later). Set Data Eviction Policy to no eviction.

On the screen you see after this, you will find your connection details. Take note of the endpoint, you will need it later. At the end of the endpoint also includes the port number. You will need that also.

5. Configure config vars

Go to https://dashboard.heroku.com/apps and create a new App. Call it whatever you want. Then select the settings tab.

Add the following config vars:

DRSS_BOT_OWNERIDS - Your Discord User ID (check here if you're unsure)

DRSS_BOT_PREFIX - Type the prefix you want to use for commands

DRSS_BOT_TOKEN - Your bot token from Discord developer portal.

DRSS_DATABASE_URI - Your MongoDB connection string (replace <password> with your MongoDB password you created earlier and also replace <dbname> with test)

DRSS_FEEDS_REFRESHRATEMINUTES - Set an interval (in minutes) how often you want the bot to check for new content. I suggest 15 mins, some websites may have a rate limit if it's set to a faster interval

DRSS_FEEDS_TIMEZONE - Set the bot's default timezone. Use a timezone from this list.

If you want to enable the web dashboard you will have to add the below config vars.

DRSS_START - bot-web

DRSSWEB_BOT_TOKEN - Same as DRSS_BOT_TOKEN

DRSSWEB_BOT_REDIRECTURI - https://herokuappname.herokuapp.com/authorize (replace herokuappname with the name you set your Heroku app)

You will also need to add the above URL under OAuth2 redirect settings in the Discord Developer Portal. If you don't do this, you will get an error when logging into the web portal.

image

DRSSWEB_BOT_CLIENTID - Your Discord application Client ID, found in developer portal.

DRSSWEB_BOT_CLIENTSECRET - Your Discord application Client Secret, found in developer portal.

DRSSWEB_DATABASE_URI - Same as DRSS_DATABASE_URI

DRSSWEB_DATABASE_REDIS - redis://password@endpoint:port

Remember the password and endpoint details from your redislabs account? Add them in the format given above.

6. Deploy Bot to Heroku

Fork the MonitoRSS-Clone repo by clicking the Fork button at the top right of the page.

image

Go to your bot application on https://dashboard.heroku.com/apps.

Then go to the Deploy tab, select GitHub and connect your account. Search for the repo by typing MonitoRSS then pressing Search. Connect the repo named yourusername/MonitoRSS-Clone.

image

Once you've connected your fork, scroll down to manual deploy and deploy the master branch. Once the entire deploy operation has completed, refresh the page.

image

7. Use Freshping to keep the bot running

To prevent your bot from going to sleep by Heroku, create a Freshping account and click Add Check at the top right of the dashboard. Set the check type to HTTP/HTTPS and paste the URL of your Heroku app on the Check URL field. Set the interval to every 5 mins and press Add Check.

image

If you followed all these steps correctly, your bot should be up and running!

If enabled, you can now log into the web UI at https://herokuappname.herokuapp.com and configure your feeds.

Advanced Configuration

You can add additional config vars by following this page. The configuration page lists all the possible configs available.

NEVER LEAVE YOUR TOKEN AND DATABASE URIS ON THE CONFIG.JSON, SOMEONE MAY USE IT AND "HIJACK" THE BOT. If you accidentally gave your token out, regenerate a new token via the Discord developer portal and update the relevant config var in Heroku. For the MongoDB and Redis databases, you can generate a new password via their control panels.

@infinitepower18 infinitepower18 changed the title How to host on Heroku for free without credit card (Advanced) How to host on Heroku for free without credit card Mar 17, 2019
@synzen synzen added the guide label Mar 18, 2019
@synzen
Copy link
Owner

synzen commented Mar 18, 2019

Thanks for the writeup and contribution! I've added it to the Setup page. I am a bit concerned about the use of images since they can be easily outdated if they decide to update their UI, but it is better than nothing

@synzen synzen closed this as completed Mar 18, 2019
@infinitepower18 infinitepower18 changed the title How to host on Heroku for free without credit card How to manually deploy Discord.RSS on Heroku Jun 6, 2019
@infinitepower18 infinitepower18 changed the title How to manually deploy Discord.RSS on Heroku How to host on Heroku without credit card Jun 6, 2019
@infinitepower18 infinitepower18 changed the title How to host on Heroku without credit card Discord.RSS Heroku manual deploy guide Jul 9, 2019
@Anonymyous678
Copy link

How i can deploy manually discord rss bot without web dashboard?

@infinitepower18
Copy link
Contributor Author

@Anonymyous678 skip step 4, and on step 5 skip adding DRSS_WEB_ENABLED, DRSS_WEB_REDIRECT_URI, DRSS_WEB_CLIENT_ID, DRSS_WEB_CLIENT_SECRET and DRSS_REDIS_URI. Once you have deployed the bot in step 6, go to the resources tab, disable web and enable the worker. You don't need to do step 7 as workers don't need to be pinged to stay online.

@Sikksens
Copy link

Sikksens commented Jun 18, 2020

Has anything changed with this setup?

everything seems to run ok, but when signing into the web UI, the bot doesn't pick up any of my servers and I get these errors:

image

Update:
Seems like it was related to a caching issue with Redis and a preexisting bot application.

@MicaelJarniac
Copy link

Has anything changed with this setup?

everything seems to run ok, but when signing into the web UI, the bot doesn't pick up any of my servers and I get these errors:

image

Update:
Seems like it was related to a caching issue with Redis and a preexisting bot application.

I'm having a similar problem. I have never used Heroku before, so a preexisting app shouldn't be the cause, at least for me.

@Sikksens
Copy link

Are you using an existing bot application from Discord?
I had to just create a new one with a new token etc and it worked out.

@MicaelJarniac
Copy link

I'm using a new one, created just for this purpose.

@MicaelJarniac
Copy link

Mine does work most of the time, but sometimes it just breaks and I have to restart it a few times to get it working again.

And even when it's working normally, I still get the Cannot read property 'data' of null warning.

@infinitepower18 infinitepower18 changed the title Discord.RSS Heroku manual deploy guide MonitoRSS Heroku manual deploy guide Aug 12, 2020
@JChace029
Copy link

This line is confusing me a bit:

DRSS_DATABASE_URI - Your MongoDB connection string (replace with your MongoDB password you created earlier and also replace with test)

Remember the password and endpoint details from your redislabs account? Add them in the format given above.

What exactly does that mean? Am I adding another line of DRSS_DATABASE_URI with those credentials?

@infinitepower18
Copy link
Contributor Author

This line is confusing me a bit:

DRSS_DATABASE_URI - Your MongoDB connection string (replace with your MongoDB password you created earlier and also replace with test)

Remember the password and endpoint details from your redislabs account? Add them in the format given above.

What exactly does that mean? Am I adding another line of DRSS_DATABASE_URI with those credentials?

Sorry that was for DRSSWEB_DATABASE_REDIS. I have updated the guide.

@Reacien
Copy link

Reacien commented Apr 13, 2021

I'm trying to deploy my bot but whenever I do the manual deploy it ends with an error and the dashboard isn't online either.

nevermind. I figured out I got my timezone settings wrong. Didn't realize I had to use the tz name instead of the time

@siphyshu
Copy link

You can add additional config vars by following this page.

The link is broken, should be this instead.

@infinitepower18
Copy link
Contributor Author

@siphyshu fixed, thanks

@tecaspt
Copy link

tecaspt commented Jul 22, 2021

How can I use freshping to ping MongoDB instead?
I have no issues with Heroku going idle, but my bot randomly deletes all feeds and settings stored, after which I encounter MongoDB paused (so I assume this is the issue). How do I ping it or avoid it pausing automatically?

@amblerkr
Copy link

amblerkr commented Aug 26, 2021

@MicaelJarniac Have you solved this problem? I still fail sometimes, as you said. And it hasn't worked recently and some data has been lost.

@MicaelJarniac
Copy link

@MicaelJarniac Have you solved this problem? I still fail sometimes, as you said. And it hasn't worked recently and some data has been lost.

I haven't used MonitoRSS in quite a while, and honestly don't even remember how I've set it up.

@infinitepower18
Copy link
Contributor Author

@tecaspt you don't need to ping the MongoDB database. It only pauses if you don't use the bot for several weeks

@aczrimuru
Copy link

image

how can i fix this one?

@amblerkr
Copy link

amblerkr commented Feb 21, 2022

There's something wrong. I tried to install the bot in the same way, but it failed.
I've already installed bot twice.

I think there was a problem as MongoDB was updated.
Can you help me?

@infinitepower18
Copy link
Contributor Author

infinitepower18 commented Aug 26, 2022

Sadly Heroku will be terminating their free services this year on Nov 28…

https://blog.heroku.com/next-chapter

@amblerkr
Copy link

Sadly Heroku will be terminating their free services this year on Nov 28…

https://blog.heroku.com/next-chapter

Is there any easy way for me to move the current bot within 10 dollars? If you have, please share it with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests