For simplicity, we will deploy the project to VDS. The deployment process consists of several steps:
Create a VDS virtual machine for example at NetAngels.
For secretic.app we used distribution Ubuntu 20.04
.
Login via SSH (as root
user) and check PHP version (php -v
).
If necessary, upgrade to PHP 8:
sudo apt update
sudo apt install software-properties-common
sudo apt update
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.1-common php8.1-cli php8.1-mysql php8.1-xml php8.1-curl php8.1-bcmath php8.1-mbstring -y
Manually install Composer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
And make it available for calling through composer
:
sudo mv composer.phar /usr/local/bin/composer
Next, we do everything from the user web
, not root
!!!
First, generate SSH-keys with ssh-keygen
:
cd ~/.ssh && ssh-keygen
With default settings, you will see something like:
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:e+Wuo7OK0Vd+oJ3LM75ZAhJq9xZOSZ0schYgsmdFdSg root@vm-80ae16e5
The key's randomart image is:
+---[RSA 3072]----+
| . ..+oo.. |
| o oE .= . |
| . o o.= + |
| o . * o |
| o o S o . |
| . o = O = |
| . . B * + |
| o o.o+B |
| . ..o=B*. |
+----[SHA256]-----+
In the GitHub-repository, in the Settings > Deploy Keys
section (link), set the value of the public key from the virtual machine.
You can get it via:
cat ~/.ssh/id_rsa.pub
This will allow deployment via git pull
from VDS.
After that, in the GitHub repository, in the Settings > Secrets > Actions
section (link), set the values:
SSH_HOST
: This is the IP address of the server.SSH_USERNAME
: This is theweb
username.SSH_PASSWORD
: This is the user password.
Go to path /var/www/web/sites
and clone current repository (or your own fork). For example, use secretic.app
folder name:
cd /var/www/web/sites
git clone [email protected]:gomzyakov/secretic.git secretic.app
cd secretic
Then go to path /var/www/web/sites/secretic.app
and run some commands:
php -r "file_exists('.env') || copy('.env.example', '.env');"
composer install
chmod -R 777 storage bootstrap/cache
php artisan key:generate
- Write the correct database requisites in the
.env
file - Create a
secretnotes
database via phpMyAdmin - Run migrations
php artisan migrate:fresh --seed
Open assigned to VDS URL (like dd
) in your favorite browser. Happy using Secretic!
cd /var/www/web/sites
ln -s secretic.app www.secretic.app
ln -s secretic.app secretic.ru
ln -s secretic.app secretnotes.ru
No need if you are using mode
Flexible
on Cloudflare
Read more about HTTPS connection in HTTPS.md