Command line interface¶
You can perform several operations from the command line using the
fleio command, Django commands, BASH scripting
and the MariaDB/MySQL console.
fleio command to manage your installation. For instance, connect with SSH to the machine where Fleio is
installed and check for available updates by running:
fleio updates Current version: 2022.11.1 No updates found
upgrade your Fleio installation,
backup now. For a complete list
of Fleio commands run:
As of version 2022.12, you will get the following output:
Usage: fleio [OPTIONS] COMMAND [ARG...] Installs, manages and upgrades Fleio. If not ran as fleio user, the command will try to 'sudo -u fleio' itself. Make sure your user has 'sudo -u fleio' rights. Commands: backup Backups or restores Fleio database. Options: - now - creates a new database backup, takes a file name as parameter - list - list existing database backups - restore - restores a database backup, takes a file name as parameter bash [command] Launches the Bash inside the utils container with access to all volumes if no command is specified. If command is specified, runs the command instead of bash inside the utils container. By default Bash is ran as fleio user. Use "--root" flag to run Bash as root. django [command] Launches django command with specified arguments inside utils container. build Build Docker Compose services. Run "build" if you have local customizations of docker images and you have made changes. It does nothing if you're using vanilla Fleio images. (runs "docker compose build" command) edit <file> Edit one of Fleio configuration files: settings.py enduser.config.json staff.config.json help Show help. import-domains Receives a csv file from where domains pricing is imported into Fleio. Use "skip-relative-prices" to not override relative prices. Usage example: "cat template.csv | fleio import-domains". info Shows debugging information about settings and environment. Send the output when contacting Fleio support. issue letsencrypt Issues a Let's Encrypt certificate on an existing Fleio installation. Requires that Let's Encrypt was chosen on installation. Useful when DNS entry was not pointing to local IP during installation (and for this reason the certificate could not be issued) and DNS entry was later pointed to local IP. license Reads and updates Fleio license. Use "--refresh" to only refresh your license. list periodic List periodic tasks that are currently running. manage Executes Fleio management commands like "disable-periodic-tasks" or "enable-periodic-tasks" mysql Starts the mysql client on the Fleio database. mysqldump Output a dump of the Fleio database. Any arguments will be passed to the mysqldump command. nuke Stop containers and PERMANENTLY DELETE Fleio database, data volumes and settings. WARNING: you will lose data when using this command. reconfigure Use to change URL of Fleio, including HTTP to/from HTTPS. recreate Recreate the Fleio containers performing a full reset: changes in Docker Compose YAML files, environment variables are reloaded and applies changes from "settings.py". (runs "docker compose down && docker compose up -d" command) resetdb Drop the database tables and recreate them with the SQL query used on install. WARNING: you will lose everything in the Fleio database when using this command. restart Perform a simple Fleio restart without loading any possible changes to Docker Compose YAML files or environment variables. Applies changes from "settings.py". (runs "docker compose stop && docker compose start" commands) shell Opens an interactive Python prompt with Django and models loaded. start Starts Fleio services. status Show Fleio containers status. stop Stops Fleio services. sync Synchronizes OpenStack objects into the Fleio database. updates Checks and lists available Fleio updates. upgrade [version] Upgrade to the latest version or to the specified version . Use "--include-beta" option if you want to consider beta releases when determining "latest". version Shows installed Fleio version. Options: -b, --include-beta Include beta versions when installing latest version or checking for updates. If you specify a version when installing, this flag doesn't make sense and will result in error. -f, --force Skips confirmation on upgrade, nuke or resetdb. Performs upgrade even if version already installed. -r, --refresh Just refresh Fleio license when running license command. --root Option for "fleio bash" command. Runs Bash inside the container as root. --no-backup Skips database backup on upgrade, resetdb or nuke. --no-restart On refresh license will not restart Fleio - note that you have to restart Fleio in order to use the new license. --no-wait On upgrade, restart or recreate, do not wait for current running tasks, terminate them abruptly.
fleio django (sub)command gives you access to a whole new set of commands implemented in Python.
For a full list of Django commands, run
fleio django --help. Below is the output for Fleio 2022.12. Note that
manage.py is used internally, so, to get help on a Django command you run
fleio django help changepassword.
Type 'manage.py help <subcommand>' for help on a specific subcommand. Available subcommands: [auth] changepassword createsuperuser [authtoken] drf_create_token [billing] refresh_eu_tax_exempt [contenttypes] remove_stale_contenttypes [core] dbbackup feature_enabled fleio_edition fleio_info testdbconn [django] check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate optimizemigration runserver sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject test testserver [django_extensions] admin_generator clean_pyc clear_cache compile_pyc create_command create_jobs create_template_tags delete_squashed_migrations describe_form drop_test_database dumpscript export_emails find_template generate_password generate_secret_key graph_models list_model_info list_signals mail_debug managestate merge_model_instances notes pipchecker print_settings print_user_for_session raise_test_exception reset_db reset_schema runjob runjobs runprofileserver runscript runserver_plus set_default_site set_fake_emails set_fake_passwords shell_plus show_template_tags show_urls sqlcreate sqldiff sqldsn sync_s3 syncdata unreferenced_files update_permissions validate_templates [rest_framework] generateschema [sessions] clearsessions
The Django shell is a command line environment where you can run Python commands in the context of the Fleio project, that is the settings are loaded, including things like database connection settings and the Django model classes (used to interact with the database tables).
To enter the Django shell run:
Once you’re into the shell, you can can for instance list the Fleio users:
>>> AppUser.objects.all() <QuerySet [<AppUser: email@example.com>, <AppUser: osuser489595>, <AppUser: demo>, <AppUser: demoadmin>]> >>>
Just press CTRL + D to exit the Django shell or type in
You can change any Fleio user password from the command line, including the admin/staff user password.
Connect via SSH to the machine where Fleio and run:
fleio django changepassword user_email@address
If you can’t remember the username either, you can run a query on the Fleio database and see the list of users:
fleio mysql MariaDB [fleio]> SELECT email FROM core_appuser; +---------------+ | username | +---------------+ | firstname.lastname@example.org | | email@example.com | +---------------+ 2 rows in set (0.00 sec)
Create a staff user by running the following command. The new user will have
is_admin = True, so she has full staff
user privileges. You can later change this from the staff panel.staff
fleio django createsuperuser
You can interactively browse through Fleio files or create a staff user with commands like
fleio bash fleio@utils:~/project$ ls binaries common common_admin enduser fleio fleiodockerutils fleiostaff locale manage.py plugins requirements.txt fleio@utils:~/project$ cat fleio/core/views.py
fleio bash enters the Docker
nano editor to easily navigate through source code. Note that editing files here will not affect your
Fleio application and any changes are lost on
fleio restart or
fleio upgrade. To apply and permanently keep code
changes you actually need to change code in other containers (
celery etc.) and by using a custom
Dockerfile. See Adding or changing files in Fleio Docker images.
You can run BASH commands non-interactively, directly from the host where Fleio is installed. For instance to list
the contents of you
fleio bash cat fleio/fleiosettings/settings.py
and even run django commands one-liners that also require the Python virtual environment to be activated:
# show Django version echo ". ../env/bin/activate; django version" | fleio bash Creating fleio_utils_run ... done 4.0.7
You can authenticate and open the MySQL/MariaDB console with:
and you can get a dump of your database with: