mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-02 13:49:54 +00:00
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>
28 lines
759 B
Plaintext
Executable File
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
|
|
}
|