Deployment
Using Docker#
Create a PostgreSQL Instance (Optional)#
If you have a PostgreSQL database instance configured and running you can skip this section.
Start a PostgreSQL database instance using docker:
This starts a database with the username/password you provided and mounts a docker volume (activeworkflow-data) so your data is preserved during runs.
You can stop the database with:
Run ActiveWorkflow Using the Official Docker Image#
The default ActiveWorkflow instance consists of three containers: web, scheduler and worker. You can run ActiveWorkflow using the official docker image with:
For convenience you can gather all the environment variable definitions in a single file, for example activeworkflow.env:
And then start ActiveWorkflow with:
The above commands assume that you have a PostgreSQL instance in a docker container named activeworkflow-db and that you link it to ActiveWorkflow. If your database is hosted differently edit the --link line accordingly and/or omit it and use the corresponding DATABASE_URL environment variable.
ActiveWorkflow is configured by default with user admin and password password and is accessible using a web browser on http://localhost:3000.
You can stop ActiveWorkflow with:
!Note: For production deployment we strongly recommend you to use a web server (like nginx or Apache) to provide an SSL front. The DISABLE_SSL variable allows AcitveWorkflow to run without SSL encryption and should be omitted for production.
Using docker-compose#
You can also run ActiveWorkflow using
docker-compose. For this you need a
docker-compose.yml
and a .env file with environment variables.
Please edit these according to your requirements. You can read more about supported environment variables in the Environment section below.
You can then run ActiveWorkflow with:
You can stop it with:
This setup has a PostgreSQL database included.
Environment Variables#
ActiveWorkflow tries to follow the best practices of a 12 factor app. You can configure your ActiveWorkflow instance by setting environment variables. The following environment variables are supported:
DATABASE_USERNAME,DATABASE_PASSWORD,DATABASE_HOSTandDATABASE_NAMEare self-explanatory credentials required to establish a connection to the PostgreSQL database.DATABASE_URLsubstitutes all of the above environment variables and could be used for convenience. It has the formatpostgres://{username}:{password}@{hostname}/{database_name}, where{}should replaced by corresponding values.CREATE_DATABASEshould betruefor the web process to create a database. Usually it is used during the first run if you haven't created a database instance in advance. It is idempotent, so it can be given even if a database has been already created.DO_NOT_MIGRATEshould betrueto skip database migrations. By default the ActiveWorkflow web process runs database migration scripts to update the database schema to the latest version.DO_NOT_SEEDshould betrueto avoid seeding a database. By default the ActiveWorkflow web process creates a new user and a simple example workflow. The seed user is configured by using the environment variables described below.SEED_EMAIL,SEED_USERNAMEandSEED_PASSWORDare the credentials of the user that the ActiveWorkflow web process should create (unlessDO_NOT_SEEDis set totrue). Created user is made an admin. If a user with the provided email already exists, the operation is skipped. If these variables are not set ActiveWorkflow creates a useradminwith passwordpasswordand emailadmin@example.com.SECRET_KEY_BASEis a random string used to encrypt data, specifically session information.AGENT_LOG_LENGTHdefines how many log entries per entries to keep. 200 log entries are kept if this variable is undefined.PORTis the port where the ActiveWorkflow web process should listen on.DISABLE_SSLcould be set totruewhen testing by using direct connection on localhost. For production you should use some web server to provide an SSL front (like nginx or Apache) and leaveDISABLE_SSLunset.WEB_CONCURRENCY,RAILS_MAX_THREADSdefine how many processes and threads should the web process use to serve requests.SMTP_DOMAIN,SMTP_SERVER,SMTP_PORT,SMTP_AUTHENTICATION('none' or 'plain'),SMTP_SSL(false or true),SMTP_USER_NAME,SMTP_PASSWORDare all used for SMTP configuration.SMTP_ENABLE_STARTTLS_AUTO- you may need to set this totruefor some servers.SMTP_OPENSSL_VERIFY_MODE- usepeerfor production ornonefor testing.
How to Build Your Own Docker Image#
You can build your own docker image of ActiveWorkflow by checking out the
ActiveWorkflow repository
and using docker build command: