To configure activepieces, you will need to set some environment variables, There is file called .env at the root directory for our main repo.

When you execute the tools/deploy.sh script in the Docker installation tutorial, it will produce these values.

Environment Variables

VariableDescriptionDefault ValueExample
AP_CONFIG_PATHOptional parameter for specifying the path to store SQLite3 and local settings.~/.activepieces
AP_CLOUD_AUTH_ENABLEDTurn off the utilization of Activepieces oauth2 applicationsfalse
AP_DB_TYPEThe type of database to use. (POSTGRES / SQLITE3)SQLITE3
AP_EXECUTION_MODEYou can choose between ‘SANDBOXED’, ‘UNSANDBOXED’, ‘SANDBOX_CODE_ONLY’ as possible values. If you decide to change this, make sure to carefully read https://www.activepieces.com/docs/install/architecture/workersUNSANDBOXED
AP_FLOW_WORKER_CONCURRENCYThe number of different flows can be processed in same time10
AP_SCHEDULED_WORKER_CONCURRENCYThe number of different scheduled flows can be processed in same time10
AP_ENCRYPTION_KEY❗️ Encryption key used for connections is a 16-character hexadecimal key. You can generate one using the following command: openssl rand -hex 16.None
AP_EXECUTION_DATA_RETENTION_DAYSThe number of days to retain execution data, logs and events.None
AP_FRONTEND_URL❗️ Url that will be used to specify redirect url and webhook url.Nonehttps://demo.activepieces.com/api
AP_JWT_SECRET❗️ Encryption key used for generating JWT tokens is a 32-character hexadecimal key. You can generate one using the following command: openssl rand -hex 32.Nonehttps://demo.activepieces.com
AP_QUEUE_MODEThe queue mode to use. (MEMORY / REDIS)MEMORY
AP_QUEUE_UI_ENABLEDEnable the queue UI (only works with redis)true
AP_QUEUE_UI_USERNAMEThe username for the queue UI. This is required if AP_QUEUE_UI_ENABLED is set to true.None
AP_QUEUE_UI_PASSWORDThe password for the queue UI. This is required if AP_QUEUE_UI_ENABLED is set to true.None
AP_TRIGGER_DEFAULT_POLL_INTERVALThe default polling interval determines how frequently the system checks for new data updates for pieces with scheduled triggers, such as new Google Contacts.5
AP_PIECES_SOURCEAP_PIECES_SOURCE: FILE for local development, DB for database. You can find more information about it in Setting Piece Source section.CLOUD_AND_DB
AP_PIECES_SYNC_MODEAP_PIECES_SYNC_MODE: NONE for no metadata syncing / ‘OFFICIAL_AUTO’ for automatic syncing for pieces metadata from cloudOFFICIAL_AUTO
AP_POSTGRES_DATABASE❗️ The name of the PostgreSQL databaseNone
AP_POSTGRES_HOST❗️ The hostname or IP address of the PostgreSQL serverNone
AP_POSTGRES_PASSWORD❗️ The password for the PostgreSQL, you can generate a 32-character hexadecimal key using the following command: openssl rand -hex 32.None
AP_POSTGRES_PORT❗️ The port number for the PostgreSQL serverNone
AP_POSTGRES_USERNAME❗️ The username for the PostgreSQL userNone
AP_POSTGRES_USE_SSLUse SSL to connect the postgres databasefalse
AP_POSTGRES_SSL_CAUse SSL Certificate to connect to the postgres database
AP_POSTGRES_URLAlternatively, you can specify only the connection string (e.g postgres://user:password@host:5432/database) instead of providing the database, host, port, username, and password.None
AP_REDIS_URLIf a Redis connection URL is specified, all other Redis properties will be ignored.None
AP_REDIS_USER❗️ Username to use when connect to redisNone
AP_REDIS_PASSWORD❗️ Password to use when connect to redisNone
AP_REDIS_HOST❗️ The hostname or IP address of the Redis serverNone
AP_REDIS_PORT❗️ The port number for the Redis serverNone
AP_RESIS_DBThe Redis database index to use0
AP_REDIS_USE_SSLConnect to Redis with SSLfalse
AP_OPENAI_API_KEYThis is required only if you want to enable code copilotNone
AP_COPILOT_INSTANCE_TYPEPossible values are AZURE_OPENAI, OPENAIOPENAI
AP_AZURE_OPENAI_ENDPOINTThis is required only if you want to enable code copilothttps://{{your-resource}}.openai.azure.com/openai/deployments/{{your-model}}
AP_AZURE_OPENAI_API_VERSIONThis is required only if you want to enable code copilot2023-06-01-preview
AP_TRIGGER_TIMEOUT_SECONDSMaximum allowed runtime for a trigger to perform polling in secondsNone
AP_FLOW_TIMEOUT_SECONDSMaximum allowed runtime for a flow to run in secondsNone
AP_SANDBOX_PROPAGATED_ENV_VARSEnvironment variables that will be propagated to the sandboxed code. If you are using it for pieces, we strongly suggests keeping everything in the authentication object to make sure it works across AP instances.None
AP_TELEMETRY_ENABLEDCollect telemetry information.true
AP_TEMPLATES_SOURCE_URLThis is the endpoint we query for templates, remove it and templates will be removed from UIhttps://cloud.activepieces.com/api/v1/flow-templates
AP_WEBHOOK_TIMEOUT_SECONDSThe default timeout for webhooks. This option is not available on cloud because of cloudflare30
AP_TRIGGER_FAILURE_THRESHOLDThe maximum number of consecutive trigger failures is 576 by default, which is equivalent to approximately 2 days.30
AP_PROJECT_RATE_LIMITER_ENABLEDEnforce rate limits and prevent excessive usage by a single project.true
AP_MAX_CONCURRENT_JOBS_PER_PROJECTThe maximum number of active runs a project can have. This is used to enforce rate limits and prevent excessive usage by a single project.100
AP_S3_ACCESS_KEY_IDThe access key ID for your S3-compatible storage service.None
AP_S3_SECRET_ACCESS_KEYThe secret access key for your S3-compatible storage service.None
AP_S3_BUCKETThe name of the S3 bucket to use for file storage.None
AP_S3_ENDPOINTThe endpoint URL for your S3-compatible storage service.Nonehttps://s3.amazonaws.com
AP_S3_REGIONThe region where your S3 bucket is located.Noneus-east-1
AP_MAX_FILE_SIZE_MBThe maximum allowed file size in megabytes for uploads.None10
AP_FILE_STORAGE_LOCATIONThe location to store files. Possible values are DB for storing files in the database or S3 for storing files in an S3-compatible storage service.DB

The frontend URL is essential for webhooks and app triggers to work. It must be accessible to third parties to send data.

Separate Workers from api

To separate workers from API servers, you can achieve this by setting AP_FLOW_WORKER_CONCURRENCY to zero on API servers, while keeping it on worker servers.

Enabling Sign-Up:

To enable the sign-up feature, you need to ensure the code runs safely on the machine, especially if you don’t trust the users. Follow these two steps:

  1. Make the Docker container privileged: Edit the docker-compose.yml file and add privileged: true. This allows the container to have additional permissions to sandbox.
  2. Change the execution mode to sandboxing: Modify the AP_EXECUTION_MODE setting to SANDBOXED. This ensures the code runs within a secure environment, isolated from the rest of the system.
  3. Modify the AP_SIGN_UP_ENABLED to true , the environment variable.

Setting Webhook (Frontend URL):

The default URL is set to the machine’s IP address. To ensure proper operation, ensure that this address is accessible or specify an AP_FRONTEND_URL environment variable.

One possible solution for this is using a service like ngrok (https://ngrok.com/), which can be used to expose the frontend port (4200) to the internet.

Setting Piece Source

These are the different options for the AP_PIECES_SOURCE environment variable:

  1. FILE: Only for Local Development, this option loads pieces directly from local files. For Production, please consider using other options, as this one only supports a single version per piece.

  2. DB: This option will only load pieces that are manually installed in the database from “My Pieces” or the Admin Console in the EE Edition. Pieces are loaded from npm, which provides multiple versions per piece, making it suitable for production.

You can also set AP_PIECES_SYNC_MODE to OFFICIAL_AUTO, where it will update the metadata of pieces periodically.