Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 3617277

Browse files
committed
chore: migrate Docker module
1 parent f30e27f commit 3617277

File tree

17 files changed

+694
-235
lines changed

17 files changed

+694
-235
lines changed

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ require (
1515
github.com/blang/semver/v4 v4.0.0
1616
github.com/cloudflare/cloudflare-go v0.54.0
1717
github.com/fatih/structs v1.1.0
18-
github.com/google/go-cmp v0.5.8
1918
github.com/gookit/event v1.0.6
2019
github.com/hairyhenderson/gomplate/v3 v3.11.2
2120
github.com/knadh/koanf v1.4.4
2221
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
22+
github.com/saitho/diff-docker-compose v1.1.3
2323
github.com/saitho/golang-extended-fs/v2 v2.0.2
2424
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
2525
github.com/sirupsen/logrus v1.8.1
@@ -77,6 +77,7 @@ require (
7777
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
7878
github.com/golang/protobuf v1.5.2 // indirect
7979
github.com/golang/snappy v0.0.4 // indirect
80+
github.com/google/go-cmp v0.5.8 // indirect
8081
github.com/google/go-querystring v1.1.0 // indirect
8182
github.com/google/uuid v1.3.0 // indirect
8283
github.com/google/wire v0.5.0 // indirect
@@ -152,7 +153,7 @@ require (
152153
gocloud.dev v0.25.1-0.20220408200107-09b10f7359f7 // indirect
153154
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
154155
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401 // indirect
155-
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
156+
golang.org/x/sys v0.1.0 // indirect
156157
golang.org/x/text v0.3.7 // indirect
157158
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
158159
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,8 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo
861861
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
862862
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
863863
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 h1:GHRpF1pTW19a8tTFrMLUcfWwyC0pnifVo2ClaLq+hP8=
864+
github.com/saitho/diff-docker-compose v1.1.3 h1:ZKx+F7yMmoAKzI76BFpr7kY+Thd7quk7d/ETug0qNY8=
865+
github.com/saitho/diff-docker-compose v1.1.3/go.mod h1:O3V+mwGtlXQ7UERA4+yunV319kyNLwIKeNSw8PODyEU=
864866
github.com/saitho/golang-extended-fs/v2 v2.0.2 h1:QWGOIP4wFTaSODIU54qDCuH1IQXWcjL6irLezJiHqOA=
865867
github.com/saitho/golang-extended-fs/v2 v2.0.2/go.mod h1:aTmESz9Z7Rwbx80zxGWTeuBmW6MLdzYrBZMJOfXsJVw=
866868
github.com/saitho/jsonschema-validator v1.2.0 h1:bWSvTla54F5cziZsxLBR0mlN3gTw9hjrkFuZU55kO+E=
@@ -1254,8 +1256,8 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc
12541256
golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12551257
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12561258
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1257-
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
1258-
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1259+
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
1260+
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12591261
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
12601262
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
12611263
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=

modules/container/docker/README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,38 @@
66

77
This is a module to manage Containers via Docker.
88

9+
Credentials for private registries are encrypted and securely storaged via [Pass](https://www.passwordstore.org/).
10+
11+
**Important note**: The credentials are grouped per registry and saved per username, so only one password is assigned to the pair (registry, username).
12+
For example, this means that you can only store one passwort for your GitLab.com account named "ciuser".
13+
It is recommended to use one username per project. When using GitLab's project-based Access Tokens, the username can be freely set.
14+
915
## Resources
1016

11-
This module will create the following Terraform resources (via [`kreuzwerker/docker`](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs)):
17+
Setting up the server with this plugin will install the following:
1218

13-
* `docker_network`
14-
* `docker_image`
15-
* `docker_container`
16-
* `docker_volume`
19+
* Docker CE
20+
* Docker Compose Plugin
21+
* containerd.io
22+
* Pass (for registry credential storage)
23+
* golang-docker-credential-helpers
1724

1825
## Configuration
1926

2027
None.
28+
29+
## Troubleshooting
30+
31+
### I can not connect to my private Docker Registry
32+
33+
Make sure to configure the private Docker registry credentials in your project definition file.
34+
35+
```yaml
36+
container:
37+
registries:
38+
- username: gitlab
39+
password: glpat-12345abcdeFGHIJ12345
40+
url: https://registry.gitlab.com
41+
```
42+
43+
**GitLab Note:** Access Tokens require the `read_registry` scope and at least the Reporter role.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package container_docker_definitions
22

33
type Hook struct {
4-
Src string
5-
Prefix string
4+
Src string
5+
Prefix string
6+
Service string
67
}

modules/container/docker/definitions/volume.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ type DockerPaths struct {
99
BaseDir string
1010
}
1111

12+
func GetDockerPaths() DockerPaths {
13+
return DockerPaths{
14+
BaseDir: system.Context.Project.GetRuntimeDataDirectoryPath() + "/container",
15+
}
16+
}
17+
1218
func (p DockerPaths) GetHooksDir() string {
1319
return p.BaseDir + "/hooks"
1420
}

0 commit comments

Comments
 (0)