Buy VPS
Search VPS or VDS in google
https://www.google.com/search?q=vps+vds+server
I choice this https://ztv.su/aff.php?aff=526 for Russia
Go to https://ztv.su/register.php?language=english
Select OS Ubuntu as OS for this server
Go to main dashboard https://ztv.su/clientarea.php
Wait 20 minuts...
Tune remote access
Open vscode and install ms-vscode-remote.vscode-remote-extensionpack
Add your local SSH key to new VPS from Windows PC
PS C:\Users\Admin> cat ~/.ssh/id_rsa.pub | ssh root@enter-server-ip-address "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"
The authenticity of host 'enter-server-ip-address (enter-server-ip-address)' can't be established.
ECDSA key fingerprint is SHA256:ShA-KeyY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'enter-server-ip-address' (ECDSA) to the list of known hosts.
root@enter-server-ip-address's password:
Connect to remote server with vscode
Click to PLUS and add new connection to ssh server
After connect you can see remote console and ip of server in left buttom panel
Tune server
Install all needed software
Update OS
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt autoremove
sudo apt install -f
Install dokku to server
wget https://raw.githubusercontent.com/dokku/dokku/v0.26.8/bootstrap.sh
sudo DOKKU_TAG=v0.26.8 bash bootstrap.sh
Wait...
Create application and add deploy script from github
Create application
dokku apps:create kaufman-bot
root@vpsXXXX:~# dokku apps:create kaufman-bot
-----> Creating kaufman-bot...
Create ssh key for github in VPS
mkdir github
ssh-keygen -C "github" -f github/id_rsa
root@vpsXXXX:~# mkdir github
root@vpsXXXX:~# ssh-keygen -C "github" -f github/id_rsa
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in github/id_rsa
Your public key has been saved in github/id_rsa.pub
The key fingerprint is:
SHA256:HASH github
The key's randomart image is:
+---[RSA 3072]----+
| .o*oo. |
+----[SHA256]-----+
Add created public key to VPS authorized_keys
cat github/id_rsa.pub >> ~/.ssh/authorized_keys
Add created public key to dokku
dokku ssh-keys:add github ./github/id_rsa.pub
Show and copy private key
cat github/id_rsa
Add server address to secret env in github
Add ci config for github .github/workflows/develop.deploy.yml
name: 'deploy'
# yamllint disable-line rule:truthy
on:
push:
branches:
- feature/73
jobs:
deploy:
runs-on: ubuntu-latest
environment: dev
steps:
- name: Cloning repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@master
with:
branch: 'feature/73'
git_remote_url: 'ssh://dokku@${{secrets.HOST}}:22/kaufman-bot'
ssh_private_key: ${{secrets.SSH_PRIVATE_KEY}}
Add environment values in dokku server
dokku config:set kaufman-bot TELEGRAM_BOT_TOKEN=........................
root@vpsXXXX:~# dokku config:set kaufman-bot TELEGRAM_BOT_TOKEN=........................
-----> Setting config vars
TELEGRAM_BOT_TOKEN: ........................
-----> Restarting app kaufman-bot
! App image (dokku/kaufman-bot:latest) not found
Run redeploy failed pipeline in github
After correct deploy, pipeline mark as green badge
Disable bot in heroku
Top comments (0)