After you fill in the details on the OpenStack settings Credentials tab press Test connection to see if credentials are working. Then by pressing Save & sync or Sync button all the OpenStack objects (projects, instances, volumes, networks etc.) from the Fleio database are reset and the list of objects with states is retrieved from OpenStack.
You can then go to Cloud > Instances and check list of instances (or volumes, or some other resource that you know has elements in OpenStack) and see if there are any objects present.
Fleio requires notification messages from the OpenStack’s internal RabbitMQ queue to update the cloud objects’ state in the Fleio database and for most of the pricing rules.
You can confirm that Fleio receives notifications by shutting down an existing instance and see the instance status being updated in Fleio. Follow these steps:
Go to Fleio
Sync OpenStack objects as described in section How to check if Fleio connects successfully to the OpenStack API
Assuming you have a running instance, shut it down
Wait a few seconds for the instance to reach the STOPPED state. If your instance still shows as RUNNING state in Fleio, while you can see the instance being
SHUTOFFin OpenStack (
openstack server list --all-projects, that means that notifications are not working.
These steps apply for other operations as well: create instance but it never shows up in Fleio, while you can see it created in OpenStack, or instance start for a shutoff instance.
To repeat these steps, make sure you start from a synced database by pressing Sync on the OpenStack Credentials tab.
The checklist to have notifications working is:
Make sure you enabled the OpenStack notifications
you added add the RabbitMQ user for Fleio
you set the notification settings
For debugging purposes, you can also enable notification logging with Notifications logging settings and see in the log file what notifications are received.
See in this video how notifications log should work:
You can check if your email settings are configured correctly in
settings.py by trying to send an email message from
the Django shell command line utility.
SSH to the server where Fleio is installed and run these commands in bash:
fleio shell # you should see the shell prompt now: >>> # let's try to send an email # !!! replace with from and to email addresses accepted by your mail server from django.core.mail import send_mail send_mail('Subject', 'message', 'email@example.com', ['firstname.lastname@example.org'], fail_silently=False) # exit Django shell by typing CTRL_D or exit() exit()
If mail sending fails, you’ll see the error and a stack trace, try to fix settings in settings.py. See Fleio backend settings file location:.
All email settings are explained in the Django documentation: https://docs.djangoproject.com/en/dev/topics/email/
If there’s no error and “1” is displayed instead, the email was successfully sent and you should analyze the mail server log if you do not receive the test message.
Fleio database must be created with utf8mb4 character set. You can check the character set by running the following query on your database (usually fleio):
cd /home/fleio/compose db_pass=$(cat /home/fleio/compose/secrets/.db_password) docker-compose exec db mysql -u fleio -p"$db_pass" SELECT @@character_set_database, @@collation_database;
If your database contains tables that are using a different character set you will have to update the tables so it will have the UTF8mb4 set. This can be done with the following steps:
Export current DB
cd /home/fleio/compose db_pass=$(cat /home/fleio/compose/secrets/.db_password) docker-compose exec -T db mysqldump fleio -u fleio -p"$db_pass" > fleio`date +%d.%m.%Y`.sql
Adjust the dump so all the create table statements will use utf8mb4.
Import the database (replace the path to your FIXED_DB with the proper name)
sudo chown fleio /home/fleio/compose/FIXED_DB.sql sudo -i -u fleio cd /home/fleio/compose # stop all services docker-compose stop # and start just the database service docker-compose start db # get the database password in a variable db_pass=$(cat /home/fleio/compose/secrets/.db_password) # enter the mysql console docker-compose exec db mysql -u fleio -p"$db_pass" # once in console, drop the existing database and create a new one: DROP DATABASE fleio; CREATE DATABASE fleio CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; # exit the console to Bash exit # import the database cat fleio.sql | docker-compose exec -T db mysql fleio -u fleio -p"$db_pass"
Run migration using
docker-compose exec -T backend bash -c "source ../env/bin/activate && django migrate"
If you’re in a development environment (not a production server) you can also enable debugging from settings.py file to get more information in browser when you’re accessing an invalid URL and in case an error occurs during development:
DEBUG = True
Now you’ll be able to to see the backend API nicely formatted and even perform POST, PUT, and DELETE requests. Note that you need to be authenticated as
Here’s an example of PHP code calling the Fleio API: https://github.com/fleio/fleio-whmcs.
You can also run Django commands from the command line after you activate the Fleio Python virtual environment and move to the Django project directory. Please see Command line interface.
For more information regarding the Django command line see https://docs.djangoproject.com/en/dev/ref/django-admin/