updated build files

This commit is contained in:
vabene1111 2021-10-13 11:20:26 +02:00
parent 139afcd333
commit 5858283cdd
6 changed files with 88 additions and 17 deletions

View File

@ -17,6 +17,16 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.9
# Build Vue frontend
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
working-directory: ./vue
run: yarn install
- name: Build dependencies
working-directory: ./vue
run: yarn build
- name: Install dependencies
run: |
python -m pip install --upgrade pip

View File

@ -9,6 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
# Update Version number
- name: Update version file
uses: DamianReeves/write-file-action@v1.0
with:
@ -17,12 +18,17 @@ jobs:
VERSION_NUMBER = 'beta'
BUILD_REF = '${{ github.sha }}'
write-mode: overwrite
- uses: borales/actions-yarn@v2.3.0
# Build Vue frontend
- uses: actions/setup-node@v2
with:
cmd: install
- uses: borales/actions-yarn@v2.3.0
with:
cmd: build
node-version: '14'
- name: Install dependencies
working-directory: ./vue
run: yarn install
- name: Build dependencies
working-directory: ./vue
run: yarn build
# Build container
- name: Build and publish image
uses: ilteoood/docker_buildx@master
with:
@ -31,9 +37,10 @@ jobs:
tag: beta
dockerHubUser: ${{ secrets.DOCKER_USERNAME }}
dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }}
# Send discord notification
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BETA_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: 'The BETA Image has been updated!'
args: '🚀 The BETA Image has been updated! 🥳'

View File

@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
# Update Version number
- name: Update version file
uses: DamianReeves/write-file-action@v1.0
with:
@ -19,6 +20,7 @@ jobs:
VERSION_NUMBER = 'develop'
BUILD_REF = '${{ github.sha }}'
write-mode: overwrite
# Build Vue frontend
- uses: actions/setup-node@v2
with:
node-version: '14'
@ -28,6 +30,7 @@ jobs:
- name: Build dependencies
working-directory: ./vue
run: yarn build
# Build container
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@2.13
with:

View File

@ -13,6 +13,7 @@ jobs:
- name: Get version number
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
# Update Version number
- name: Update version file
uses: DamianReeves/write-file-action@v1.0
with:
@ -21,12 +22,17 @@ jobs:
VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}'
BUILD_REF = '${{ github.sha }}'
write-mode: overwrite
- uses: borales/actions-yarn@v2.3.0
# Build Vue frontend
- uses: actions/setup-node@v2
with:
cmd: install
- uses: borales/actions-yarn@v2.3.0
with:
cmd: build
node-version: '14'
- name: Install dependencies
working-directory: ./vue
run: yarn install
- name: Build dependencies
working-directory: ./vue
run: yarn build
# Build container
- name: Build and publish image
uses: ilteoood/docker_buildx@master
with:

View File

@ -16,6 +16,7 @@ jobs:
- name: Get version number
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
# Update Version number
- name: Update version file
uses: DamianReeves/write-file-action@v1.0
with:
@ -24,12 +25,17 @@ jobs:
VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}'
BUILD_REF = '${{ github.sha }}'
write-mode: overwrite
- uses: borales/actions-yarn@v2.3.0
# Build Vue frontend
- uses: actions/setup-node@v2
with:
cmd: install
- uses: borales/actions-yarn@v2.3.0
with:
cmd: build
node-version: '14'
- name: Install dependencies
working-directory: ./vue
run: yarn install
- name: Build dependencies
working-directory: ./vue
run: yarn build
# Build container
- name: Build and publish image
uses: ilteoood/docker_buildx@master
with:
@ -38,6 +44,7 @@ jobs:
tag: ${{ steps.get_version.outputs.VERSION }}
dockerHubUser: ${{ secrets.DOCKER_USERNAME }}
dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }}
# Send discord notification
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}

View File

@ -19,16 +19,32 @@ Give the user permissions: `chown -R recipes:www-data /var/www/recipes`
Create virtual env: `python3.9 -m venv /var/www/recipes`
Install Javascript Tools
```shell
apt install nodejs
npm install --global yarn
```
### Install postgresql requirements
`sudo apt install libpq-dev postgresql`
###Install project requirements
!!! warning "Update"
Dependencies change with most updates so the following steps need to be re-run with every update or else the application might stop working.
See section **Updating** below
Using binaries from the virtual env:
`/var/www/recipes/bin/pip3.9 install -r requirements.txt`
You will also need to install front end requirements and build them. For this navigate to the `./vue`folder and run
```shell
yarn install
yarn build
```
## Setup postgresql
@ -70,7 +86,7 @@ Execute `bin/python3.9 manage.py migrate`
and revert superuser from postgres: `sudo -u postgres psql` and `ALTER USER djangouser WITH NOSUPERUSER;`
Generate static files: `bin/python3.9 manage.py collectstatic` and remember the folder where files have been copied.
Generate static files: `bin/python3.9 manage.py collectstatic` and `bin/python3.9 manage.py collectstatic_js_reverse` and remember the folder where files have been copied.
## Setup web services
@ -137,3 +153,25 @@ server {
*Note*: Enter the correct path in static and proxy_pass lines.
Reload nginx : `sudo systemctl reload nginx`
# Updating
In order to update the application you will need to run the following commands (probably best to put them into a small script).
```shell
# Update source files
git pull
# load envirtonment variables
export $(cat /var/www/recipes/.env |grep "^[^#]" | xargs)
# migrate database
bin/python3.9 manage.py migrate
# collect static files
bin/python3.9 manage.py collectstatic
bin/python3.9 manage.py collectstatic_js_reverse
# change to frontend directory
cd vue
# install and build frontend
yarn install
yarn build
# restart gunicorn service
sudo systemctl restart gunicorn_recipes
```