Skip to content

Commit 51a2115

Browse files
committed
initial
0 parents  commit 51a2115

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+8570
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/env/
2+
/media/
3+
/static/
4+
/private/

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{py,rst,ini}]
12+
max_line_length = 88
13+
indent_style = space
14+
indent_size = 4
15+
16+
[*.{html,css,scss,js,jsx,ts,tsx,json,yml,xml}]
17+
max_line_length = 80
18+
indent_style = space
19+
indent_size = 2
20+
21+
[*.md]
22+
trim_trailing_whitespace = false
23+
24+
[Makefile]
25+
indent_style = tab

.git-blame-ignore-revs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# List of commits that only reformat code, without changing it
2+
#
3+
# To exclude these commits from git blame:
4+
# git blame --ignore-revs-file .git-blame-ignore-revs <filename>
5+
#
6+
# To make this your default git blame behavior:
7+
# git config blame.ignoreRevsFile .git-blame-ignore-revs

.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Static project files
2+
/apps/frontend/static/
3+
/media/
4+
/static/
5+
/tmp/
6+
7+
# Python files
8+
.Python
9+
.python-version
10+
*.pyc
11+
__pycache__
12+
pip-selfcheck.json
13+
14+
# OS and project files
15+
.DS_Store
16+
.template-version
17+
.vscode
18+
.pytest_cache/
19+
.env
20+
*.swp
21+
/.vagrant/
22+
/docs/_build/
23+
/bin/
24+
/include/
25+
/lib/
26+
/settings/local.py
27+
/Vagrantfile.local
28+
/venv/
29+
db.sqlite3
30+
nosetests.xml
31+
docenv
32+
env
33+
requirements.txt.done
34+
src/
35+
stats/
36+
.idea/
37+
38+
# Coverage
39+
.coverage
40+
coverage.xml
41+
htmlcov/
42+
43+
# frontend stuff
44+
node_modules
45+
webpack-stats.json
46+
yarn-error.log
47+
48+
# logs
49+
error.log
50+
log/
51+
52+
# generated manual files
53+
docs/*.pdf
54+
man/
55+
56+
requirements.txt.done

.gitlab-ci.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
stages:
2+
- build
3+
- test
4+
- deploy
5+
6+
variables:
7+
POSTGRES_DB: aihelpdesk
8+
POSTGRES_USER: postgres
9+
POSTGRES_PASSWORD: postgres
10+
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
11+
12+
cache:
13+
paths:
14+
- .cache/pip
15+
- ~/.cache/pip/
16+
17+
build_frontend:
18+
stage: build
19+
image: node:18-alpine
20+
script:
21+
- yarn --frozen-lockfile
22+
- yarn lint
23+
- yarn build
24+
artifacts:
25+
paths:
26+
- apps/frontend/static
27+
28+
test:
29+
stage: test
30+
image: python:3.10-buster
31+
needs:
32+
- build_frontend
33+
dependencies:
34+
- build_frontend
35+
services:
36+
- postgres:latest
37+
before_script:
38+
- python -V
39+
- pip install --upgrade pip wheel setuptools
40+
- pip install -r requirements/development.txt
41+
script:
42+
- make test ARGS="--ds=settings.gitlab --cov-report term"
43+
coverage: '/TOTAL.*\s+(\d+%)$/'
44+
artifacts:
45+
reports:
46+
coverage_report:
47+
coverage_format: cobertura
48+
path: coverage.xml
49+
paths:
50+
- htmlcov/
51+
interruptible: true
52+
53+
.drone_deploy:
54+
image: docker-registry.fourdigits.nl/fourdigits-public/docker-pipeline:latest
55+
stage: deploy
56+
services:
57+
- docker:dind
58+
needs:
59+
- test
60+
script:
61+
- python3 -m fourdigits_cli docker build --push --version=$DEPLOY_VERSION --file=Dockerfile --target=production $DEPLOY_NAME
62+
- python3 -m fourdigits_cli exonet deploy $DEPLOY_NAME $DEPLOY_VERSION
63+
64+
drone_deploy_tst:
65+
extends: .drone_deploy
66+
variables:
67+
DEPLOY_NAME: tst
68+
DEPLOY_VERSION: $CI_COMMIT_SHORT_SHA
69+
rules:
70+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
71+
environment:
72+
name: test
73+
url: https://aihelpdesk.tst.fourdigits.dev
74+
75+
drone_deploy_acc:
76+
extends: .drone_deploy
77+
variables:
78+
DEPLOY_NAME: acc
79+
DEPLOY_VERSION: $CI_COMMIT_TAG
80+
rules:
81+
# Only deploy for semver rc release: X.X.XrcX
82+
- if: $CI_COMMIT_TAG =~ /.*rc\d+$/
83+
environment:
84+
name: acceptation
85+
url: https://aihelpdesk.acc.fourdigits.dev
86+
87+
drone_deploy_prd:
88+
extends: .drone_deploy
89+
when: manual
90+
variables:
91+
DEPLOY_NAME: prd
92+
DEPLOY_VERSION: $CI_COMMIT_TAG
93+
rules:
94+
# Only deploy on complete semver X.X.X
95+
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/
96+
environment:
97+
name: production
98+
url: https://aihelpdesk.prd.fourdigits.dev

CHANGELOG.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Changelog
2+
=========

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:18-buster-slim as frontend
2+
WORKDIR /home/userapp/src
3+
4+
RUN chown -R node:node /home/userapp
5+
USER node
6+
7+
COPY --chown=node:node . /home/userapp/src
8+
9+
RUN yarn install && \
10+
yarn build
11+
12+
FROM docker-registry.fourdigits.nl/fourdigits-public/django-base-image:310 as production
13+
ARG RELEASE_VERSION
14+
ENV RELEASE_VERSION=$RELEASE_VERSION
15+
ENV DJANGO_SETTINGS_MODULE=settings.production
16+
WORKDIR /home/userapp/src
17+
18+
COPY --chown=userapp requirements /home/userapp/requirements
19+
RUN pip install --upgrade pip gunicorn && pip install -r /home/userapp/requirements/production.txt
20+
21+
COPY --chown=userapp crontab /home/userapp/crontab
22+
COPY --chown=userapp . /home/userapp/src
23+
COPY --chown=userapp --from=frontend /home/userapp/src/apps/frontend/static /home/userapp/src/apps/frontend/static
24+
25+
CMD ["gunicorn", "settings.wsgi:application"]

0 commit comments

Comments
 (0)