Files
linuxkit/alpine/packages/mobyconfig/etc/init.d/database-gcp
Justin Cormack f3a8e77c99 Split config database setup by platform
Add basic database setup for AWS, GCP although these are not yet used
by the setup code but will be useful later.

Currently each is gated by `mobyplatform` but this can be removed once we
construct Moby per platform, and once these are containerised so they
are not run from `openrc`.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-01-23 18:08:26 +00:00

28 lines
759 B
Plaintext
Executable File

#!/sbin/openrc-run
description="Set up database (GCP)."
depend() {
before docker hostsettings windowsnet
}
start() {
[ "$(mobyplatform)" = "gcp" ] || exit 0
ebegin "Setting up database (GCP)"
mkdir -p /Database
mount -t tmpfs tmpfs /Database
PROJECT=http://metadata.google.internal/computeMetadata/v1/project
INSTANCE=http://metadata.google.internal/computeMetadata/v1/instance
curl "${INSTANCE}/hostname" 2> /dev/null | mobyconfig set etc/hostname
# as this is a bit late let us set it anyway
mobyconfig get etc/hostname > /etc/hostname
hostname -F /etc/hostname
curl -f -I "${PROJECT}/attributes/sshKeys" 2> /dev/null > /dev/null && \
curl "${PROJECT}/attributes/sshKeys" 2> /dev/null | mobyconfig set etc/ssh/authorized_keys
eend 0
}