Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Private CA #75

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,24 @@ FlowFuse driver to create projects as docker containers

## Configuration

## Configuration

In the `flowforge.yml` file

```yaml
...
driver:
type: docker
options:
socket: /var/run/docker.sock
registry: containers.flowforge.com
privateCA: /full/path/to/chain.pem
```

- `registry` is the Docker Registry to load Stack Containers from (default: Docker Hub)
- `socket` is the path to the docker unix domain socket (default: /var/run/docker.sock)
- privateCA: is the fully qualified path to a pem file containing trusted CA cert chain (default: not set)

### Configuration via environment variables

- `DOCKER_SOCKET` - Path to docker unix domain socket
8 changes: 8 additions & 0 deletions docker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require('fs')
const got = require('got')
const Docker = require('dockerode')

Expand Down Expand Up @@ -85,6 +86,13 @@ const createContainer = async (project, domain) => {
contOptions.Env.push(`FORGE_NR_SECRET=${credentialSecret}`)
}

if (this._app.config.driver.options.privateCA && fs.existsSync(this._app.config.driver.options.privateCA)) {
contOptions.Binds = [
`${this._app.config.driver.options.privateCA}:/usr/local/ssl-certs/chain.pem`
]
contOptions.Env.push('NODE_EXTRA_CA_CERTS=/usr/local/ssl-certs/chain.pem')
}

const container = await this._docker.createContainer(contOptions)
return container.start()
.then(async () => {
Expand Down