@@ -32,13 +32,13 @@ Linux operating system with:
3232
3333First clone this repository:
3434
35- ``` shell
35+ ``` shell
3636git clone https://github.com/EdgeTX/cloudbuild.git
3737```
3838
3939Then you will need to configure some things:
4040
41- ``` shell
41+ ``` shell
4242# Create config from template
4343cp api.env.example api.env
4444```
@@ -47,7 +47,7 @@ For a quick test, all you need to edit is external URL (as it will be seen by we
4747and the directory in which the firmwares are stored (which should be shared among all
4848containers as a volume).
4949
50- ```
50+ ``` env
5151EBUILD_STORAGE_PATH=/home/rootless/src/static/firmwares
5252EBUILD_DOWNLOAD_URL=http://localhost:3000/firmwares
5353```
@@ -56,7 +56,7 @@ EBUILD_DOWNLOAD_URL=http://localhost:3000/firmwares
5656
5757The runtime container image can be built with:
5858
59- ``` shell
59+ ``` shell
6060docker compose build api
6161```
6262
@@ -66,19 +66,19 @@ docker compose build api
6666
6767Start the database first:
6868
69- ``` shell
69+ ``` shell
7070docker compose up -d db
7171```
7272
7373Then start the API:
7474
75- ``` shell
75+ ``` shell
7676docker compose up -d api
7777```
7878
7979And setup the database schema with:
8080
81- ``` shell
81+ ``` shell
8282docker exec -it cloudbuild-api-1 ./ebuild db migrate
8383```
8484
@@ -88,7 +88,7 @@ Once the database is setup, proceed to the next step to start the workers as wel
8888
8989Then the rest of the stack can be run all together:
9090
91- ``` shell
91+ ``` shell
9292docker compose up -d --scale worker=2
9393```
9494
@@ -100,7 +100,7 @@ You can increase the number of workers if you want to build more firmwares in pa
100100To offload serving the firmware files to a S3 compatible storage, a few configuration
101101parameters need to be set additionally in the environment file (` api.env ` ):
102102
103- ```
103+ ``` env
104104# Common settings for all provider
105105EBUILD_STORAGE_TYPE: S3
106106EBUILD_S3_ACCESS_KEY: myAccessKey
@@ -118,15 +118,49 @@ EBUILD_DOWNLOAD_URL: https://bucket.s3.super-provider.com
118118
119119To be able to use the administrative UI, a token must be generated for every user:
120120
121- ``` shell
121+ ``` shell
122122docker exec -it cloudbuild-api-1 ./ebuild auth create [some name]
123123AccessKey: [some access key]
124124SecretKey: [very secret key]
125125```
126126
127127The token can be later removed:
128128
129- ``` shell
129+ ``` shell
130130docker exec -it cloudbuild-api-1 ./ebuild auth remove [Access Key]
131131token [Access Key] removed
132132```
133+
134+ ## Using a local Git mirror
135+
136+ To speed up builds, it is possible to use a local mirror by changing
137+ the repository URL:
138+ ``` env
139+ EBUILD_SRC_REPO=http://local-mirror:8080/EdgeTX/edgetx
140+ ```
141+
142+ [ cloudbuild-mirror] ( https://github.com/EdgeTX/cloudbuild-mirror ) can be
143+ used as a local mirror. It also supports automatic refreshing of the
144+ targets (see next section).
145+
146+ With this configuration only, the submodules will still be fetched from ` http://github.com ` ,
147+ as the full URL is encoded into the respective ` .gitmodules ` files. Fortunately, Git offers
148+ a simple to override this with [ insteadOf] ( https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlbaseinsteadOf ) .
149+
150+ Just mount this file into the workers at ` /etc/gitconfig ` :
151+ ```
152+ [url "http://local-mirror:8080"]
153+ insteadOf = https://github.com
154+ ```
155+
156+ ## Refresh targets automatically from URL
157+
158+ It is also possible to fetch ` targets.json ` from a URL instead of a local
159+ file. In that case, the targets are refreshed automatically (defaults to 5 minutes interval).
160+
161+ ``` env
162+ # Use cloudbuild mirrored repository as the source for targets.json
163+ EBUILD_TARGETS=http://local-mirror:8080/gitweb.cgi?p=EdgeTX/cloudbuild.git;a=blob_plain;f=targets.json;hb=HEAD
164+ # This is the default refresh interval in seconds
165+ EBUILD_TARGETS_REFRESH_INTERVAL=300
166+ ```
0 commit comments