mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-02 00:58:29 +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>
30 lines
839 B
Plaintext
Executable File
30 lines
839 B
Plaintext
Executable File
#!/sbin/openrc-run
|
|
|
|
description="Set up database (AWS)."
|
|
|
|
depend() {
|
|
before docker hostsettings windowsnet
|
|
}
|
|
|
|
start() {
|
|
[ "$(mobyplatform)" = "aws" ] || exit 0
|
|
|
|
ebegin "Setting up database (AWS)"
|
|
|
|
mkdir -p /Database
|
|
mount -t tmpfs tmpfs /Database
|
|
|
|
ENDPOINT="http://169.254.169.254/latest/meta-data"
|
|
curl "${ENDPOINT}/local-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
|
|
# TODO should collect all keys
|
|
curl -f -I "${ENDPOINT}/public-keys/0/openssh-key" 2> /dev/null > /dev/null && \
|
|
curl "${ENDPOINT}/public-keys/0/openssh-key" 2> /dev/null | mobyconfig set etc/ssh/authorized_keys
|
|
USERDATA="http://169.254.169.254/latest/user-data/"
|
|
curl "${USERDATA}" 2> /dev/null | mobyconfig set userdata
|
|
|
|
eend 0
|
|
}
|