Verified Commit 9dfcef72 authored by Dmytro Bogatov's avatar Dmytro Bogatov 💕

Migrate. Add spaces migration script (fix #10). Fix status-site bug.

parent 638f6cd6
......@@ -9,3 +9,7 @@ infra/dashboard/
.secret.sh
infra/sources/shevastream/appsettings.json
infra/terraform/spaces/
infra/spaces-buffer
# Setup Manager
> When re-deploying change API key, SSH key and domain ownership!
> Run set.dns.sh, test-websites.sh and migrate-spaces.sh
* Follow [this](https://typhoon.psdn.io/digital-ocean/) to create a working Kubernetes cluster.
* [Create docker pull secret](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/).
* Use [this](https://github.com/poseidon/typhoon/blob/c3b0cdddf3310c3d6946ab018cff5229ce96623f/docs/addons/prometheus.md) to set up Prometheus-Grafana.
......
#!/usr/bin/env bash
# Files in ./terraform/spaces/ must be <from> and <to>
# and must contain configs to connect to those buckets
# generated with `s3cmd --configure`
set -e
shopt -s globstar
# Ensure that the CWD is set to script's location
cd "${0%/*}"
CWD=$(pwd)
TEMP_DIR="spaces-buffer"
usage () {
printf "usage: $0 <from> <to> <last-gitlab-backup>\n"
exit 1;
}
if ! [ $# -eq 3 ]
then
usage
fi
FROM=$1
TO=$2
GITLAB=$3
rm -rf $TEMP_DIR
mkdir -p $TEMP_DIR
cd $TEMP_DIR
mkdir -p public
s3cmd -c ../terraform/spaces/$FROM get s3://$FROM/public/ --recursive public
s3cmd -c ../terraform/spaces/$TO put public s3://$TO --recursive
s3cmd -c ../terraform/spaces/$FROM get s3://$FROM/$GITLAB --recursive
s3cmd -c ../terraform/spaces/$TO put $GITLAB s3://$TO --recursive
cd $CWD
rm -rf $TEMP_DIR
echo "Done."
......@@ -65,9 +65,9 @@ What=/var/vm/swapfile1
WantedBy=multi-user.target
EOL
for ip in "${IPS[@]}"
for ip in ${IPS[@]}
do
echo "Adding space for node $ip"
ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" core@$ip "sudo mkdir -p /var/vm"
......@@ -100,7 +100,7 @@ echo "Creating namespaces and saving SSL certs"
NAMESPACES=("websites" "monitoring" "ingress" "status-site" "kube-system")
for namespace in "${NAMESPACES[@]}"
for namespace in ${NAMESPACES[@]}
do
kubectl create namespace "$namespace" || true # some of them already exist
kubectl create --namespace="$namespace" secret tls lets-encrypt --key "$CERTDIRPATH"/certificate.key --cert "$CERTDIRPATH"/certificate.crt
......
......@@ -11,6 +11,7 @@ SERVICES["mail-dbogatov-org"]="registry.dbogatov.org/dbogatov/nginx-proxies/mail
SERVICES["dns-dbogatov-org"]="registry.dbogatov.org/dbogatov/nginx-proxies/dns-dbogatov-org:latest"
SERVICES["webcam-dbogatov-org"]="registry.dbogatov.org/dbogatov/nginx-proxies/webcam-dbogatov-org:latest"
SERVICES["ore-dbogatov-org"]="registry.dbogatov.org/bu/cs-562/project-code/docs:master"
SERVICES["status-dbogatov-org"]="registry.dbogatov.org/dbogatov/nginx-proxies/status-dbogatov-org:latest"
SERVICES["nigmatullina-org"]="registry.dbogatov.org/dbogatov/inara-cv:latest"
......
-----BEGIN CERTIFICATE-----
MIIDMjCCAhoCCQCJSEL2B9HahTANBgkqhkiG9w0BAQsFADBbMQswCQYDVQQGEwJV
UzELMAkGA1UECAwCTUExDzANBgNVBAcMBkJvc3RvbjENMAsGA1UECgwEV2lsZDEf
MB0GA1UEAwwWKi5jbHVzdGVyLmRib2dhdG92Lm9yZzAeFw0xODAxMjIxNzUxMDda
Fw0xOTAxMjIxNzUxMDdaMFsxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJNQTEPMA0G
A1UEBwwGQm9zdG9uMQ0wCwYDVQQKDARXaWxkMR8wHQYDVQQDDBYqLmNsdXN0ZXIu
ZGJvZ2F0b3Yub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4HMR
BXLEzgRFMnInRrPf0BytZy4MSq0/wTWeFz3kXp2E6ffPoQiDswmqIKyYmnWcbXmJ
6iEl5kE2JAjvcxJTxEakU8gVGUNOUQxOk/+eE+48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KnyJqzhBdcjNoNyDOfouSObwyKPfgJyNwkZvtd+JIoiEHW0kR
U601uaW3JJe0OfbPc1g7Ums0JHmN7s4Z63qnlGnRt7KALJRa80tpHpVXs/EmFzd6
1IMpZbtjW154arXEQZ88WEJ6DA==
-----END PRIVATE KEY-----
......@@ -16,7 +16,7 @@ SERVICE_UNABAILBALE="503"
MAIN=("dbogatov.org" "dmytro.app" "bogatov.app")
DOMAINS["__MAIN__"]=$SUCCESS
DOMAINS["status.__MAIN__"]=$SERVICE_UNABAILBALE
DOMAINS["status.__MAIN__"]=$PERMANENT_REDIRECT
DOMAINS["blog.__MAIN__"]=$SUCCESS
DOMAINS["legacy.__MAIN__"]=$SUCCESS
DOMAINS["push.__MAIN__"]=$SUCCESS
......@@ -24,9 +24,10 @@ DOMAINS["socialimps.__MAIN__"]=$SUCCESS
DOMAINS["mail.__MAIN__"]=$SUCCESS
DOMAINS["dns.__MAIN__"]=$SUCCESS
DOMAINS["dashboard.dbogatov.org"]=$FOUND
DOMAINS["netwatch.app"]=$SERVICE_UNABAILBALE
DOMAINS["bogatov.kiev.ua"]=$SUCCESS
DOMAINS["blog.bogatov.kiev.ua"]=$SUCCESS
......
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