Database, SFTP and email connections
Not every service is an HTTP API. Blokkio also stores connections to databases, SFTP servers and mail servers. Each of these kinds has a fixed set of fields, and its password-like fields are stored encrypted and never sent back to the browser.
| Kind | Apps in the catalogue | Used by |
|---|---|---|
| Database | PostgreSQL, MySQL, Microsoft SQL Server | Database Query (all three), Database Row Trigger (PostgreSQL only) |
| SFTP | SFTP | SFTP File Trigger |
| IMAP | IMAP | Email Trigger (IMAP) |
| SMTP | SMTP | Send Email |
Each of these blocks and triggers has a connection picker that only lists connections of the matching kind, for example Database connection or SMTP connection. The Database Row Trigger's PostgreSQL connection picker only lists PostgreSQL connections. If a workflow's trigger still points at a connection of another kind or engine, publishing reports an error such as 'Orders DB' is not supported here: PostgreSQL connection accepts PostgreSQL connections only.
These connections always come from the official apps; custom apps are HTTP only.
Creating a connection
- Go to Apps, open the Databases, Files or Email category, and click Connect on the app, for example PostgreSQL.
- Enter a name and fill in the fields below. Fields marked with
*are required. - Click Save & test. Blokkio saves the connection, connects to the server and shows the result in the dialog, for example Connected to PostgreSQL at db.example.com. Fix the values and click Save & test again until it succeeds, then click Done. Create saves without testing.
Any text or password field can use Use secret to reference a project secret (secret://NAME) instead of
holding the value. See Secrets vs. connections.
When you edit a connection later, stored passwords, keys and passphrases are not shown. Leave them empty to keep the stored value.
Database
Used for PostgreSQL, MySQL (and MariaDB) and Microsoft SQL Server (and Azure SQL). The app you connect decides the database engine.
| Field | Key | Required | Default | Description |
|---|---|---|---|---|
| Host | host | Yes | — | Host name or IP address, for example db.example.com |
| Port | port | No | 5432 / 3306 / 1433 | Left empty, the engine's default port is used |
| Database | database | Yes | — | Database name |
| Username | username | Yes | — | Database user |
| Password | password | No | — | Stored encrypted |
| SSL mode | sslMode | No | prefer (SQL Server: require) | disable, prefer, require, verify-ca or verify-full (see below) |
| SSL mode | PostgreSQL and MySQL | SQL Server |
|---|---|---|
disable | No TLS. | Encrypt only if the server requires it (shown as Optional). |
prefer | Use TLS when the server offers it; the certificate isn't verified. | Not offered; treated as disable. |
require | Always encrypt, but don't verify the server's certificate. | Always encrypt, trust the server certificate without verifying it. |
verify-ca | Always encrypt, and verify that the certificate is signed by a trusted CA. The host name isn't checked. | Not offered; treated as verify-full. |
verify-full | Always encrypt, and verify the certificate and that it matches the host name. | Always encrypt, and verify the certificate and the host name. |
require protects the traffic from eavesdropping but not from a server that impersonates yours. For databases
reached over the internet, use verify-full (or verify-ca when the certificate is trusted but its name doesn't
match the host you connect to).
Connections time out after 15 seconds. Create a dedicated database user with only the rights your workflows need, for example a read-only user for the Database Row Trigger.
SFTP
| Field | Key | Required | Default | Description |
|---|---|---|---|---|
| Host | host | Yes | — | For example sftp.example.com |
| Port | port | No | 22 | SSH port |
| Username | username | Yes | — | SSH user |
| Password | password | One of password or key | — | Stored encrypted |
| Private key | privateKey | One of password or key | — | PEM or OpenSSH private key, pasted in full. Stored encrypted |
| Key passphrase | passphrase | No | — | Only if the private key is encrypted. Stored encrypted |
| Host key fingerprint | hostKeyFingerprint | No | — | The server's SHA256 host key fingerprint, for example SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 |
A password or a private key is required; with both, Blokkio tries the key first. Saving without either fails with A password or a private key is required.
Set Host key fingerprint whenever you can. Without it, Blokkio accepts any host key. With it, the connection is refused when the server presents a different key:
SFTP host key fingerprint mismatch (expected SHA256:nThbg6…, got SHA256:Qm1x…).
To read the fingerprint, run ssh-keyscan sftp.example.com | ssh-keygen -lf - on a trusted machine, or ask the
server's administrator.
IMAP
| Field | Key | Required | Default | Description |
|---|---|---|---|---|
| Host | host | Yes | — | For example imap.example.com |
| Port | port | No | 993 | Left empty: 993 for SSL/TLS, otherwise 143 |
| Security | security | No | ssl | ssl (SSL/TLS), starttls or none (unencrypted) |
| Username | username | Yes | — | Usually the email address |
| Password | password | Yes | — | The password, or an app password for providers with two-factor sign-in (for example Gmail or Outlook) |
SMTP
| Field | Key | Required | Default | Description |
|---|---|---|---|---|
| Host | host | Yes | — | For example smtp.example.com |
| Port | port | No | 587 | Left empty: 465 for SSL/TLS, otherwise 587 |
| Security | security | No | starttls | ssl (SSL/TLS), starttls or none (unencrypted) |
| Username | username | No | — | Leave empty for a relay that doesn't require sign-in |
| Password | password | No | — | Stored encrypted |
| From address | fromAddress | Yes | — | Sender address of every email, for example robot@example.com |
| From name | fromName | No | — | Sender display name. The Send Email block can override it |
Use port 465 with SSL/TLS, or port 587 with STARTTLS.
Testing
Save & test in the dialog, and ⋯ → Test connection on the Connections page, check the connection against the real server:
| Kind | What the test does | Success message |
|---|---|---|
| Database | Connects and runs SELECT 1 | Connected to PostgreSQL at db.example.com. |
| SFTP | Connects, checks the host key and signs in | Connected to sftp.example.com (working directory /home/acme). |
| IMAP | Connects and signs in | Signed in to imap.example.com. |
| SMTP | Connects and signs in (when a username is set) | Signed in to smtp.example.com. or Connected to smtp.example.com (no username configured, so no sign-in was attempted). |
The test gives up after about 20 seconds with The server did not answer in time. If the server rejects the username or password, the result starts with The server rejected the credentials (or The database rejected the credentials) and the connection is marked Auth failed. Other errors, such as an unknown host or a TLS problem, are shown but don't change the connection's status.
To check the values a run in an environment uses, choose ⋯ → Test connection → In … for that environment, or Test in the Environment overrides dialog. Such a test applies the environment's override and secret values; its result is shown but doesn't change the connection's status.
Network protection
The host of a database, SFTP, IMAP or SMTP connection must resolve to a public address. Hosts that resolve to
private or internal addresses (localhost, 10.0.0.0/8, 192.168.0.0/16, cloud metadata endpoints and so on)
and Unix socket paths are refused, in tests and in runs. Blokkio connects to the address it checked, so a second
DNS answer can't redirect the connection.
To reach a server in a private network, expose it through a public, firewalled address.
Self-hosted workers
Database Query and Send Email need the connection's decrypted fields, which never leave Blokkio. They always run on Blokkio's hosted workers, even when the project is assigned to a self-hosted worker pool; the other nodes of the workflow still run on your pool. The database or mail server must therefore be reachable from Blokkio (see Network protection).
The Database Row, Email and SFTP triggers always run on Blokkio's side, so they work for every project.
Triggers created before connections
The Database Row, Email and SFTP triggers used to take a host, username and secrets directly on the node. Existing workflows with these inline settings keep working, but new triggers should use a connection: the settings are shared, tested and can differ per environment.