vitodeploy / vito

The Ultimate Server Management Tool
https://vitodeploy.com
GNU Affero General Public License v3.0
1.24k stars 190 forks source link

Enhancement v2.x/scrips install.sh #326

Open joglomedia opened 4 weeks ago

joglomedia commented 4 weeks ago

Hi all, This PR contains significant changes, further review & comments are needed.

Changelogs

Bugfixes

1) Update VITO_VERSION from 1.x to 2.x

Issue #320

I added this validation to check the latest release tag and fall back to the version branch if it has not yet been released (it can be deleted after v2.x is officially released).

# Check for the latest version release tag
if [[ $(git tag -l --sort=-v:refname | head -n 1 | awk -F '.' '{print $1}') -eq $(echo "${VITO_VERSION}" | awk -F '.' '{print $1}') ]]; then 
  V_GIT_BRANCH=$(git tag -l --merged "${VITO_VERSION}" --sort=-v:refname | head -n 1)
else 
  V_GIT_BRANCH="${VITO_VERSION}" # If not available, fallback to the version branch
fi

2) Vito install script requires root permissions

[Before] The script was executed by a non-root user, resulting in installation failure. https://www.awesomescreenshot.com/video/32606272?key=ebaf580990e74287a71ed5af854fd96d

[After] Added root access validation and detect sudo user. https://www.awesomescreenshot.com/video/32833984?key=22dfc7464ee02a559d412ee45c21ebb8

3) Migration failure on Ubuntu 20.04

Issue #321


Improvements

1) Change Nginx repository from the OS default to ondrej/nginx

Since PHP already uses the ondrej/php repository, we can also use the ondrej/nginx repository to install the latest version of Nginx.

2) Install the latest stable version of Certbot

3) Move directly configured sudo users from /etc/sudoers to /etc/sudoers.d/90-vito-users

Changes made directly to /etc/sudoers could be overwritten during system upgrades. In contrast, modifications made to files in /etc/sudoers.d remain intact when we upgrade the system. This can help prevent user lockouts during system upgrades.

4) Update PHP from 8.2 to 8.3

Active support for PHP 8.2 will end at the end of this year. Meanwhile, Laravel 11 already supports PHP 8.3, so it is advisable to update.

4) Add artisan commands filament:optimize and filament:cache-components

These commands enhance FilamentPHP's performance by caching components and optimizing them.

5) Update Quick Start command to run install script

Install using the root user:

curl -sLo- https://raw.githubusercontent.com/vitodeploy/vito/2.x/scripts/install.sh | bash

Install with a sudo user:

curl -sLO https://raw.githubusercontent.com/vitodeploy/vito/2.x/scripts/install.sh && sudo bash ./install.sh

Added New Features

1) Interactive (guided) and non-interactive install

Environment variables required for the non-interactive install:

NONINTERACTIVE=y
V_USERNAME=username
V_ADMIN_EMAIL=you@yourdomain.com
V_ADMIN_PASSWORD=yoursecurepassword
V_APP_ENV=production
V_USE_CUSTOM_DOMAIN=y/n
V_USE_HTTPS_DOMAIN=y/n
V_CUSTOM_DOMAIN=yourdomain.com

2) Supported OS validation

At this time of writing, I suggest supporting the three latest major LTS releases of Ubuntu: Noble, Jammy, and Focal.

Video demo: https://www.awesomescreenshot.com/video/32833293?key=ba8bf73e50564d51c5aee584b1ee4b33

3) User input validation

https://www.awesomescreenshot.com/video/32834308?key=b13b0f720399d7e26138f5582ae4b471

4) Custom domain and HTTPS/SSL auto setup

5) Enable Swap space for low-end box servers/VMs

It is required for SQLite3 compilation process on low RAM machine.

6) Redis setup for Laravel caching and queues

7) Fancy header art

Inspired by DHH's Omakub and my LEMPer Stack installer. ^^

image

Demo Videos

Interactive (Guided) Install

https://www.awesomescreenshot.com/video/32837448?key=fa8a1760bbf93922b48d2d6ff69ed66b

Non-interactive (Unguided) Install

https://www.awesomescreenshot.com/video/32866352?key=a456e5e4fa0ab0e7cf29b7d429eb0d64

saeedvaziry commented 4 weeks ago

Really appreciate the effort on this. But I liked it when it was simpler.

It's a bit hard to review it now because of the many changes but I will take a look at it for sure.

saeedvaziry commented 3 weeks ago

Still trying to understand some decisions here.

Vito is not going to support Redis for it's own cache driver. File driver works fine and not planning to make vito itself havy with requiring more resources to run it.

Why cloning the 2.x branch?! the branch will always get PRs merged into it but when it is stable we will release versions.

Tho I see some good features as well.

Maybe reach me on Discord to discuss this through.

joglomedia commented 2 weeks ago

Hi @saeedvaziry, thanks for your time.

That's okay; I wasn't aware that Vito doesn't support Redis. We can cancel the Redis installation.

Cloning the 2.x branch is just a temporary fallback for the direct script installation test since we don’t have a released v2 tag yet.

I can revise the code.

Regards,

saeedvaziry commented 1 week ago

@joglomedia I am still reviewing the PR, but definitely this is something we will have on v2. Tho I need some of them to be removed as well.

I don't want to support SSL generation out of the box. this will bring too many open issues as for any certbot failures!

For SSL lets only rely on the documentation and the guides here (https://vitodeploy.com/introduction/securing.html)

So please remove all SSL related configs and just keep the certbot to be installed.