test cloudinit

This commit is contained in:
Souhaila Noor 2021-11-07 08:39:43 -06:00
parent 103312be8f
commit 78713c6a8c
2 changed files with 24 additions and 8 deletions

24
.gitlab/cloud-init.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash -ex
# generate log
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
# Install packages
yum update -y
yum install golang -y # latest verion in ec2 is 1.15.14
yum install postgresql -y
# Configure host system
# N=200000
# sysctl -w vm.max_map_count=N
# echo N > /proc/sys/vm/max_map_count
ulimit -n -S 200000
# # install go 1.16.9
# curl -O https://dl.google.com/go/go1.16.9.linux-amd64.tar.gz
# tar xvf go1.16.9.linux-amd64.tar.gz
# chown -R root:root ./go
# mv go /usr/local
# echo 'export GOPATH=$HOME/work' >> ~/.profile
# echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> ~/.profile
# chown ec2-user ~/.profile
# source ~/.profile

View file

@ -1,8 +0,0 @@
#cloud-config
repo_update: true
repo_upgrade: all
runcmd:
- yum update
- yum install postgresql
- yum install golang