mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 15:02:34 +00:00
init
This commit is contained in:
1
system/commands/ubuntu/basics.sh
Executable file
1
system/commands/ubuntu/basics.sh
Executable file
@ -0,0 +1 @@
|
||||
sudo sed -i "s/#precedence ::ffff:0:0\/96 100/precedence ::ffff:0:0\/96 100/" /etc/gai.conf
|
11
system/commands/ubuntu/change-default-php.sh
Executable file
11
system/commands/ubuntu/change-default-php.sh
Executable file
@ -0,0 +1,11 @@
|
||||
if ! sudo rm /usr/bin/php; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ln -s /usr/bin/php__version__ /usr/bin/php; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "Default php is: \n"
|
||||
|
||||
php -v
|
11
system/commands/ubuntu/create-user.sh
Executable file
11
system/commands/ubuntu/create-user.sh
Executable file
@ -0,0 +1,11 @@
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "__key__" | sudo tee -a /home/root/.ssh/authorized_keys
|
||||
sudo useradd -p $(openssl passwd -1 __password__) __user__
|
||||
sudo usermod -aG sudo __user__
|
||||
echo "__user__ ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
|
||||
sudo mkdir /home/__user__
|
||||
sudo mkdir /home/__user__/.ssh
|
||||
echo "__key__" | sudo tee -a /home/__user__/.ssh/authorized_keys
|
||||
sudo chown -R __user__:__user__ /home/__user__
|
||||
sudo chsh -s /bin/bash __user__
|
||||
sudo su - __user__ -c "ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa" <<< y
|
1
system/commands/ubuntu/delete-ssh-key.sh
Normal file
1
system/commands/ubuntu/delete-ssh-key.sh
Normal file
@ -0,0 +1 @@
|
||||
sudo sed -i 's/__key__//g' ~/.ssh/authorized_keys
|
3
system/commands/ubuntu/deploy-ssh-key.sh
Normal file
3
system/commands/ubuntu/deploy-ssh-key.sh
Normal file
@ -0,0 +1,3 @@
|
||||
if ! echo '__key__' | sudo tee -a ~/.ssh/authorized_keys; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
1
system/commands/ubuntu/get-php-ini.sh
Normal file
1
system/commands/ubuntu/get-php-ini.sh
Normal file
@ -0,0 +1 @@
|
||||
cat /etc/php/__version__/cli/php.ini
|
1
system/commands/ubuntu/install-certbot.sh
Executable file
1
system/commands/ubuntu/install-certbot.sh
Executable file
@ -0,0 +1 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install certbot python3-certbot-nginx -y
|
12
system/commands/ubuntu/install-mariadb.sh
Executable file
12
system/commands/ubuntu/install-mariadb.sh
Executable file
@ -0,0 +1,12 @@
|
||||
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
|
||||
|
||||
chmod +x mariadb_repo_setup
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive ./mariadb_repo_setup \
|
||||
--mariadb-server-version="mariadb-10.3"
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install mariadb-server mariadb-backup -y
|
||||
|
||||
sudo service mysql start
|
19
system/commands/ubuntu/install-mysql-8.sh
Executable file
19
system/commands/ubuntu/install-mysql-8.sh
Executable file
@ -0,0 +1,19 @@
|
||||
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.22-1_all.deb
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install mysql-server -y
|
||||
|
||||
sudo service mysql enable
|
||||
|
||||
sudo service mysql start
|
||||
|
||||
if ! sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket;"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo mysql -e "FLUSH PRIVILEGES"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
13
system/commands/ubuntu/install-mysql.sh
Executable file
13
system/commands/ubuntu/install-mysql.sh
Executable file
@ -0,0 +1,13 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install mysql-server -y
|
||||
|
||||
sudo service mysql enable
|
||||
|
||||
sudo service mysql start
|
||||
|
||||
if ! sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket;"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo mysql -e "FLUSH PRIVILEGES"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
8
system/commands/ubuntu/install-nginx.sh
Executable file
8
system/commands/ubuntu/install-nginx.sh
Executable file
@ -0,0 +1,8 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install nginx -y
|
||||
|
||||
if ! echo '__config__' | sudo tee /etc/nginx/nginx.conf; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
sudo service nginx start
|
||||
|
5
system/commands/ubuntu/install-nodejs.sh
Executable file
5
system/commands/ubuntu/install-nodejs.sh
Executable file
@ -0,0 +1,5 @@
|
||||
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -;
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install nodejs -y
|
5
system/commands/ubuntu/install-php-extension.sh
Normal file
5
system/commands/ubuntu/install-php-extension.sh
Normal file
@ -0,0 +1,5 @@
|
||||
sudo apt install -y php__version__-__name__
|
||||
|
||||
sudo service php__version__-fpm restart
|
||||
|
||||
php__version__ -m
|
13
system/commands/ubuntu/install-php.sh
Executable file
13
system/commands/ubuntu/install-php.sh
Executable file
@ -0,0 +1,13 @@
|
||||
sudo add-apt-repository ppa:ondrej/php -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install -y php__version__ php__version__-fpm php__version__-mbstring php__version__-mysql php__version__-mcrypt php__version__-gd php__version__-xml php__version__-curl php__version__-gettext php__version__-zip php__version__-bcmath php__version__-soap php__version__-redis
|
||||
|
||||
if ! sudo sed -i 's/www-data/__user__/g' /etc/php/__version__/fpm/pool.d/www.conf; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
sudo service php__version__-fpm enable
|
||||
|
||||
sudo service php__version__-fpm start
|
5
system/commands/ubuntu/install-redis.sh
Executable file
5
system/commands/ubuntu/install-redis.sh
Executable file
@ -0,0 +1,5 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install redis-server -y
|
||||
|
||||
sudo service redis enable
|
||||
|
||||
sudo service redis start
|
3
system/commands/ubuntu/install-requirements.sh
Executable file
3
system/commands/ubuntu/install-requirements.sh
Executable file
@ -0,0 +1,3 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common curl zip unzip git gcc
|
||||
git config --global user.email "__email__"
|
||||
git config --global user.name "__name__"
|
5
system/commands/ubuntu/install-supervisor.sh
Executable file
5
system/commands/ubuntu/install-supervisor.sh
Executable file
@ -0,0 +1,5 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install supervisor -y
|
||||
|
||||
sudo service supervisor enable
|
||||
|
||||
sudo service supervisor start
|
27
system/commands/ubuntu/install-ufw.sh
Executable file
27
system/commands/ubuntu/install-ufw.sh
Executable file
@ -0,0 +1,27 @@
|
||||
if ! sudo ufw default deny incoming; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ufw default allow outgoing; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ufw allow from 0.0.0.0/0 to any proto tcp port 22; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ufw allow from 0.0.0.0/0 to any proto tcp port 80; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ufw allow from 0.0.0.0/0 to any proto tcp port 443; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ufw --force enable; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ufw reload; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,21 @@
|
||||
mkdir -p ~/.logs
|
||||
|
||||
mkdir -p ~/.logs/workers
|
||||
|
||||
touch ~/.logs/workers/__id__.log
|
||||
|
||||
if ! echo '__config__' | sudo tee /etc/supervisor/conf.d/__id__.conf; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo supervisorctl reread; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo supervisorctl update; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo supervisorctl start __id__:*; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,20 @@
|
||||
if ! sudo supervisorctl stop __id__:*; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo rm -rf ~/.logs/workers/__id__.log; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo rm -rf /etc/supervisor/conf.d/__id__.conf; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo supervisorctl reread; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo supervisorctl update; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
@ -0,0 +1,3 @@
|
||||
if ! sudo supervisorctl restart __id__:*; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,3 @@
|
||||
if ! sudo supervisorctl start __id__:*; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,3 @@
|
||||
if ! sudo supervisorctl stop __id__:*; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
3
system/commands/ubuntu/reboot.sh
Normal file
3
system/commands/ubuntu/reboot.sh
Normal file
@ -0,0 +1,3 @@
|
||||
echo "Rebooting..."
|
||||
|
||||
sudo reboot
|
3
system/commands/ubuntu/restart-service.sh
Normal file
3
system/commands/ubuntu/restart-service.sh
Normal file
@ -0,0 +1,3 @@
|
||||
sudo service __service__ restart
|
||||
|
||||
sudo service __service__ status | cat
|
1
system/commands/ubuntu/service-status.sh
Executable file
1
system/commands/ubuntu/service-status.sh
Executable file
@ -0,0 +1 @@
|
||||
sudo service __service__ status | cat
|
3
system/commands/ubuntu/start-service.sh
Normal file
3
system/commands/ubuntu/start-service.sh
Normal file
@ -0,0 +1,3 @@
|
||||
sudo service __service__ start
|
||||
|
||||
sudo service __service__ status | cat
|
3
system/commands/ubuntu/stop-service.sh
Normal file
3
system/commands/ubuntu/stop-service.sh
Normal file
@ -0,0 +1,3 @@
|
||||
sudo service __service__ stop
|
||||
|
||||
sudo service __service__ status | cat
|
5
system/commands/ubuntu/uninstall-php.sh
Executable file
5
system/commands/ubuntu/uninstall-php.sh
Executable file
@ -0,0 +1,5 @@
|
||||
sudo service php__version__-fpm stop
|
||||
|
||||
if ! sudo DEBIAN_FRONTEND=noninteractive apt remove -y php__version__ php__version__-fpm php__version__-mbstring php__version__-mysql php__version__-mcrypt php__version__-gd php__version__-xml php__version__-curl php__version__-gettext php__version__-zip php__version__-bcmath php__version__-soap php__version__-redis; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
7
system/commands/ubuntu/update-php-ini.sh
Normal file
7
system/commands/ubuntu/update-php-ini.sh
Normal file
@ -0,0 +1,7 @@
|
||||
if ! sudo echo '__ini__' > /etc/php/__version__/cli/php.ini; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo service php__version__-fpm restart; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
11
system/commands/ubuntu/update-php-settings.sh
Normal file
11
system/commands/ubuntu/update-php-settings.sh
Normal file
@ -0,0 +1,11 @@
|
||||
if ! sudo sed -i 's,^__variable__ =.*$,__variable__ = __value__,' /etc/php/__version__/cli/php.ini; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo sed -i 's,^__variable__ =.*$,__variable__ = __value__,' /etc/php/__version__/fpm/php.ini; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo service php__version__-fpm restart; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
7
system/commands/ubuntu/upgrade.sh
Executable file
7
system/commands/ubuntu/upgrade.sh
Executable file
@ -0,0 +1,7 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt clean
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y
|
9
system/commands/ubuntu/webserver/nginx/change-php-version.sh
Executable file
9
system/commands/ubuntu/webserver/nginx/change-php-version.sh
Executable file
@ -0,0 +1,9 @@
|
||||
if ! sudo sed -i 's/php__old_version__/php__new_version__/g' /etc/nginx/sites-available/__domain__; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo service nginx restart; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "PHP Version Changed to __new_version__"
|
@ -0,0 +1,17 @@
|
||||
if ! sudo chown -R 755 /home/vito/phpmyadmin; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! echo '__vhost__' | sudo tee /etc/nginx/sites-available/phpmyadmin; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo service nginx restart; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "PHPMyAdmin vhost created"
|
27
system/commands/ubuntu/webserver/nginx/create-vhost.sh
Executable file
27
system/commands/ubuntu/webserver/nginx/create-vhost.sh
Executable file
@ -0,0 +1,27 @@
|
||||
if ! rm -rf __path__; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! mkdir __path__; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo chown -R 755 __path__; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! echo '' | sudo tee /etc/nginx/conf.d/__domain___redirects; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! echo '__vhost__' | sudo tee /etc/nginx/sites-available/__domain__; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo ln -s /etc/nginx/sites-available/__domain__ /etc/nginx/sites-enabled/; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo service nginx restart; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,11 @@
|
||||
sudo rm -rf __path__
|
||||
|
||||
sudo rm /etc/nginx/sites-available/phpmyadmin
|
||||
|
||||
sudo rm /etc/nginx/sites-enabled/phpmyadmin
|
||||
|
||||
if ! sudo service nginx restart; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "PHPMyAdmin deleted"
|
7
system/commands/ubuntu/webserver/nginx/delete-site.sh
Executable file
7
system/commands/ubuntu/webserver/nginx/delete-site.sh
Executable file
@ -0,0 +1,7 @@
|
||||
rm -rf __path__
|
||||
|
||||
sudo rm /etc/nginx/sites-available/__domain__
|
||||
|
||||
sudo rm /etc/nginx/sites-enabled/__domain__
|
||||
|
||||
echo "Site deleted"
|
@ -0,0 +1,7 @@
|
||||
if ! echo '__redirects__' | sudo tee /etc/nginx/conf.d/__domain___redirects; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo service nginx restart; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
7
system/commands/ubuntu/webserver/nginx/update-vhost.sh
Executable file
7
system/commands/ubuntu/webserver/nginx/update-vhost.sh
Executable file
@ -0,0 +1,7 @@
|
||||
if ! echo '__vhost__' | sudo tee /etc/nginx/sites-available/__domain__; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo service nginx restart; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
Reference in New Issue
Block a user