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

3116 - Adds a log configuration to docker containers to roll #1850

Merged
merged 3 commits into from
Apr 2, 2024
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
8 changes: 5 additions & 3 deletions .github/workflows/runner-scripts/create-vm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@ az vm create \
--resource-group Testnet \
--name MakeImageVM \
--image Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:20.04.202206220 \
--security-type 'Standard' \
--admin-username obscurouser --admin-password 'PWD'

ssh obscurouser@IPADDRESS

sudo apt-get update \
&& sudo apt-get install -y gcc \
&& sudo snap refresh && sudo snap install --channel=1.20 go --classic \
&& sudo snap refresh && sudo snap install go --channel=1.21/stable --classic \
&& curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh

exit

az vm deallocate --resource-group Testnet --name MakeImageVM
az vm generalize --resource-group Testnet --name MakeImageVM
az image delete --resource-group Testnet --name ObscuroConfUbuntu
az image create --resource-group Testnet --name ObscuroConfUbuntu --source MakeImageVM --hyper-v-generation V2

az vm delete --resource-group Testnet --name MakeImageVM --yes
az disk delete --resource-group Testnet --name MakeImageVM_OSDisk --yes
az network nic delete --resource-group Testnet --name MakeImageVM_NIC
az disk delete --resource-group Testnet --name MakeImageVM_OsDisk-<get uuid from azure> --yes --no-wait
az network nic delete --resource-group Testnet --name MakeImageVMVMNIC --no-wait
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing but did you mean to change that name? MakeImageVM_NIC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it wasn't deleting and after investigating the resources on azure, saw the suffix was without the underscore. :)


7 changes: 7 additions & 0 deletions go/common/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ func StartNewContainer(containerName, image string, cmds []string, ports []int,
exposedPorts[nat.Port(fmt.Sprintf("%d/tcp", port))] = struct{}{}
}

// set log rotations
logOptions := map[string]string{
"max-size": "10m",
"max-file": "3",
}

// create the container
resp, err := cli.ContainerCreate(ctx, &container.Config{
Image: image,
Expand All @@ -101,6 +107,7 @@ func StartNewContainer(containerName, image string, cmds []string, ports []int,
PortBindings: portBindings,
Mounts: mountVolumes,
Resources: container.Resources{Devices: deviceMapping},
LogConfig: container.LogConfig{Type: "json-file", Config: logOptions},
},
&network.NetworkingConfig{
EndpointsConfig: map[string]*network.EndpointSettings{
Expand Down
Loading