From ad420afd205422c204f24236e815be7d8fe15413 Mon Sep 17 00:00:00 2001 From: Mocanu Marian Date: Sun, 1 May 2022 15:21:24 +0300 Subject: [PATCH 1/5] Create install script --- aws/install.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 aws/install.sh diff --git a/aws/install.sh b/aws/install.sh new file mode 100644 index 0000000..769714d --- /dev/null +++ b/aws/install.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +sudo apt-get update + +# Install snap store, certbot +sudo snap install snap-store +sudo snap install certbot + +# Install Docker via snap store +sudo snap install docker +sudo addgroup --system docker +sudo adduser $USER docker +newgrp docker +sudo snap disable docker +sudo snap enable docker + +# Install Docker + # sudo apt-get install -y \ + # apt-transport-https \ + # ca-certificates \ + # curl \ + # software-properties-common + + # curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + + # echo \ + # "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + # $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + + # sudo apt-get update + # sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin + + # sudo groupadd docker + # sudo usermod -aG docker $USER + # newgrp docker + +# Install Docker Compose +DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} +mkdir -p $DOCKER_CONFIG/cli-plugins +curl -SL https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose +chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose From eec8879a767a8cee26c6e8ed8fd02e7ee6d00ce6 Mon Sep 17 00:00:00 2001 From: Mocanu Marian Date: Sat, 7 May 2022 22:40:06 +0300 Subject: [PATCH 2/5] Create scripts for docker & ssl generation --- aws/generate_ssl.sh | 17 +++++++++++++++++ aws/install.sh | 15 +++++++++++++++ aws/run_docker.sh | 6 ++++++ 3 files changed, 38 insertions(+) create mode 100644 aws/generate_ssl.sh create mode 100644 aws/run_docker.sh diff --git a/aws/generate_ssl.sh b/aws/generate_ssl.sh new file mode 100644 index 0000000..6ffffd2 --- /dev/null +++ b/aws/generate_ssl.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ $# -ne 2 ]; then + echo "Please provide a domain name and an email address." + else + + # Generate SSL certificate using certbot + add-apt-repository ppa:certbot/certbot + apt-get update + apt-get install certbot + + certbot certonly --standalone -d "$1" -d www."$1" --agree-tos \ + --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 \ + -m "$2" \ + --server https://acme-v02.api.letsencrypt.org/directory + +fi diff --git a/aws/install.sh b/aws/install.sh index 769714d..2a95fd3 100644 --- a/aws/install.sh +++ b/aws/install.sh @@ -39,3 +39,18 @@ DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} mkdir -p $DOCKER_CONFIG/cli-plugins curl -SL https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose + +# Clone website-factory repository & run docker-compose +git clone https://github.com/code4romania/website-factory.git +cd website-factory +docker-compose up -d + +# Generate SSL certificate using certbot +add-apt-repository ppa:certbot/certbot +apt-get update +apt-get install certbot + +certbot certonly --standalone -d "$1" -d www."$1" --agree-tos \ +--no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 \ +-m "$2" \ +--server https://acme-v02.api.letsencrypt.org/directory diff --git a/aws/run_docker.sh b/aws/run_docker.sh new file mode 100644 index 0000000..c778632 --- /dev/null +++ b/aws/run_docker.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Clone website-factory repository & run docker-compose +git clone https://github.com/code4romania/website-factory.git +cd website-factory +docker-compose up -d From 7157f67b33e61b8106e979ac9ed4c3b3d709518d Mon Sep 17 00:00:00 2001 From: Mocanu Marian Date: Sun, 29 May 2022 15:32:35 +0000 Subject: [PATCH 3/5] Update install.sh --- aws/install.sh | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/aws/install.sh b/aws/install.sh index 2a95fd3..36c65ed 100644 --- a/aws/install.sh +++ b/aws/install.sh @@ -14,26 +14,6 @@ newgrp docker sudo snap disable docker sudo snap enable docker -# Install Docker - # sudo apt-get install -y \ - # apt-transport-https \ - # ca-certificates \ - # curl \ - # software-properties-common - - # curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg - - # echo \ - # "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ - # $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - - # sudo apt-get update - # sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin - - # sudo groupadd docker - # sudo usermod -aG docker $USER - # newgrp docker - # Install Docker Compose DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} mkdir -p $DOCKER_CONFIG/cli-plugins From 2284a87ecf8d316a092d3347385c9b107c7bd80c Mon Sep 17 00:00:00 2001 From: Mocanu Marian Date: Sun, 29 May 2022 15:33:23 +0000 Subject: [PATCH 4/5] Update install.sh --- aws/install.sh | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/aws/install.sh b/aws/install.sh index 36c65ed..2a4d366 100644 --- a/aws/install.sh +++ b/aws/install.sh @@ -14,23 +14,4 @@ newgrp docker sudo snap disable docker sudo snap enable docker -# Install Docker Compose -DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} -mkdir -p $DOCKER_CONFIG/cli-plugins -curl -SL https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose -chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose - -# Clone website-factory repository & run docker-compose -git clone https://github.com/code4romania/website-factory.git -cd website-factory -docker-compose up -d - -# Generate SSL certificate using certbot -add-apt-repository ppa:certbot/certbot -apt-get update -apt-get install certbot - -certbot certonly --standalone -d "$1" -d www."$1" --agree-tos \ ---no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 \ --m "$2" \ ---server https://acme-v02.api.letsencrypt.org/directory +./install-components.sh From 0cd3191af19edbd44b67da5c3f0b21235bb3bfb5 Mon Sep 17 00:00:00 2001 From: Mocanu Marian Date: Sun, 29 May 2022 18:35:55 +0300 Subject: [PATCH 5/5] Update install scripts --- aws/generate_ssl.sh | 1 - aws/{install.sh => install-base.sh} | 2 +- aws/install-compose.sh | 5 +++++ aws/run_docker.sh | 2 -- 4 files changed, 6 insertions(+), 4 deletions(-) rename aws/{install.sh => install-base.sh} (92%) create mode 100644 aws/install-compose.sh diff --git a/aws/generate_ssl.sh b/aws/generate_ssl.sh index 6ffffd2..5ad53c6 100644 --- a/aws/generate_ssl.sh +++ b/aws/generate_ssl.sh @@ -13,5 +13,4 @@ if [ $# -ne 2 ]; then --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 \ -m "$2" \ --server https://acme-v02.api.letsencrypt.org/directory - fi diff --git a/aws/install.sh b/aws/install-base.sh similarity index 92% rename from aws/install.sh rename to aws/install-base.sh index 2a4d366..b8dd593 100644 --- a/aws/install.sh +++ b/aws/install-base.sh @@ -14,4 +14,4 @@ newgrp docker sudo snap disable docker sudo snap enable docker -./install-components.sh +./install-compose.sh diff --git a/aws/install-compose.sh b/aws/install-compose.sh new file mode 100644 index 0000000..f476d75 --- /dev/null +++ b/aws/install-compose.sh @@ -0,0 +1,5 @@ +# Install Docker Compose +DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} +mkdir -p $DOCKER_CONFIG/cli-plugins +curl -SL https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose +chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose diff --git a/aws/run_docker.sh b/aws/run_docker.sh index c778632..237eb74 100644 --- a/aws/run_docker.sh +++ b/aws/run_docker.sh @@ -1,6 +1,4 @@ #!/bin/bash -# Clone website-factory repository & run docker-compose -git clone https://github.com/code4romania/website-factory.git cd website-factory docker-compose up -d