Flower is a great tool for monitoring Celery processes but sadly cannot be deployed in the same instance as your primary Heroku application. A simple solution is to run Flower on a seperate Heroku instance. This simple project will launch Flower with Redis to monitor your Celery processes from another project.
It's so simple, we can do it in only a few easy steps:
Clone this repo!
git clone https://github.com/paqman85/simple-celery-flower-on-heroku.git
Create a Heroku app for Flower:
- Login to Herku:
heroku login
- Create a new app for Flower:
heroku create YOUR-DESIRED-APP-NAME-HERE
-
Login to your Heroku account
-
Create a new application instance from your dashboard
Flower needs to conenct to your Celery broker url in order to monitor your Celery Processes. This project includes Redis as a default - so feel free to use your Redis or RabbitMQ broker url.
heroku config:set BROKER_URL=redis://... -a YOUR-APP_NAME
- While in your application's dashboard, click on the settings tab.
- Click reveal vars button in the Config Vars section
- Add a new key and value -- the key is
BROKER_URL
and the value is the url to your Celery broker for the application you want to monitor... if redis it would start withredis://
The project assumes you want to keep things simple and use Basic Authentication. We simple need to add the username and password to the environment variables.
We are using the Google authentication as described here.
Once the Google credentials have been set up:
heroku config:set -a <app_name> FLOWER_OAUTH2_KEY=<key> FLOWER_OAUTH2_SECRET=<secret> FLOWER_OAUTH2_REDIRECT_URI=<redirect_url>
- Add new keys and values -- the keys are
FLOWER_OAUTH2_KEY
,FLOWER_OAUTH2_SECRET
andFLOWER_OAUTH2_REDIRECT_URI
and the values are the ones from your new Google app.
It's time to deploy!
If you don't have git set up yet:
git init
git status
git add .
git commit -m "Name your commit
Then set heroku as remote:
heroku git:remote -a YOUR-APP_NAME
And here is the command to push to heroku:
git heroku push master
You can confirm all is working well by checking heroku logs --tail -a YOUR-APP_NAME'
Now if everything worked out - you should be able to login to your application at your heroku app url and monitor your Celery processes!