-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Вынес все команды из makefile в папку scripts
- Loading branch information
1 parent
7f2209f
commit 02b7801
Showing
9 changed files
with
97 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cd docker-deploy || exit | ||
docker compose down | ||
docker compose up -d nginx-certbot | ||
docker compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d "$(DOMAIN_URL)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# fully copied from https://docs.docker.com/engine/install/ubuntu/ | ||
if ! command -v docker; then | ||
sudo apt-get update; | ||
sudo apt-get install -y --no-install-recommended ca-certificates curl; | ||
sudo install -m 0755 -d /etc/apt/keyrings; | ||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc; | ||
sudo chmod a+r /etc/apt/keyrings/docker.asc; | ||
# Add the repository to Apt sources: | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$${VERSION_CODENAME}") stable" | \ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null; | ||
sudo apt-get update; | ||
sudo apt-get install -y --no-install-recommended docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; | ||
make set-docker-not-sudo; | ||
else | ||
echo "Docker already installed!"; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# add user to docker group | ||
getent group docker || sudo groupadd docker # Add group if not exists | ||
sudo usermod -aG docker "${USER}" | ||
newgrp docker | ||
sudo systemctl restart docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sudo apt-get update | ||
sudo apt-get install cron | ||
echo "----------------------------------------------------------------------------------------------" | ||
echo "Now you must add this string-command in your crontab to auto executing it each 1 month. Command:" | ||
echo "" | ||
echo "0 0 1 * * cd $(pwd) && make run renew-certs >> ./certbot-renew.log" | ||
echo "" | ||
echo "Copy that command and [press Enter]. Then add this string in end of opened file." | ||
read ENTER | ||
crontab -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#id -u github &>/dev/null || sudo adduser github # Add user if not exists | ||
#sudo chown -R github:legend . | ||
#sudo -u github ssh-keygen | ||
#sudo cat /home/github/.ssh/id_rsa.pub >> /home/github/.ssh/authorized_keys | ||
#sudo chmod 777 -R /home/github/.ssh | ||
#sudo chmod 666 /home/github/.ssh/authorized_keys | ||
#sudo -u github ssh-keygen | ||
#echo "" && \ | ||
#echo 'Add this politics for github user: [press Enter]' && \ | ||
#echo 'AllowUsers github' && \ | ||
#echo 'Match User github' && \ | ||
#echo 'PasswordAuthentication no' && \ | ||
#echo 'AllowTCPForwarding no' && \ | ||
#echo 'X11Forwarding no' && \ | ||
#echo '[press Enter...]' && \ | ||
#read ENTER | ||
#nano /etc/ssh/sshd_config | ||
#echo "" && \ | ||
#echo 'Add this public rsa key to Deploy keys in your github directory: ' && \ | ||
#sudo cat /home/github/.ssh/id_rsa.pub | ||
ssh-keygen -f /tmp/tmp_key | ||
sudo mkdir -p ~/.ssh | ||
sudo cat /tmp/tmp_key.pub | sudo tee -a ~/.ssh/authorized_keys > /dev/null | ||
echo '' | ||
echo 'Add this private rsa key secret deploy environment variables to SSH_DEPLOY_KEY on your github repo: ' | ||
echo '[To see key press Enter...]' | ||
read ENTER | ||
sudo less /tmp/tmp_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cp --no-clobber ./docker-deploy/.env.example ./docker-deploy/.env | ||
echo "" | ||
echo "Edit .env file. Write right DOMAIN_URL without https:// and url paths!" | ||
echo "[press Enter...]" | ||
read ENTER | ||
nano ./docker-deploy/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
echo "Now read README.md and setup another deploy environments variables." | ||
echo "It seems like values must be:" | ||
echo "" | ||
echo "SERVER_USERNAME=$(whoami) [! MUST BE SECRET VARIABLE !]" | ||
echo "DEPLOY_HOST=$(< ./docker-deploy/.env grep DOMAIN_URL | sed 's/.*=//')" | ||
echo "PROJECT_PATH=$(pwd)" | ||
echo "" | ||
echo "[press Enter to finish setup]" | ||
read ENTER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
git fetch --all | ||
git reset --hard "origin/$(sed -n "s/^DEPLOY_BRANCH=//p" "docker-deploy/.env")" | ||
echo "Deploying last commit:" | ||
git log --oneline -1 | ||
cd docker-deploy || exit | ||
docker compose up -d nginx --build | ||
echo "Frontend updated successfully" |