Skip to content

Commit b2e8966

Browse files
committed
Write files in cloud-init
1 parent 1537df2 commit b2e8966

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

rootfs/etc/docker/daemon.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"data-root": "/mnt/disks/data/docker"
3+
}
4+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@
9797
#
9898
# storage.backlog.mem_limit 5M
9999

100+
[INPUT]
101+
Name systemd
102+
Tag cos_docker
103+
Systemd_Filter _SYSTEMD_UNIT=cloud-compose.service
104+
DB /var/log/google-fluentbit/sync-conf.log.db
105+
Read_From_Tail False
106+
100107
# Collects docker.service logs.
101108
[INPUT]
102109
Name systemd
@@ -217,6 +224,17 @@
217224
Operation lift
218225
Nested_under message
219226

227+
[FILTER]
228+
Name grep
229+
Match *
230+
Exclude MESSAGE .* container exec_(create|start): /bin/sh -c mysqladmin ping --socket
231+
Exclude MESSAGE .* container exec_(create|start): /bin/sh -c curl -s http://localhost/status
232+
Exclude MESSAGE .* container exec_(create|start): /bin/sh -c wget --quiet --tries=1 --spider \$CADVISOR_HEALTHCHECK_URL
233+
Exclude MESSAGE .* container exec_(create|start): \/bin\/sh -c \/bin\/bash -c 'curl -sf http:\/\/localhost:\$PORT\/healthcheck'
234+
Exclude MESSAGE GET /status HTTP/.* 200
235+
Exclude MESSAGE ^.* container health_status: healthy
236+
Exclude MESSAGE ^.* container exec_die
237+
220238
[OUTPUT]
221239
Name stackdriver
222240
Match *

rootfs/home/cloud-compose/host-conf.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22

33
set -eou pipefail
44

5-
awk -v prepend="$(cat /home/cloud-compose/fluent-bit.conf)" '/# Collects docker.service logs/ {print prepend} 1' /etc/fluent-bit/fluent-bit.conf > /etc/fluent-bit/fluent-bit.conf.new
6-
mv /etc/fluent-bit/fluent-bit.conf /etc/fluent-bit/fluent-bit.bak
7-
mv /etc/fluent-bit/fluent-bit.conf.new /etc/fluent-bit/fluent-bit.conf
5+
# restart services we've overwritten files for
86
systemctl restart fluent-bit
9-
10-
mkdir -p /mnt/disks/data/docker
11-
echo '{"data-root": "/mnt/disks/data/docker"}' | jq . > /etc/docker/daemon.json
127
systemctl restart --no-block docker
138

9+
# since COS is read only FS, install docker compose/buildx in home directory
1410
if [ ! -f "/home/cloud-compose/.docker/cli-plugins/docker-compose" ]; then
1511
curl -sSL \
1612
https://github.com/docker/compose/releases/download/v2.40.3/docker-compose-linux-x86_64 \

0 commit comments

Comments
 (0)