Commit 7bdf82f8 authored by Dmytro Bogatov's avatar Dmytro Bogatov 💕

Deploy jaime.

parent 926caebe
Pipeline #3650 passed with stage
in 1 minute and 8 seconds
......@@ -185,20 +185,9 @@ else
mkdir -p dashboard
cp ./sources/dashboard/*.yaml ./dashboard
# mkdir -p dashboard/dashboard-auth
# cp sources/dashboard-auth/*.yaml dashboard/dashboard-auth/
# COOKIE_SECRET=$(dd if=/dev/urandom bs=16 count=1 2>/dev/null | base64)
# sed -i -e "s#__OAUTH2_PROXY_COOKIE_SECRET__#$COOKIE_SECRET#g" dashboard/dashboard-auth/oauth2-proxy.yaml
# sed -i -e "s#__OAUTH2_PROXY_CLIENT_SECRET__#$OAUTH2_PROXY_CLIENT_SECRET#g" dashboard/dashboard-auth/oauth2-proxy.yaml
DASHBOARD_TOKEN=$(kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') | grep token: )
DASHBOARD_TOKEN="${DASHBOARD_TOKEN:7:${#DASHBOARD_TOKEN}}"
# sed -i -e "s#__DASHBOARD_TOKEN__#$DASHBOARD_TOKEN#g" dashboard/dashboard-auth/ingreses.yaml
# sed -i -e "s#Bearer #Bearer #g" dashboard/dashboard-auth/ingreses.yaml
sed -i -e "s#__DASHBOARD_TOKEN__#$DASHBOARD_TOKEN#g" dashboard/ingress.yaml
sed -i -e "s#Bearer #Bearer #g" dashboard/ingress.yaml
......
......@@ -24,41 +24,41 @@ then
exit 1
fi
echo "Producing SWAP config"
# echo "Producing SWAP config"
cat >/etc/systemd/system/var-vm-swapfile1.swap <<SWAP
[Unit]
Description=Turn on swapcd clu
# cat >/etc/systemd/system/var-vm-swapfile1.swap <<SWAP
# [Unit]
# Description=Turn on swapcd clu
[Swap]
What=/var/vm/swapfile1
# [Swap]
# What=/var/vm/swapfile1
[Install]
WantedBy=multi-user.target
SWAP
# [Install]
# WantedBy=multi-user.target
# SWAP
echo "Adding SWAP"
# echo "Adding SWAP"
if [ -f $SWAPFILE ];
then
echo "File $SWAPFILE already exists"
else
mkdir -p /var/vm
fallocate -l 2048m /var/vm/swapfile1
chmod 600 /var/vm/swapfile1
mkswap /var/vm/swapfile1
systemctl enable --now var-vm-swapfile1.swap
fi
# if [ -f $SWAPFILE ];
# then
# echo "File $SWAPFILE already exists"
# else
# mkdir -p /var/vm
# fallocate -l 2048m /var/vm/swapfile1
# chmod 600 /var/vm/swapfile1
# mkswap /var/vm/swapfile1
echo "Enabling SWAP support for kubelet"
if grep -q "fail-swap-on=false" "/etc/systemd/system/kubelet.service";
then
echo "Already enabled"
else
sed -i '/kubelet-wrapper/a \ --fail-swap-on=false \\\' /etc/systemd/system/kubelet.service
fi
# systemctl enable --now var-vm-swapfile1.swap
# fi
# echo "Enabling SWAP support for kubelet"
# if grep -q "fail-swap-on=false" "/etc/systemd/system/kubelet.service";
# then
# echo "Already enabled"
# else
# sed -i '/kubelet-wrapper/a \ --fail-swap-on=false \\\' /etc/systemd/system/kubelet.service # TODO
# fi
echo "Installing status site daemon"
......
......@@ -20,29 +20,28 @@ my-sleep () {
# Checks
usage () {
printf "usage: $0 <certDirPath> <statusSiteConfig> <name> <status-site-api-key>\n"
printf "usage: $0 <certDirPath> <name>\n"
printf "where\n"
printf "\t certDirPath - absolute path to directory with SSL cert (certificate.crt) and key (certificate.key) file\n"
printf "\t statusSiteConfig - absolute path to appsettings.production.yml file\n"
printf "\t certDirPath - absolute path to directory with SSL cert (certificate.crt), key (certificate.key), auth file and appsettings for status-site\n"
printf "\t name - cluster name (e.g. sandor in sandor.dbogatov.org)\n"
# printf "\t gitlab-runner-token - runner's (not registration) token; if runner is not setup, use register-k8s-runner script;\n"
printf "\t status-site-api-key - Status site API key for reporting CPU load\n"
exit 1;
}
if ! [ $# -eq 4 ]
if ! [ $# -eq 2 ]
then
usage
fi
# DOCKERPASS=...
source .secret.sh
CERTDIRPATH=$1
STATUSSITECONFIG=$2
NAME=$3
GITLAB_TOKEN=$3
APIKEY=$4
NAME=$2
STATUSSITECONFIG=$CERTDIRPATH/appsettings.production.yml
APIKEY=$(cat $STATUSSITECONFIG | grep "ApiKey:" | cut -d'"' -f 2)
# Initiate cluster
......@@ -54,15 +53,11 @@ ssh-add ~/.ssh/id_rsa
cd $CWD/terraform/clusters/
terraform destroy -force || true # might be that there is nothing to destroy
echo "Waiting 30 secs..."
my-sleep 30
terraform init
terraform apply -auto-approve
echo "Waiting 60 secs..."
my-sleep 60
# Add SWAP to master
......@@ -87,8 +82,6 @@ done
# Let it warm up
echo "Waiting 30 secs..."
my-sleep 30
cd "$CWD"
......@@ -137,17 +130,12 @@ kubectl apply -R -f addons/nginx-ingress/digital-ocean/
cd $CWD
# echo "Deploying Gitlab Runner"
# ./sources/gitlab-runner/gen-config.sh $GITLAB_TOKEN
# kubectl apply -R -f ./sources/gitlab-runner/
echo "Deploying DO volume provisioner"
./sources/do-volume-provisioner/gen-secret.sh
kubectl apply -R -f ./sources/do-volume-provisioner/
kubectl apply -f https://raw.githubusercontent.com/digitalocean/csi-digitalocean/master/deploy/kubernetes/releases/csi-digitalocean-v1.0.0.yaml
kubectl --validate=false apply -f https://raw.githubusercontent.com/digitalocean/csi-digitalocean/master/deploy/kubernetes/releases/csi-digitalocean-v0.3.1.yaml
echo "Deploying websites' settings"
......
module "digital-ocean-alice" {
source = "git::https://github.com/poseidon/typhoon//digital-ocean/container-linux/kubernetes"
source = "git::https://github.com/poseidon/typhoon//digital-ocean/container-linux/kubernetes?ref=v1.12.3"
providers = {
digitalocean = "digitalocean.default"
......@@ -21,7 +21,7 @@ module "digital-ocean-alice" {
worker_count = 3
worker_type = "s-2vcpu-4gb"
ssh_fingerprints = ["1b:62:7c:80:6d:c3:88:95:02:2e:b4:30:d0:85:3b:15"]
ssh_fingerprints = ["df:a9:7f:e1:e5:e8:c7:3e:2c:c3:a9:ac:7c:bd:e7:a6"]
# output assets dir
asset_dir = "/Users/dmytro/.secrets/clusters/alice"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment