Compare commits

..

105 Commits

Author SHA1 Message Date
021a7d6380 v3.5.1 2022-04-29 21:53:20 +03:00
5fab467ccd Merge pull request #144 from balena-io/revert-143-landr-test
Revert "Adding Landr test for openbalena"
2022-04-29 18:51:21 +00:00
20f9f0320a Merge branch 'revert-143-landr-test' of https://github.com/balena-io/open-balena into revert-143-landr-test 2022-04-29 11:47:15 -07:00
9ff551d528 Revert "Adding Landr test for openbalena"
Change-type: patch
2022-04-29 11:46:50 -07:00
c8946a95da Revert "Adding Landr test for openbalena" 2022-04-29 11:46:06 -07:00
dd59088cd2 v3.5.0 2022-04-29 21:42:18 +03:00
cae93253a9 Merge pull request #143 from balena-io/landr-test
Adding Landr test for openbalena
2022-04-29 18:40:01 +00:00
c4a18f5bf8 add table workaround and docs edits 2022-04-27 14:17:57 -07:00
3b0c106eb1 editing docs 2022-04-27 10:51:18 -07:00
c9fa4cf00f add actual docs and clean up readme 2022-04-27 10:32:33 -07:00
ea605d1444 Merge branch 'landr-test' of https://github.com/balena-io/open-balena into landr-test 2022-04-25 15:28:56 -07:00
966ea04241 test docs 2022-04-14 16:53:33 -07:00
dce59b65a3 test edits 2022-04-14 16:07:04 -07:00
f151d2a6cc landr updates 2022-04-13 16:04:44 -07:00
4efb25afc7 Merge branch 'landr-test' of https://github.com/balena-io/open-balena into landr-test 2022-03-24 14:25:44 -07:00
08890adf92 Merge branch 'landr-test' of https://github.com/balena-io/open-balena into landr-test 2022-03-23 20:09:43 -07:00
44c11d9d16 Adding Landr test for openbalena
Change-type: minor
2022-03-22 01:23:59 +05:30
e5bbfb833f Adding Landr test for openbalena
Change-type: minor
2022-03-22 00:32:25 +05:30
a9107a1d6f Adding Landr test for openbalena
Change-type: minor
2022-03-17 17:09:19 -07:00
f7207fb4a0 v3.4.3 2022-02-22 14:13:16 +02:00
b39074c0ba Merge pull request #139 from bartversluijs/registry-patch-1
chore(registry): removed data volume
2022-02-22 12:11:23 +00:00
3fed389090 chore(registry): removed data volume
Change-type: patch
2022-02-22 12:03:40 +01:00
96afd454bf v3.4.2 2022-02-03 14:40:37 +02:00
0e0e5e1bc5 Merge pull request #131 from torutek/fix-certs
Get cert-provider working again
2022-02-03 12:38:48 +00:00
7c4e9fdc09 Get cert-provider working again
Need new version to use ACME v2 correctly.
Force using letsencrypt (didn't work otherwise, not totally sure why not)
Update bundled staging certs, contents are from:
https://github.com/letsencrypt/website/blob/master/static/certs/staging/letsencrypt-stg-root-dst.pem
https://github.com/letsencrypt/website/blob/master/static/certs/staging/letsencrypt-stg-root-x1.pem
https://github.com/letsencrypt/website/blob/master/static/certs/staging/letsencrypt-stg-root-x2.pem
https://github.com/letsencrypt/website/blob/master/static/certs/staging/letsencrypt-stg-int-e1.pem
https://github.com/letsencrypt/website/blob/master/static/certs/staging/letsencrypt-stg-int-r3.pem
ref https://letsencrypt.org/docs/staging-environment/

Change-type: patch
2021-10-06 09:46:51 +13:00
fbcb35a595 v3.4.1 2021-07-01 00:13:18 +03:00
94f8b159c3 Merge pull request #126 from balena-io/dfunckt-patch-1
Delete CODEOWNERS
2021-06-30 21:11:33 +00:00
a328e8fc1d Delete CODEOWNERS
Change-type: patch
2021-06-30 18:30:12 +03:00
b1fd42669a v3.4.0 2021-06-25 18:39:31 +03:00
39f7f6b0cc Merge pull request #123 from bartversluijs/patch-services
minor: Update API, registry and VPN services
2021-06-25 15:36:25 +00:00
1180bb3462 Update API, registry and VPN services
Update open-balena-api from 0.119.5 to 0.139.0
Update open-balena-registry from 2.16.0 to 2.16.1
Update open-balena-vpn from 9.17.4 to 9.17.11

Change-type: minor
2021-06-25 12:48:59 +02:00
fbf3007d4c v3.3.2 2021-06-04 08:42:20 +03:00
2a3df9cd2a Merge pull request #119 from relaxdiego/master
Auto-install required Vagrant plugins intead of erroring out
2021-06-04 05:40:18 +00:00
d71a90c1ef Auto-install required Vagrant plugins instead of erroring out
Change-type: patch
2021-06-03 09:59:44 +08:00
6739d1257b v3.3.1 2021-05-24 15:40:42 +03:00
381fba943d Merge pull request #116 from balena-io/delete-cli-version-warning
scripts/compose: Delete Balena CLI version warning
2021-05-24 12:39:12 +00:00
66acae8bbf scripts/compose: Delete never called helper function 2021-05-24 14:16:11 +02:00
cd2c3f5e11 scripts/compose: Delete Balena CLI version warning
This can be removed completely now — it was added to ensure existing users also update to the latest (at the time) CLI as they updated their open-balena installation.

Change-type: patch
2021-05-24 14:08:00 +02:00
071b5850a9 v3.3.0 2021-05-05 16:22:49 +03:00
91bc92dbb5 Merge pull request #115 from bartversluijs/patch-registry
Update registry service to v2.16.0
2021-05-05 13:21:13 +00:00
49831a6a60 Update registry service
Change-type: minor
2021-05-05 15:13:27 +02:00
549de52c73 v3.2.2 2021-04-29 14:36:50 +03:00
826b61f08b Merge pull request #112 from balena-io/rmorillo24-patch-OBsupporteddevices
patch: Adding supported devices to OB
2021-04-29 11:35:14 +00:00
0cdf0ef558 patch: Adding supported devices to OB
Added a line in the OB vs balenaCloud which includes a mention to the devices supported by each. This list is mentioned in the FAQ section of the pricing page.
2021-04-28 17:14:52 +02:00
bea552de6a v3.2.1 2021-02-07 01:15:14 +02:00
419f3cddc4 Merge pull request #106 from balena-io/update-codeowners
Add Matt and Paulo to CODEOWNERS
2021-02-06 23:13:38 +00:00
b92a3c8092 v3.2.0 2021-01-29 17:55:27 +02:00
746be65846 Add Matt and Paulo to CODEOWNERS
Change-type: patch
2021-01-29 15:54:49 +00:00
6250c85551 Merge pull request #105 from balena-io/update-services
Update services
2021-01-29 15:53:14 +00:00
3898342a5b Update services
Update open-balena-api from 0.109.2 to 0.119.5
Update balena-mdns-publisher from 1.7.9 to 1.9.2
Update open-balena-registry from 2.13.11 to 2.14.4
Update open-balena-vpn from 9.16.1 to 9.17.4

Change-type: minor
2021-01-29 17:34:31 +02:00
ab0b7467fd v3.1.4 2021-01-29 17:18:53 +02:00
7cdce1a1c7 Merge pull request #104 from balena-io/close-port-3128
SECURITY: Close port 3128
2021-01-29 15:16:55 +00:00
da4c1678ec SECURITY: Close tunneling port (3128)
Port 3128, which was used for tunneling into devices, was plain TCP and has now been closed. Tunnelling is now via `tunnel.mydomain.com:443` (see #101). balena-cli versions before v12.38.5 are now incompatible and using the tunnel command will throw an error.

Refs: #101
Change-type: patch
2021-01-29 17:13:19 +02:00
6fdc700806 v3.1.3 2021-01-26 14:14:42 +02:00
e6d0be1c74 Merge pull request #103 from balena-io/edit-codeowners
Remove Rich from CODEOWNERS
2021-01-26 12:12:15 +00:00
a0ef371621 Remove Rich from CODEOWNERS
Change-type: patch
2021-01-26 13:30:04 +02:00
cd98a0df3f v3.1.2 2021-01-22 16:10:08 +02:00
296a746e96 Merge pull request #101 from balena-io/switch-tunnel-to-tls
tunnel: Expose tunnel service via TLS
2021-01-22 14:08:00 +00:00
b3d184c13c tunnel: Expose tunnel service via TLS
In order to support the new CLI and balenaCloud deployment
schemes for the tunnel service, the service is now exposed via
the TLS port 443 on the `tunnel.{domain}` server name.

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2021-01-22 11:55:33 +00:00
3b9433e9cc v3.1.1 2020-11-10 17:59:55 +02:00
763da0eb45 Merge pull request #97 from balena-io/update-versions
Update open-balena-api
2020-11-10 15:57:48 +00:00
bfce474ff0 Update open-balena-api
Fixes a bug with a migration that would keep obsolete DB columns around and prevent creation of applications and devices.

See https://github.com/balena-io/open-balena-api/pull/507

Fixes #94 #95

Change-type: patch
2020-11-10 17:54:33 +02:00
308322f774 v3.1.0 2020-11-03 18:22:26 +02:00
c2077e5037 Merge pull request #96 from balena-io/set-default-bucket-prefix-images
Change S3 OS images folder from resinos to images
2020-11-03 16:20:37 +00:00
7790290d0e Change S3 OS images folder from resinos to images
Change-type: minor
Signed-off-by: Stevche Radevski <stevche@balena.io>
2020-11-03 17:15:14 +01:00
857e6b3bd7 v3.0.1 2020-10-29 13:43:03 +02:00
cbee20731b Merge pull request #93 from balena-io/update-api
Update the API fixing an issue with migrations
2020-10-29 11:41:04 +00:00
eec16b843d Update the API fixing an issue with migrations
When updating from previous versions, the API will fail to execute the database migrations. This updates the API version to include a fix for this.

Change-type: patch
2020-10-29 13:35:30 +02:00
a3126359e0 v3.0.0 2020-10-28 14:17:36 +02:00
6438da8498 Merge pull request #88 from balena-io/v3
Update versions of services
2020-10-28 12:16:01 +00:00
1f7ed769c0 Update versions of services
Change-type: major
2020-10-28 14:06:47 +02:00
41b1800166 Reorder README sections to bring “Getting Started” further up 2020-10-28 13:10:18 +02:00
77e3cfcdb6 v2.0.5 2020-10-12 14:42:08 +03:00
d3f11819ce Merge pull request #89 from balena-io/comparison-table
docs: add table comparing features of openBalena and balenaCloud
2020-10-12 11:40:27 +00:00
3816f09bc4 v2.0.4 2020-10-08 23:23:24 +03:00
7154c5903f Merge pull request #90 from balena-io/cli-incompatibility
docs: note that balenaCLI is incompatible >12.2.2
2020-10-08 20:21:43 +00:00
71a692b28b docs: note that balenaCLI is incompatible >12.2.2
Connects-to: #85
Change-type: patch
Signed-off-by: Matthew McGinn <matthew@balena.io>
2020-10-08 15:35:02 -04:00
feeb830405 docs: add table comparing features of openBalena and balenaCloud
Connects-to: #62
Change-type: patch
Signed-off-by: Matthew McGinn <matthew@balena.io>
2020-10-08 17:11:56 +00:00
eb262fe9a2 v2.0.3 2020-06-01 12:41:28 +03:00
6db5e59958 Merge pull request #79 from balena-io/add-balenaos-version
docs: Add PSA about balenaOS version breakage
2020-06-01 09:39:28 +00:00
d33560755f docs: Add PSA about balenaOS version breakage
Due to a change in the balena-supervisor codebase, only balenaOS
versions <= 2.49.0 are working with open-balena.

This documentation change is a band-aid while we resolve the issue.

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2020-06-01 10:35:00 +01:00
f427982714 v2.0.2 2020-04-03 16:56:38 +03:00
b99e497ac9 Merge pull request #75 from Langhalsdino/patch-1
Add units to the default timeouts in haproxy.cfg
2020-04-03 16:54:57 +03:00
de0293563f Added units to haproxy.cfg default timeouts
I added unit 's' (second) to the default timeouts in order to make them more readable.

Change-type: patch
2020-03-27 15:43:11 +01:00
17419557a5 v2.0.1 2020-01-17 12:30:31 +02:00
c58ee37f17 Merge pull request #65 from balena-io/cert-provider-update
cert-provider: Update to support ACMEv2 on staging provider
2020-01-17 10:28:43 +00:00
d67e29223f cert-provider: Update to support ACMEv2 on staging provider
Acquiring a staging certificiate from LetsEncrypt was failing, so acme.sh was
updated to version 2.8.5, which includes support for using ACMEv2 on the
LetsEncrypt servers.

Changes to the state flow to make access retries infinite as it became apparent
that in some scenarios the certificate acquisition could fail to occur due to
containers taking longer to become accessible.

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2020-01-17 10:24:43 +00:00
08a990d32d v2.0.0 2019-09-02 13:39:55 +03:00
d70c2177ff Merge pull request #60 from balena-io/use-s3
feature: Use S3 bucket for Registry service backend
2019-09-02 11:38:03 +01:00
2a7d0687a2 feature: Use S3 bucket for Registry service backend
Update open-balena-s3 to 2.8.3

This makes new installations of openBalena use the S3 container as a
storage backend for the Registry service by default. Existing installs
should not be affected.

Change-type: major
Signed-off-by: Rich Bayliss <rich@balena.io>
2019-09-02 10:30:15 +01:00
e6c865e383 v1.3.0 2019-07-30 14:21:49 +03:00
617209dc9e Merge pull request #59 from balena-io/use-bob
feature: Support deployment via balena push to local-mode balenaOS devices
2019-07-30 12:20:02 +01:00
853ffb33e8 services: Update Registry service version
Update open-balena-registry to 2.11.1

This allows the registry to use an S3 bucket for storing images.

Change-type: minor
Signed-off-by: Rich Bayliss <rich@balena.io>
2019-07-30 12:10:06 +01:00
a029160caf feature: Support deployment via balena push to local-mode balenaOS devices
- remove some `.gitignore` entries as this is also honoured by `balena push`
- added a step to `scripts/quickstart` to produce a single, flat `docker-compose.yml` after running
- set the compose file versions to `2.0` to ensure only supported terms are used in the `docker-compose.yml` file output
- quoted empty env values as these need to be passed in as blank, and not ommitted
- include the MDNS publisher service IF the domain being used is a .local one
- corrected spelling of macOS in script messages
- move sidecar container source into ./src as per convention

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2019-07-30 12:10:01 +01:00
bb1328e27e v1.2.0 2019-05-21 18:00:07 +03:00
395613af57 Merge pull request #53 from balena-io/service-updates
Update service versions
2019-05-21 15:58:07 +01:00
199d8eb4a4 tidy: Remove unused DEVICE_CONFIG_OPENVPN_CONFIG variable
Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2019-05-21 15:47:57 +01:00
6fdc554e43 services: Update Registry service version
Update open-balena-registry to 2.7.0

This allows registry to be configured to use its internal Redis instance for caching. It is still disabled by default though.

Change-type: minor
2019-05-21 14:45:54 +01:00
f8b8a1589a services: Update API service version
Update open-balena-api from 0.11.8 to 0.19.5

This brings in the latest bugfixes and changes.

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2019-05-21 14:01:38 +01:00
3bf14a2140 v1.1.1 2019-05-10 18:22:12 +03:00
fef145f993 Merge pull request #51 from balena-io/50-update-docker-compose
docker: Update docker-compose version to latest
2019-05-10 16:20:42 +01:00
e068f8058f docker: Update docker-compose version to latest
Connects-to: #50
Change-type: patch
Signed-off-by: Heds Simons <heds@balena.io>
2019-05-07 17:15:19 +01:00
c1ee146f0d v1.1.0 2019-05-07 14:38:17 +03:00
9ad92596b9 Merge pull request #49 from balena-io/48-s3-credential-changes
s3: Update to latest version with credentials
2019-05-07 12:36:26 +01:00
56de2d20bb s3: Update to latest version with credentials
Credentials for S3 can now be specified using the
following docker-compose based envvars:

* S3_MINIO_ACCESS_KEY
* S3_MINIO_SECRET_KEY

Connects-to: #48
Change-type: minor
Signed-off-by: Heds Simons <heds@balena.io>
2019-05-07 11:18:48 +01:00
28 changed files with 8370 additions and 181 deletions

2
.github/CODEOWNERS vendored
View File

@ -1,2 +0,0 @@
# Main repo owners:
* @dfunckt @richbayliss

7
.gitignore vendored
View File

@ -1,6 +1,7 @@
.DS_Store
.project
.vagrant/
config/
src/
package-lock.json
/config
/docker-compose.yml
/package-lock.json

5349
.versionbot/CHANGELOG.yml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -25,42 +25,25 @@ To learn more about openBalena, visit [balena.io/open][open-balena-website].
- **Built-in VPN**: Access your devices regardless of their network environment
## Roadmap
OpenBalena is currently in beta. While fully functional, it lacks features we
consider important before we can comfortably call it production-ready. During
this phase, dont be alarmed if things dont work as expected just yet (and
please let us know about any bugs or errors you encounter!). The following
improvements and new functionality is planned:
- Full documentation
- Full test suite
- Simplified deployment
- Remote host OS updates
- Support for custom device types
## Contributing
Everyone is welcome to contribute to openBalena. There are many different ways
to get involved apart from submitting pull requests, including helping other
users on the [forums][forums], reporting or triaging [issues][issue-tracker],
reviewing and discussing [pull requests][pulls], or just spreading the word.
All of openBalena is hosted on GitHub. Apart from its constituent components,
which are the [API][open-balena-api], [VPN][open-balena-vpn], [Registry][open-balena-registry],
[S3 storage service][open-balena-s3], and [Database][open-balena-db], contributions
are also welcome to its client-side software such as the [balena CLI][balena-cli],
the [balena SDK][balena-sdk], [balenaOS][balena-os] and [balenaEngine][balena-engine].
## Getting Started
Our [Getting Started][getting-started] guide is the most direct path to getting
Our [Getting Started guide][getting-started] is the most direct path to getting
an openBalena installation up and running and successfully deploying your
application to your device(s).
## Compatibility
The current release of openBalena has the following minimum version requirements:
- balenaOS v2.58.3
- balena CLI v12.38.5
If you are updating from previous openBalena versions, ensure you update the balena
CLI and reprovision any devices to at least the minimum required versions in order
for them to be fully compatible with this release, as some features may not work.
## Documentation
While we're still working on the project documentation, please refer to the
@ -89,6 +72,54 @@ for help, or contribute by answering questions posted by fellow openBalena users
Please do not use the issue tracker for support-related questions.
## Contributing
Everyone is welcome to contribute to openBalena. There are many different ways
to get involved apart from submitting pull requests, including helping other
users on the [forums][forums], reporting or triaging [issues][issue-tracker],
reviewing and discussing [pull requests][pulls], or just spreading the word.
All of openBalena is hosted on GitHub. Apart from its constituent components,
which are the [API][open-balena-api], [VPN][open-balena-vpn], [Registry][open-balena-registry],
[S3 storage service][open-balena-s3], and [Database][open-balena-db], contributions
are also welcome to its client-side software such as the [balena CLI][balena-cli],
the [balena SDK][balena-sdk], [balenaOS][balena-os] and [balenaEngine][balena-engine].
## Roadmap
OpenBalena is currently in beta. While fully functional, it lacks features we
consider important before we can comfortably call it production-ready. During
this phase, dont be alarmed if things dont work as expected just yet (and
please let us know about any bugs or errors you encounter!). The following
improvements and new functionality is planned:
- Full documentation
- Full test suite
- Simplified deployment
- Remote host OS updates
- Support for custom device types
## Differences between openBalena and balenaCloud
| openBalena | balenaCloud |
| ----- | ---- |
| Device updates using full images | Device updates using [delta images](https://www.balena.io/docs/learn/deploy/delta/) |
| Support for a single user | Support for [multiple users](https://www.balena.io/docs/learn/manage/account/#application-members) |
| Self-hosted deployment and scaling | balena-managed scaling and deployment |
| Community support via [forums][forums] | Private support on [paid plans](https://www.balena.io/pricing/) |
| Deploy via `balena deploy` only | Build remotely with native builders using [`balena push`](https://www.balena.io/docs/learn/deploy/deployment/#balena-push) or [`git push`](https://www.balena.io/docs/learn/deploy/deployment/#git-push) |
| No support for building via `git push` | Use the same CI workflow with [`git push`](https://www.balena.io/docs/learn/deploy/deployment/#git-push) |
| No public URL support | Serve websites directly from device with [public device URLs](https://www.balena.io/docs/learn/manage/actions/#enable-public-device-url) |
| Management via `balena-cli` only | Cloud-based device management dashboard |
| Download images from [balena.io][balena-os-website] | Download preconfigured images directly from the dashboard |
| No supported remote diagnostics | Remote device diagnostics |
| Supported devices: Raspberry Pi family, the Intel NUC, the NVIDIA Jetson TX2, and the balenaFin | All the devices listed in balena's [reference documentation](https://www.balena.io/docs/reference/hardware/devices/) |
Additionally, refer back to the [roadmap](#roadmap) above for planned but not yet implemented features.
## License
OpenBalena is licensed under the terms of AGPL v3. See [LICENSE](LICENSE) for details.

View File

@ -1 +1 @@
1.0.2
3.5.1

21
Vagrantfile vendored
View File

@ -1,12 +1,11 @@
Vagrant.require_version '>= 2.0.0'
[ 'vagrant-vbguest', 'vagrant-docker-compose' ].each do |p|
unless Vagrant.has_plugin?(p)
raise "Please install missing plugin: vagrant plugin install #{p}"
end
end
Vagrant.require_version '>= 2.2.0'
Vagrant.configure('2') do |config|
config.vagrant.plugins = [
'vagrant-vbguest',
'vagrant-docker-compose'
]
config.vm.define 'openbalena'
config.vm.hostname = 'openbalena-vagrant'
config.vm.box = 'bento/ubuntu-18.04'
@ -20,15 +19,21 @@ Vagrant.configure('2') do |config|
config.ssh.forward_agent = true
config.vm.provision :docker
config.vm.provision :docker_compose
$provision = <<-SCRIPT
DOCKER_COMPOSE_VERSION=1.24.0
touch /home/vagrant/.bashrc
grep -Fxq 'source /home/vagrant/openbalena/.openbalenarc' /home/vagrant/.bashrc || echo 'source /home/vagrant/openbalena/.openbalenarc' >> /home/vagrant/.bashrc
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
source "/home/vagrant/.nvm/nvm.sh" # This loads nvm
nvm install 10.15.0 && nvm use 10.15.0
# Install a newer version of docker-compose
(cd /usr/local/bin; \
sudo curl -o docker-compose --silent --location https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Linux-x86_64; \
sudo chmod a+x docker-compose)
SCRIPT
config.vm.provision :shell, privileged: false, inline: $provision

View File

@ -1,56 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIFATCCAumgAwIBAgIRAKc9ZKBASymy5TLOEp57N98wDQYJKoZIhvcNAQELBQAw
GjEYMBYGA1UEAwwPRmFrZSBMRSBSb290IFgxMB4XDTE2MDMyMzIyNTM0NloXDTM2
MDMyMzIyNTM0NlowGjEYMBYGA1UEAwwPRmFrZSBMRSBSb290IFgxMIICIjANBgkq
hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA+pYHvQw5iU3v2b3iNuYNKYgsWD6KU7aJ
diddtZQxSWYzUI3U0I1UsRPTxnhTifs/M9NW4ZlV13ZfB7APwC8oqKOIiwo7IwlP
xg0VKgyz+kT8RJfYr66PPIYP0fpTeu42LpMJ+CKo9sbpgVNDZN2z/qiXrRNX/VtG
TkPV7a44fZ5bHHVruAxvDnylpQxJobt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
b3JnLzA0BggrBgEFBQcwAoYoaHR0cDovL2NlcnQuc3RnLXJvb3QteDEubGV0c2Vu
Y3J5cHQub3JnLzAfBgNVHSMEGDAWgBTBJnSkikSg5vogKNhcI5pFiBh54DANBgkq
hkiG9w0BAQsFAAOCAgEABYSu4Il+fI0MYU42OTmEj+1HqQ5DvyAeyCA6sGuZdwjF
UGeVOv3NnLyfofuUOjEbY5irFCDtnv+0ckukUZN9lz4Q2YjWGUpW4TTu3ieTsaC9
AFvCSgNHJyWSVtWvB5XDxsqawl1KzHzzwr132bF2rtGtazSqVqK9E07sGHMCf+zp
DQVDVVGtqZPHwX3KqUtefE621b8RI6VCl4oD30Olf8pjuzG4JKBFRFclzLRjo/h7
IkkfjZ8wDa7faOjVXx6n+eUQ29cIMCzr8/rNWHS9pYGGQKJiY2xmVC9h12H99Xyf
zWE9vb5zKP3MVG6neX1hSdo7PEAb9fqRhHkqVsqUvJlIRmvXvVKTwNCP3eCjRCCI
PTAvjV+4ni786iXwwFYNz8l3PmPLCyQXWGohnJ8iBm+5nk7O2ynaPVW0U2W+pt2w
SVuvdDM5zGv2f9ltNWUiYZHJ1mmO97jSY/6YfdOUH66iRtQtDkHBRdkNBsMbD+Em
2TgBldtHNSJBfB3pm9FblgOcJ0FSWcUDWJ7vO0+NTXlgrRofRT6pVywzxVo6dND0
WzYlTWeUVsO40xJqhgUQRER9YLOLxJ0O6C8i0xFxAMKOtSdodMB3RIwt7RFQ0uyt
n5Z5MqkYhlMI3J1tPRTp1nEt9fyGspBOO05gi148Qasp+3N+svqKomoQglNoAxU=
-----END CERTIFICATE-----

View File

@ -1,4 +1,4 @@
version: '2.1'
version: "2.0"
services:
component:

31
compose/mdns.yml Normal file
View File

@ -0,0 +1,31 @@
version: "2.0"
services:
balena-mdns-publisher:
image: balena/balena-mdns-publisher:${OPENBALENA_MDNS_PUBLISHER_VERSION_TAG}
network_mode: "host"
cap_add:
- SYS_RESOURCE
- SYS_ADMIN
security_opt:
- apparmor:unconfined
tmpfs:
- /run
- /sys/fs/cgroup
# balenaOS - Required for host DBus comms. Not required for standalone Linux
labels:
io.balena.features.dbus: '1'
io.balena.features.supervisor-api: '1'
environment:
CONFD_BACKEND: ENV
# The name of the TLD to use. This *must* match certificates used for the rest of
# the resin backend (eg. that for BALENA_ROOT_CA if present).
MDNS_TLD: ${OPENBALENA_HOST_NAME}
# List of subdomains to advertise. This must include all required hosts.
MDNS_SUBDOMAINS: '["api", "db", "registry", "s3", "tunnel", "vpn"]'
# The expectation is the DBus socket to use is always at the following location.
DBUS_SESSION_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"
# Selects the interface used for incoming connections from the wider subnet.
# For NUCs, this is `eno1`. If running natively, pick the appropriate interface.
# Alternatively, keep the default commented out to autoselect.
#INTERFACE: "eno1"

View File

@ -1,11 +1,10 @@
version: "2.1"
version: "2.0"
volumes:
certs: {}
cert-provider: {}
db: {}
redis: {}
registry: {}
s3: {}
services:
@ -13,7 +12,7 @@ services:
extends:
file: ./common.yml
service: component
image: balena/open-balena-api:${OPENBALENA_API_VERSION_TAG:-master}
image: balena/open-balena-api:${OPENBALENA_API_VERSION_TAG}
depends_on:
- db
- s3
@ -27,13 +26,12 @@ services:
DB_PORT: 5432
DB_USER: docker
DELTA_HOST: delta.${OPENBALENA_HOST_NAME}
DEVICE_CONFIG_OPENVPN_CONFIG: ${OPENBALENA_VPN_CONFIG}
DEVICE_CONFIG_OPENVPN_CA: ${OPENBALENA_VPN_CA_CHAIN}
DEVICE_CONFIG_SSH_AUTHORIZED_KEYS: ${OPENBALENA_SSH_AUTHORIZED_KEYS}
HOST: api.${OPENBALENA_HOST_NAME}
IMAGE_MAKER_URL: img.${OPENBALENA_HOST_NAME}
IMAGE_STORAGE_BUCKET: resin-production-img-cloudformation
IMAGE_STORAGE_PREFIX: resinos
IMAGE_STORAGE_PREFIX: images
IMAGE_STORAGE_ENDPOINT: s3.amazonaws.com
JSON_WEB_TOKEN_EXPIRY_MINUTES: 10080
JSON_WEB_TOKEN_SECRET: ${OPENBALENA_JWT_SECRET}
@ -45,7 +43,7 @@ services:
REDIS_PORT: 6379
REGISTRY2_HOST: registry.${OPENBALENA_HOST_NAME}
REGISTRY_HOST: registry.${OPENBALENA_HOST_NAME}
SENTRY_DSN:
SENTRY_DSN: ""
TOKEN_AUTH_BUILDER_TOKEN: ${OPENBALENA_TOKEN_AUTH_BUILDER_TOKEN}
TOKEN_AUTH_CERT_ISSUER: api.${OPENBALENA_HOST_NAME}
TOKEN_AUTH_CERT_KEY: ${OPENBALENA_TOKEN_AUTH_KEY}
@ -62,31 +60,35 @@ services:
extends:
file: ./common.yml
service: component
image: balena/open-balena-registry:${OPENBALENA_REGISTRY_VERSION_TAG:-master}
image: balena/open-balena-registry:${OPENBALENA_REGISTRY_VERSION_TAG}
depends_on:
- api
- s3
- redis
volumes:
- registry:/data
environment:
API_TOKENAUTH_CRT: ${OPENBALENA_TOKEN_AUTH_PUB}
BALENA_REGISTRY2_HOST: registry.${OPENBALENA_HOST_NAME}
BALENA_ROOT_CA: ${OPENBALENA_ROOT_CA}
BALENA_TOKEN_AUTH_ISSUER: api.${OPENBALENA_HOST_NAME}
BALENA_TOKEN_AUTH_REALM: https://api.${OPENBALENA_HOST_NAME}/auth/v1/token
COMMON_REGION:
REGISTRY2_S3_BUCKET:
REGISTRY2_S3_KEY:
REGISTRY2_S3_SECRET:
COMMON_REGION: ${OPENBALENA_S3_REGION}
REGISTRY2_CACHE_ENABLED: "false"
REGISTRY2_CACHE_ADDR: 127.0.0.1:6379
REGISTRY2_CACHE_DB: 0
REGISTRY2_CACHE_MAXMEMORY_MB: 1024 # megabytes
REGISTRY2_CACHE_MAXMEMORY_POLICY: allkeys-lru
REGISTRY2_S3_REGION_ENDPOINT: ${OPENBALENA_S3_ENDPOINT}
REGISTRY2_S3_BUCKET: ${OPENBALENA_REGISTRY2_S3_BUCKET}
REGISTRY2_S3_KEY: ${OPENBALENA_S3_ACCESS_KEY}
REGISTRY2_S3_SECRET: ${OPENBALENA_S3_SECRET_KEY}
REGISTRY2_SECRETKEY: ${OPENBALENA_REGISTRY_SECRET_KEY}
REGISTRY2_STORAGEPATH: /data
REGISTRY2_DISABLE_REDIRECT: "false"
vpn:
extends:
file: ./common.yml
service: component
image: balena/open-balena-vpn:${OPENBALENA_VPN_VERSION_TAG:-master}
image: balena/open-balena-vpn:${OPENBALENA_VPN_VERSION_TAG}
depends_on:
- api
cap_add:
@ -98,7 +100,7 @@ services:
BALENA_VPN_PORT: 443
PRODUCTION_MODE: "${OPENBALENA_PRODUCTION_MODE}"
RESIN_VPN_GATEWAY: 10.2.0.1
SENTRY_DSN:
SENTRY_DSN: ""
VPN_HAPROXY_USEPROXYPROTOCOL: "true"
VPN_OPENVPN_CA_CRT: ${OPENBALENA_VPN_CA}
VPN_OPENVPN_SERVER_CRT: ${OPENBALENA_VPN_SERVER_CRT}
@ -110,17 +112,21 @@ services:
extends:
file: ./common.yml
service: system
image: balena/open-balena-db:${OPENBALENA_DB_VERSION_TAG:-master}
image: balena/open-balena-db:${OPENBALENA_DB_VERSION_TAG}
volumes:
- db:/var/lib/postgresql/data
s3:
extends:
file: ./common.yml
service: system
image: balena/open-balena-s3:${OPENBALENA_S3_VERSION_TAG:-master}
service: component
image: balena/open-balena-s3:${OPENBALENA_S3_VERSION_TAG}
volumes:
- s3:/export
environment:
S3_MINIO_ACCESS_KEY: ${OPENBALENA_S3_ACCESS_KEY}
S3_MINIO_SECRET_KEY: ${OPENBALENA_S3_SECRET_KEY}
BUCKETS: ${OPENBALENA_S3_BUCKETS}
redis:
extends:
@ -134,7 +140,7 @@ services:
extends:
file: ./common.yml
service: system
build: ../haproxy
build: ../src/haproxy
depends_on:
- api
- cert-provider
@ -146,9 +152,9 @@ services:
ports:
- "80:80"
- "443:443"
- "3128:3128"
expose:
- "222"
- "3128"
- "5432"
- "6379"
networks:
@ -160,6 +166,7 @@ services:
- db.${OPENBALENA_HOST_NAME}
- s3.${OPENBALENA_HOST_NAME}
- redis.${OPENBALENA_HOST_NAME}
- tunnel.${OPENBALENA_HOST_NAME}
environment:
BALENA_HAPROXY_CRT: ${OPENBALENA_ROOT_CRT}
BALENA_HAPROXY_KEY: ${OPENBALENA_ROOT_KEY}
@ -169,11 +176,11 @@ services:
- certs:/certs:ro
cert-provider:
build: ../cert-provider
build: ../src/cert-provider
volumes:
- certs:/certs
- cert-provider:/usr/src/app/certs
environment:
ACTIVE: ${OPENBALENA_ACME_CERT_ENABLED}
DOMAINS: "api.${OPENBALENA_HOST_NAME},registry.${OPENBALENA_HOST_NAME},s3.${OPENBALENA_HOST_NAME},vpn.${OPENBALENA_HOST_NAME}"
DOMAINS: "api.${OPENBALENA_HOST_NAME},registry.${OPENBALENA_HOST_NAME},s3.${OPENBALENA_HOST_NAME},vpn.${OPENBALENA_HOST_NAME},tunnel.${OPENBALENA_HOST_NAME}"
OUTPUT_PEM: /certs/open-balena.pem

View File

@ -7,4 +7,4 @@
# `compose/services.yml` as the "base" config.
#
# You may view the effective config with `scripts/compose config`.
version: '2.1'
version: "2.0"

View File

@ -1,5 +1,6 @@
export OPENBALENA_API_VERSION_TAG=v0.11.8
export OPENBALENA_DB_VERSION_TAG=v2.0.3
export OPENBALENA_REGISTRY_VERSION_TAG=v2.5.0
export OPENBALENA_S3_VERSION_TAG=v2.5.0
export OPENBALENA_VPN_VERSION_TAG=v8.10.0
export OPENBALENA_API_VERSION_TAG=v0.139.0
export OPENBALENA_DB_VERSION_TAG=v4.1.0
export OPENBALENA_MDNS_PUBLISHER_VERSION_TAG=v1.9.2
export OPENBALENA_REGISTRY_VERSION_TAG=v2.16.1
export OPENBALENA_S3_VERSION_TAG=v2.9.9
export OPENBALENA_VPN_VERSION_TAG=v9.17.11

View File

@ -1,2 +1,15 @@
type: 'generic'
type: "generic"
reviewers: 1
upstream:
- repo: open-balena-api
url: https://github.com/balena-io/open-balena-api
- repo: open-balena-vpn
url: https://github.com/balena-io/open-balena-vpn
- repo: open-balena-registry
url: https://github.com/balena-io/open-balena-registry
- repo: open-balena-db
url: https://github.com/balena-io/open-balena-db
- repo: open-balena-s3
url: https://github.com/balena-io/open-balena-s3
- repo: balena-mdns-publisher
url: https://github.com/balena-io/balena-mdns-publisher

View File

@ -22,7 +22,7 @@ done
if [ -z "${REALPATH}" ]; then
echo_error 'Unable to find suitable command for realpath.'
if [ $(uname) == 'Darwin' ]; then
echo 'GNU coreutils are required to build openBalena on MacOS. To install with brew, run'
echo 'GNU coreutils are required to build openBalena on macOS. To install with brew, run'
echo ''
echo ' brew install coreutils'
echo ''

View File

@ -24,9 +24,17 @@ if [ ! -f "$ENV_FILE" ]; then
exit 1
fi
source "${ENV_FILE}"
# only include the MDNS publisher IF the domain is valid...
if [ ${OPENBALENA_HOST_NAME: -6} == ".local" ]; then
INCLUDE_MDNS="-f ${BASE_DIR}/compose/mdns.yml"
fi
# shellcheck source=/dev/null
source "${VERSIONS_FILE}"; source "${ENV_FILE}"; docker-compose \
source "${VERSIONS_FILE}"; docker-compose \
--project-name 'openbalena' \
-f "${BASE_DIR}/compose/services.yml" \
${INCLUDE_MDNS} \
-f "${CONFIG_DIR}/docker-compose.yml" \
"$@"

62
scripts/logger.sh Normal file
View File

@ -0,0 +1,62 @@
#!/bin/sh
BLACK=`tput setaf 0`
RED=`tput setaf 1`
GREEN=`tput setaf 2`
YELLOW=`tput setaf 3`
BLUE=`tput setaf 4`
MAGENTA=`tput setaf 5`
CYAN=`tput setaf 6`
WHITE=`tput setaf 7`
BOLD=`tput bold`
RESET=`tput sgr0`
log_raw () {
local COLOR="${WHITE}"
local LEVEL="${1}"
local MESSAGE="${2}"
case "${LEVEL}" in
info)
COLOR="${BLUE}"
;;
warn)
COLOR="${YELLOW}"
;;
fatal)
COLOR="${RED}"
;;
*)
LEVEL="debug"
;;
esac
LEVEL="${LEVEL} "
echo "[$(date +%T)] ${COLOR}$(echo "${LEVEL:0:5}" | tr '[:lower:]' '[:upper:]')${RESET} ${MESSAGE}";
}
log () {
log_raw "debug" "${1}"
}
info () {
log_raw "info" "${1}";
}
warn () {
log_raw "warn" "${1}";
}
die () {
log_raw "fatal" "${1}";
exit 1;
}
die_unless_forced () {
if [ ! -z "$1" ]; then
log_raw "warn" "$2";
return;
fi
log_raw "fatal" "$2";
die "Use -f to forcibly upgrade.";
}

View File

@ -40,40 +40,15 @@ b64file() {
b64encode "$(cat "$@")"
}
VPN_CONFIG=$(cat <<STR
client
remote vpn.$DOMAIN 443
resolv-retry infinite
remote-cert-tls server
ca /etc/openvpn/ca.crt
auth-user-pass /var/volatile/vpn-auth
auth-retry none
script-security 2
up /etc/openvpn-misc/upscript.sh
up-restart
down /etc/openvpn-misc/downscript.sh
comp-lzo
dev resin-vpn
dev-type tun
proto tcp
nobind
persist-key
persist-tun
verb 3
user openvpn
group openvpn
STR
)
# buckets to create in the S3 service...
REGISTRY2_S3_BUCKET="registry-data"
cat <<STR
export OPENBALENA_PRODUCTION_MODE=false
export OPENBALENA_COOKIE_SESSION_SECRET=$(randstr 32)
export OPENBALENA_HOST_NAME=$DOMAIN
export OPENBALENA_JWT_SECRET=$(randstr 32)
export OPENBALENA_REGISTRY2_S3_BUCKET=${REGISTRY2_S3_BUCKET}
export OPENBALENA_RESINOS_REGISTRY_CODE=$(randstr 32)
export OPENBALENA_ROOT_CA=$(b64file "${ROOT_CA}")
export OPENBALENA_ROOT_CRT=$(b64file "${ROOT_CRT}")
@ -84,13 +59,17 @@ export OPENBALENA_TOKEN_AUTH_KEY=$(b64file "$JWT_KEY")
export OPENBALENA_TOKEN_AUTH_KID=$(b64file "$JWT_KID")
export OPENBALENA_VPN_CA=$(b64file "$VPN_CA")
export OPENBALENA_VPN_CA_CHAIN=$(b64file "$VPN_CA")
export OPENBALENA_VPN_CONFIG=$(b64encode "$VPN_CONFIG")
export OPENBALENA_VPN_SERVER_CRT=$(b64file "$VPN_CRT")
export OPENBALENA_VPN_SERVER_KEY=$(b64file "$VPN_KEY")
export OPENBALENA_VPN_SERVER_DH=$(b64file "$VPN_DH")
export OPENBALENA_VPN_SERVICE_API_KEY=$(randstr 32)
export OPENBALENA_API_VPN_SERVICE_API_KEY=$(randstr 32)
export OPENBALENA_REGISTRY_SECRET_KEY=$(randstr 32)
export OPENBALENA_S3_ACCESS_KEY=$(randstr 32)
export OPENBALENA_S3_BUCKETS="${REGISTRY2_S3_BUCKET}"
export OPENBALENA_S3_ENDPOINT="https://s3.${DOMAIN}"
export OPENBALENA_S3_REGION=us-east-1
export OPENBALENA_S3_SECRET_KEY=$(randstr 32)
export OPENBALENA_SSH_AUTHORIZED_KEYS=
export OPENBALENA_SUPERUSER_EMAIL=$SUPERUSER_EMAIL
export OPENBALENA_SUPERUSER_PASSWORD=$(printf "%q" "${SUPERUSER_PASSWORD}")

View File

@ -0,0 +1,29 @@
#!/bin/sh
migrate_data_to_s3 () {
BUCKET="${1:-registry-data}"
if [ -z "${BUCKET}" ]; then return 1; fi
if [ -n "${DOCKER_HOST}" ]; then
log "Using docker host: ${DOCKER_HOST}"
export DOCKER_HOST="${DOCKER_HOST}"
fi
REGISTRY_CONTAINER="$(docker ps | grep registry_ | awk '{print $1}')"
S3_CONTAINER="$(docker ps | grep s3_ | awk '{print $1}')"
if [ -z "${REGISTRY_CONTAINER}" ] || [ -z "${S3_CONTAINER}" ]; then return 2; fi
REGISTRY_VOLUME="$(docker inspect "${REGISTRY_CONTAINER}" | jq -r '.[].Mounts | map(select(.Destination=="/data")) | .[0].Source')"
S3_VOLUME=$(docker inspect "${S3_CONTAINER}" | jq -r '.[].Mounts | map(select(.Destination=="/export")) | .[0].Source')
if [ -z "${REGISTRY_VOLUME}" ] || [ -z "${S3_VOLUME}" ]; then return 3; fi
# run the S3 container image, and copy the data partition into S3...
docker run -it --rm \
-v "${REGISTRY_VOLUME}:/data" \
-v "${S3_VOLUME}:/s3" \
--name "migrate-registry" alpine \
sh -c "mkdir -p /s3/${BUCKET}/data && cp -r /data/docker /s3/${BUCKET}/data/"
}

View File

@ -16,6 +16,12 @@ RESET=`tput sgr0`
OPENSSL_VERSION=$(openssl version -v)
if [[ "${OPENSSL_VERSION}" =~ ^LibreSSL.*$ ]]; then
echo -e "${RED}ERROR: You may not have a compatible OpenSSL version (${OPENSSL_VERSION}). Please install OpenSSL version 1.0.2q or above.${RESET}"
if [ $(uname) == 'Darwin' ]; then
echo 'OpenSSL is required to build openBalena on macOS. To install with brew, run'
echo ''
echo ' brew install openssl'
echo ''
fi
exit 1
fi
@ -125,7 +131,25 @@ fi
echo_bold "==> Success!"
echo ' - Start the instance with: ./scripts/compose up -d'
echo ' - Stop the instance with: ./scripts/compose stop'
echo ' - To create a single, flat, docker-compose.yml file, run:'
echo ''
echo ' ./scripts/compose config > docker-compose.yml'
echo ''
if [ -z "${ACME_CERT_ENABLED}" ]; then
echo " - Use the following certificate with Balena CLI: ${CERTS_DIR}/root/ca.crt"
case $(uname) in
Darwin)
echo ''
printf ' On macOS:\n\n'
printf ' sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "%s/root/ca.crt"\n' "${CERTS_DIR}"
echo ''
;;
*)
;;
esac
echo -e " ${YELLOW}IMPORTANT:${RESET} You will need to restart your Docker daemon after trusting this certificate to allow your workstation to push images to the registry."
echo ''
fi

78
scripts/upgrade-1.x-to-2.0 Executable file
View File

@ -0,0 +1,78 @@
#!/bin/sh
source "${BASH_SOURCE%/*}/logger.sh"
source "${BASH_SOURCE%/*}/migrate-registry-storage"
# This script takes a v1.x.x install and updates the compose stack to use S3 as your
# registry storage.
source "${BASH_SOURCE%/*}/_realpath"
DIR="$(dirname $(realpath "$0"))"
BASE_DIR="$(dirname "${DIR}")"
CONFIG_DIR="${BASE_DIR}/config"
CONFIG_FILE="${CONFIG_DIR}/activate"
# Step 1. Make sure a config exists...
[ -f "${CONFIG_FILE}" ] || die "Unable to find existing config!";
info "Preparing to upgrade..."
source "${CONFIG_FILE}"
while getopts "f" opt; do
case "${opt}" in
f)
warn "Forcing upgrade! I hope you know what you're doing..."
FORCE_UPGRADE=1
;;
*)
echo "Invalid argument: ${OPTARG}"
exit 1
;;
esac
done
shift $((OPTIND-1))
# Step 2. Check if the S3 configuration already exists...
upgrade_required () {
[ -z "${OPENBALENA_REGISTRY2_S3_BUCKET}" ] || return 1;
[ -z "${OPENBALENA_S3_ACCESS_KEY}" ] || return 1;
[ -z "${OPENBALENA_S3_ENDPOINT}" ] || return 1;
[ -z "${OPENBALENA_S3_REGION}" ] || return 1;
[ -z "${OPENBALENA_S3_SECRET_KEY}" ] || return 1;
}
upgrade_required || die_unless_forced "${FORCE_UPGRADE}" "Configuration may already be using S3 for Registry storage!"
# Step 3. Create missing S3 configuration...
randstr() {
LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | fold -w "${1:-32}" | head -n 1
}
upsert_config () {
var="${1}"
value="${2}"
if [ -z "${!var}" ]; then
echo "export ${1}=${2}" >> "${CONFIG_FILE}"
else
sed -i '' "s~export ${1}=.*~export ${1}=${2}~" "${CONFIG_FILE}"
fi
}
upsert_config "OPENBALENA_REGISTRY2_S3_BUCKET" "registry-data" || warn "Failed to update config value OPENBALENA_REGISTRY2_S3_BUCKET"
upsert_config "OPENBALENA_S3_ACCESS_KEY" "$(randstr 32)" || warn "Failed to update config value OPENBALENA_S3_ACCESS_KEY"
upsert_config "OPENBALENA_S3_ENDPOINT" "https://s3.${OPENBALENA_HOST_NAME}" || warn "Failed to update config value OPENBALENA_S3_ENDPOINT"
upsert_config "OPENBALENA_S3_REGION" "us-east-1" || warn "Failed to update config value OPENBALENA_S3_REGION"
upsert_config "OPENBALENA_S3_SECRET_KEY" "$(randstr 32)" || warn "Failed to update config value OPENBALENA_S3_SECRET_KEY"
# Step 4. Migrate Registry data to S3...
info "Copying data from the Registry volume to the S3 volume..."
migrate_data_to_s3 "registry-data"
case $? in
1) die "Invalid bucket name";;
2) die "Unable to find the running Registry or S3 containers";;
3) die "Unable to determine the data volumes for the Registry or S3 containers";;
*) info "Registry data copied"
;;
esac
info "Upgrade complete"

View File

@ -6,9 +6,11 @@ VOLUME [ "/usr/src/app/certs" ]
RUN apk add --update bash curl git openssl ncurses socat
# from https://github.com/Neilpang/acme.sh/releases/tag/3.0.1
RUN git clone https://github.com/Neilpang/acme.sh.git && \
cd acme.sh && \
git checkout 08357e3cb0d80c84bdaf3e42ce0e439665387f57 . && \
git fetch && git fetch --tags && \
git checkout 3.0.1 . && \
./acme.sh --install \
--cert-home /usr/src/app/certs

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# the acme.sh client script, installed via Git in the Dockerfile...
ACME_BIN="$(realpath ~/.acme.sh/acme.sh)"
@ -45,14 +45,20 @@ retryWithDelay() {
DELAY=${3:-5}
local ATTEMPT=0
while [ $RETRIES -gt $ATTEMPT ]; do
let "ATTEMPT++"
while [ "$RETRIES" -gt "$ATTEMPT" ]; do
(( ATTEMPT++ ))
logInfo "($ATTEMPT/$RETRIES) Connecting..."
if $1; then
logInfo "($ATTEMPT/$RETRIES) Success!"
return $?
fi
echo "($ATTEMPT/$RETRIES) Retrying in ${DELAY} seconds..."
sleep $DELAY
if [ "$RETRIES" -gt "$ATTEMPT" ]; then
logInfo "($ATTEMPT/$RETRIES) Failed. Retrying in ${DELAY} seconds..."
sleep "$DELAY"
else
logInfo "($ATTEMPT/$RETRIES) Failed!"
fi
done
return 1
@ -62,7 +68,7 @@ waitForOnline() {
ADDRESS="${1,,}"
logInfo "Waiting for ${ADDRESS} to be available via HTTP..."
retryWithDelay "curl --output /dev/null --silent --head --fail http://${ADDRESS}" 6 5
retryWithDelay "curl --output /dev/null --silent --head --fail --max-time 5 http://${ADDRESS}"
}
isUsingStagingCert() {
@ -153,7 +159,7 @@ acquireCertificate() {
fi
logInfo "Issuing certificates..."
"$ACME_BIN" --issue "${ACME_OPTS[@]}" "${ACME_DOMAIN_ARGS[@]}"
"$ACME_BIN" --server letsencrypt --issue "${ACME_OPTS[@]}" "${ACME_DOMAIN_ARGS[@]}"
logInfo "Installing certificates..." && \
"$ACME_BIN" --install-cert "${ACME_DOMAIN_ARGS[@]}" \
@ -167,7 +173,10 @@ acquireCertificate() {
pre-flight || logErrorAndStop "Unable to continue due to misconfiguration. See errors above."
waitForOnline "${ACME_DOMAINS[0]}" || logErrorAndStop "Unable to access ${ACME_DOMAINS[0]} on port 80. This is needed for certificate validation."
while ! waitForOnline "${ACME_DOMAINS[0]}"; do
logInfo "Unable to access ${ACME_DOMAINS[0]} on port 80. This is needed for certificate validation. Retrying in 30 seconds..."
sleep 30
done
if ! lastAcquiredCertFor "production"; then
acquireCertificate "staging" || logErrorAndStop "Unable to acquire a staging certificate."

View File

@ -0,0 +1,119 @@
-----BEGIN CERTIFICATE-----
MIIDrzCCApegAwIBAgIRALqMZiRNaRF4EGZS9urlj+0wDQYJKoZIhvcNAQELBQAw
cTELMAkGA1UEBhMCVVMxMzAxBgNVBAoTKihTVEFHSU5HKSBJbnRlcm5ldCBTZWN1
cml0eSBSZXNlYXJjaCBHcm91cDEtMCsGA1UEAxMkKFNUQUdJTkcpIERvY3RvcmVk
IER1cmlhbiBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDEzMDE0MDEx
NVowcTELMAkGA1UEBhMCVVMxMzAxBgNVBAoTKihTVEFHSU5HKSBJbnRlcm5ldCBT
ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEtMCsGA1UEAxMkKFNUQUdJTkcpIERvY3Rv
cmVkIER1cmlhbiBSb290IENBIFgzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAqUZjoRbjgXecPWxXkGCUEXcNrupL7dkbwc0jUTLFEDvcyfD1gYekY5uL
D19uzYTl0pKZzzDXHJPnJY5EEp27nACFOm8XzX9sORAangP0OnGUkXJZDHM+8cX2
EHJbfj0lg1JirRF3w2u1/KRuFEvIlWg3FdXdsSFHBF5z1Ij7MLn7Ska5c/5fKsDW
EYzOMB6EBW1T9RDkVk/Q965EwDT4bR6BOXakasgfKrH9m1f6l9MmA0VnXdw9rZ+s
TvMHG1y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ssl.default-dh-param 1024
defaults
timeout connect 5000
timeout client 50000
timeout server 50000
timeout connect 5s
timeout client 50s
timeout server 50s
frontend http-in
mode http
@ -34,6 +34,10 @@ frontend ssl-in
tcp-request content accept if { req.ssl_hello_type 1 }
acl is_ssl req.ssl_ver 2:3.4
acl host_tunnel req_ssl_sni -i "tunnel.${HAPROXY_HOSTNAME}"
use_backend redirect-to-tunnel-in if host_tunnel
use_backend redirect-to-https-in if is_ssl
use_backend vpn-devices if !is_ssl
@ -42,6 +46,11 @@ backend redirect-to-https-in
balance roundrobin
server localhost 127.0.0.1:444 send-proxy-v2
backend redirect-to-tunnel-in
mode tcp
balance roundrobin
server localhost 127.0.0.1:3129
frontend https-in
mode http
option forwardfor
@ -64,34 +73,35 @@ backend backend_api
mode http
option forwardfor
balance roundrobin
server resin_api_1 api:80 check port 80
server balena_api_1 api:80 check port 80
backend backend_registry
mode http
option forwardfor
balance roundrobin
server resin_registry_1 registry:80 check port 80
server balena_registry_1 registry:80 check port 80
backend backend_vpn
mode http
option forwardfor
balance roundrobin
server resin_vpn_1 vpn:80 check port 80
server balena_vpn_1 vpn:80 check port 80
backend backend_s3
mode http
option forwardfor
balance roundrobin
server balena_s3_1 s3:80 check port 80
backend cert-provider
mode http
option forwardfor
balance roundrobin
server resin_cert-provider_1 cert-provider:80 no-check
server balena_cert-provider_1 cert-provider:80 no-check
backend vpn-devices
mode tcp
server resin_vpn_1 vpn:443 send-proxy-v2 check-send-proxy port 443
server balena_vpn_1 vpn:443 send-proxy-v2 check-send-proxy port 443
frontend db
mode tcp
@ -101,7 +111,7 @@ frontend db
backend backend_db
mode tcp
server resin_db_1 db:5432 check port 5432
server balena_db_1 db:5432 check port 5432
frontend redis
mode tcp
@ -111,9 +121,14 @@ frontend redis
backend backend_redis
mode tcp
server resin_redis_1 redis:6379 check port 6379
server balena_redis_1 redis:6379 check port 6379
listen vpn-tunnel
mode tcp
bind *:3128
server balena_vpn vpn:3128 check port 3128
listen vpn-tunnel-tls
mode tcp
bind *:3129 ssl crt /etc/ssl/private/open-balena.pem
server balena_vpn vpn:3128 check port 3128