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.
heroku config:set FLOWER_BASIC_AUTH="username:password" -a YOUR-APP_NAME
- Add a new key and value -- the key is
FLOWER_BASIC_AUTH
and the value is the username and password you want to use to login to Flower.username:password
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!