Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danangmassandy committed Mar 1, 2024
0 parents commit 419c1d4
Show file tree
Hide file tree
Showing 267 changed files with 25,900 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "Django Docker Environment",
"remoteUser": "vscode",
"postCreateCommand": "git config --global --add safe.directory /home/web/project",
"dockerComposeFile": [
"../deployment/docker-compose.yml",
"../deployment/docker-compose.override.devcontainer.yml"
],
"service": "dev",
"workspaceFolder": "/home/web/project",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
},
"runArgs": [
"--env-file",
"../deployment/.env"
],
"portsAttributes": {
"9000": {
"label": "Frontend",
"onAutoForward": "notify"
}
},
"forwardPorts": [8000, 9000],
"extensions": ["ms-python.python", "ms-azuretools.vscode-docker"],
"shutdownAction": "stopCompose"
}
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deployment/volumes
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use nix
layout python3
16 changes: 16 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
43 changes: 43 additions & 0 deletions .github/workflows/BuildMKDocsAndPublishToGithubPages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 📖 Build MKDocs And Publish To Github Pages.yml
on:
push:
branches:
- main
# Paths can be used to only trigger actions when you have edited certain files, such as a file within the /docs directory
paths:
- ".github/workflows/BuildMKDocsAndPublishToGithubPages.yml"
- "**.md"
- "**.py"
- "assets/**"
# Allow manually running in the actions tab
workflow_dispatch:

jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- name: Install dependencies
#uses: BSFishy/pip-action@v1
uses: timlinux/pip-action@v1
with:
packages: |
mkdocs-material
qrcode
- name: Checkout main from github
uses: actions/checkout@v3
- name: Create Mkdocs Config 🚀
working-directory: ./docs
run: ./create-mkdocs-html-config.sh
- name: Deploy docs to github pages
# This is where we get the material theme from
uses: timlinux/mkdocs-deploy-gh-pages@master
# Wrong
#uses: timlinux/QGISAnimationWorkbench@main
env:
# Read this carefully:
# https://github.com/marketplace/actions/deploy-mkdocs#building-with-github_token
# The token is automatically generated by the GH Action
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG_FILE: docs/mkdocs.yml
REQUIREMENTS: requirements.txt
37 changes: 37 additions & 0 deletions .github/workflows/CompileMKDocsToPDF.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 📔 Compile MKDocs to PDF
# This workflow is triggered on pushes to the repository.
on:
push:
branches:
- main
# Paths can be used to only trigger actions when you have edited certain files, such as a file within the /docs directory
paths:
- ".github/workflows/CompileMKDocsToPDF.yml"
- "docs/**.md"
- "docs/assets/**"
# Allow manually running in the actions tab
workflow_dispatch:

jobs:
generatepdf:
name: Build PDF
runs-on: ubuntu-latest
steps:
- name: Checkout 🛒
uses: actions/checkout@v3
- name: Create Mkdocs Config 🚀
working-directory: ./docs
run: ./create-mkdocs-pdf-config.sh
- name: Build PDF 📃
uses: kartoza/mkdocs-deploy-build-pdf@master
# Uses orzih's mkdocs PDF builder
# https://github.com/orzih/mkdocs-with-pdf
env:
CONFIG_FILE: docs/mkdocs.yml
EXTRA_PACKAGES: build-base
#REQUIREMENTS: folder/requirements.txt
- name: Upload PDF Artifact ⚡
uses: actions/upload-artifact@v3
with:
name: docs
path: docs/pdfs
24 changes: 24 additions & 0 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish docs via GitHub Pages
on:
push:
branches:
- main

jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v2

- name: Create Mkdocs Config 🚀
working-directory: ./docs
run: ./create-mkdocs-html-config.sh

- name: Deploy docs
uses: timlinux/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG_FILE: /docs/mkdocs.yml
EXTRA_PACKAGES: build-base
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.idea
.venv
.iml
deployment/.env
deployment/docker-compose.override.yml
deployment/volumes

__pycache__/

django_project/.pycharm_helpers/
celerybeat-schedule*
node_modules/
webpack-stats.*
secret.py
coverage.xml

django_project/.env
django_project/tmp/
django_project/frontend/bundles/
django_project/frontend/stats.json

docs/site/*
docks/mkdocs.yml
.direnv
docs/mkdocs.yml
7 changes: 7 additions & 0 deletions .run/DJANGO+REACT.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="DJANGO+REACT" type="CompoundRunConfigurationType">
<toRun name="Run Server" type="Python.DjangoServer" />
<toRun name="start" type="js.build_tools.npm" />
<method v="2" />
</configuration>
</component>
27 changes: 27 additions & 0 deletions .run/Run Server.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Server" type="Python.DjangoServer" factoryName="Django server">
<module name="django-react-base" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="core.settings.dev" />
</envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/deployment/docker-compose.yml, $PROJECT_DIR$/deployment/docker-compose.override.yml]:dev/python" />
<option name="SDK_NAME" value="KARTOZA_DJANGO_REACT_BASE" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="launchJavascriptDebuger" value="false" />
<option name="port" value="8000" />
<option name="host" value="0.0.0.0" />
<option name="additionalOptions" value="" />
<option name="browserUrl" value="" />
<option name="runTestServer" value="false" />
<option name="runNoReload" value="false" />
<option name="useCustomRunCommand" value="false" />
<option name="customRunCommand" value="" />
<method v="2" />
</configuration>
</component>
12 changes: 12 additions & 0 deletions .run/serve.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="serve" type="js.build_tools.npm" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/django_project/frontend/package.json" />
<command value="run" />
<scripts>
<script value="serve" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
43 changes: 43 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome",
"request": "launch",
"type": "chrome",
"url": "http://localhost:8000",
"webRoot": "${workspaceFolder}/django_project/frontend",
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*"
}
},
{
"name": "Django: Run server",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/django_project/manage.py",
"args": [
"runserver", "8000"
],
"django": true,
"justMyCode": true,
},
{
"command": "npm run serve",
"name": "React: Run webpack-dev-server",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/django_project/frontend",
},
],
"compounds": [
{
"name": "Django + React",
"configurations": ["Django: Run server", "React: Run webpack-dev-server"],
"stopAll": true
}
]
}
46 changes: 46 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "React: Install dependencies",
"type": "shell",
"command": "npm install",
"options": {
"cwd": "${workspaceFolder}/django_project/frontend"
},
"group": "build",
"problemMatcher": []
},
{
"label": "React: Webpack-dev-server",
"type": "shell",
"command": "npm run serve",
"port": 9000,
"options": {
"cwd": "${workspaceFolder}/django_project/frontend"
},
"group": "build",
"problemMatcher": []
},
{
"label": "Django: Migrate",
"type": "shell",
"command": "python manage.py migrate",
"group": "build",
"options": {
"cwd": "${workspaceFolder}/django_project"
},
"problemMatcher": []
},
{
"label": "Django: Make Migrations",
"type": "shell",
"command": "python manage.py makemigrations",
"group": "build",
"options": {
"cwd": "${workspaceFolder}/django_project"
},
"problemMatcher": []
},
]
}
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export COMPOSE_FILE=deployment/docker-compose.yml:deployment/docker-compose.override.yml
SHELL := /bin/bash

build:
@echo
@echo "------------------------------------------------------------------"
@echo "Building in production mode"
@echo "------------------------------------------------------------------"
@docker-compose build

up:
@echo
@echo "------------------------------------------------------------------"
@echo "Running in production mode"
@echo "------------------------------------------------------------------"
@docker-compose ${ARGS} up -d nginx django

dev:
@echo
@echo "------------------------------------------------------------------"
@echo "Running in dev mode"
@echo "------------------------------------------------------------------"
@docker-compose ${ARGS} up -d dev worker
@docker-compose ${ARGS} up --no-recreate --no-deps -d

serve:
@echo
@echo "------------------------------------------------------------------"
@echo "Execute webpack serve command"
@echo "------------------------------------------------------------------"
@docker-compose ${ARGS} exec -T dev npm --prefix /home/web/django_project/frontend run serve
Loading

0 comments on commit 419c1d4

Please sign in to comment.