Google Compute Engine

来自Gea-Suan Lin's Wiki
跳转到导航 跳转到搜索

Google Compute EngineGCP的VM类服务。

范例

关闭GCE的自动建立账号以及SSH key机制:

echo -e '[Daemons]\naccounts_daemon = false' | sudo tee /etc/default/instance_configs.cfg; sudo reboot

所有在staff群组的人都可以无限制sudo:

echo "%staff ALL = (ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/group-staff

安装gcloud指令:

echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list; curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/cloud.google.gpg > /dev/null; sudo apt update; sudo apt install -y google-cloud-cli; sudo apt clean

安装gce2env,这只程式可以把Google Secret Manager里面的dotenv资料转到环境变数里,再执行我们的程式:

sudo curl -L -o /usr/sbin/gsm2env https://gist.github.com/gslin/ec0c2df038732246feb84f07cbb20a66/raw/6e4f5afdfe236e507815d61d4e23f601597f5560/gsm2env; sudo chmod 755 /usr/sbin/gsm2env

外部链接