Skip to content

Commit

Permalink
Dev (#3)
Browse files Browse the repository at this point in the history
* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* Write README

* Write README

* fix mkdir

* fix path
  • Loading branch information
SergTyapkin authored Jan 29, 2024
1 parent 5f32fbc commit 630035b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 53 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ name: Makefile CI
on:
push:
branches: [ "master" ]
repository_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@master

- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ vars.DEPLOY_HOST }}
username: github
username: legend
key: ${{ secrets.SSH_DEPLOY_KEY }}
script: |
cd /home/vue-frontend-template
cd ~/vue-frontend-template
sudo make update
49 changes: 27 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,34 @@ update:
echo "Frontend updated successfully"

setup-ci:
sudo chown -R github:legend .
# Add user if not exists
id -u github &>/dev/null || sudo adduser github
sudo -u github ssh-keygen
#ssh-keygen -t ed25519 -a 200 -C "[email protected]"\
sudo cat /home/github/.ssh/id_rsa.pub >> /home/github/.ssh/authorized_keys
#cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
#cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys2
sudo chmod 777 -R /home/github/.ssh
sudo chmod 666 /home/github/.ssh/authorized_keys
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...]' && \
#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 >> ~/.ssh/authorized_keys
echo '' && \
echo 'Add this private rsa key secret deploy variables to SSH_DEPLOY_KEY on your github repo: ' && \
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
sudo less /tmp/tmp_key

all:
cp --no-clobber ./docker-deploy/.env.example ./docker-deploy/.env
Expand Down
42 changes: 14 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
# Фронтенд интерфейса оператора (отбора/подпитки)
![GithubCI](https://github.com/sergtyapkin/vue-frontend-template/actions/workflows/deploy.yml/badge.svg)

## Установка из исходников
# Фронентд с авто-деплоем на _Nginx_ и получением сертификатов _Letsencript_

### 1. Установить зависимости:
`yarn`
Всё делается через команды `make`

### 2. Сборка
- #### В прод: `yarn dist`
- #### Для разработки: `yarn dev`

## Установка и запуск через Docker

### Сборка из исходников
```
make build
```

### Загрузка из Docker Container Registry
```
docker login git.sberrobots.ru:8443
make pull
### 1. Клонируем:
```SHELL
git clone <this_repo>
```

### Запуск
```
make run
```
Страница будет доступна по адресу `https://localhost:8000`
### 2. Настраиваем вообще всё.
В самом начале нужно будет настроить `.env` файл, прописать правильный `DOMAIN_URL`
```SHELL
cd <this_repo>
make all
````

### Остановка
```
make stop
```
Всё. Наслаждаемся тем, что за нас всё сделали, сайт раздаётся, сертификаты обновляются.
Теперь `Github CI` сам будет проверять, собирается ли контейнер при **Pull Request**'ах, а при **Push**'ах в ветку `master` будет автоматически выполняться `make update` на сервере и обновлять деплой.

0 comments on commit 630035b

Please sign in to comment.