diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..1edbfb8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" + } \ No newline at end of file diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5b56c5d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +deployment/volumes \ No newline at end of file diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1644a0a --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use nix +layout python3 diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..0c39914 --- /dev/null +++ b/.github/stale.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/BuildMKDocsAndPublishToGithubPages.yml b/.github/workflows/BuildMKDocsAndPublishToGithubPages.yml new file mode 100644 index 0000000..0aa3122 --- /dev/null +++ b/.github/workflows/BuildMKDocsAndPublishToGithubPages.yml @@ -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 diff --git a/.github/workflows/CompileMKDocsToPDF.yml b/.github/workflows/CompileMKDocsToPDF.yml new file mode 100644 index 0000000..8d79dc9 --- /dev/null +++ b/.github/workflows/CompileMKDocsToPDF.yml @@ -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 diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml new file mode 100644 index 0000000..e16fc3b --- /dev/null +++ b/.github/workflows/mkdocs.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4dedd46 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/.run/DJANGO+REACT.run.xml b/.run/DJANGO+REACT.run.xml new file mode 100644 index 0000000..7a344a9 --- /dev/null +++ b/.run/DJANGO+REACT.run.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.run/Run Server.run.xml b/.run/Run Server.run.xml new file mode 100644 index 0000000..1ba1383 --- /dev/null +++ b/.run/Run Server.run.xml @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/.run/serve.run.xml b/.run/serve.run.xml new file mode 100644 index 0000000..3cd689c --- /dev/null +++ b/.run/serve.run.xml @@ -0,0 +1,12 @@ + + + + + + + +{% block content %} +{% endblock %} + + diff --git a/django_project/frontend/templates/home.html b/django_project/frontend/templates/home.html new file mode 100644 index 0000000..7e6f2b0 --- /dev/null +++ b/django_project/frontend/templates/home.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% block extra_head %} + {% load render_bundle from webpack_loader %} +{% endblock %} + +{% block content %} + + +
+{% render_bundle 'App' 'css' %} +{% render_bundle 'App' 'js' %} + +{% endblock %} + + diff --git a/django_project/frontend/tsconfig.json b/django_project/frontend/tsconfig.json new file mode 100644 index 0000000..4f6d8d4 --- /dev/null +++ b/django_project/frontend/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "outDir": "./bundles/", + "noImplicitAny": true, + "module": "esnext", + "target": "es5", + "jsx": "react", + "allowJs": true, + "sourceMap": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "lib": [ + "ES2021.String", + "dom" + ], + }, +} diff --git a/django_project/frontend/urls.py b/django_project/frontend/urls.py new file mode 100644 index 0000000..5e92eab --- /dev/null +++ b/django_project/frontend/urls.py @@ -0,0 +1,23 @@ +"""frontend URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.urls import path +from .views import HomeView, SentryProxyView + +urlpatterns = [ + path('', HomeView.as_view(), name='home'), + path('sentry-proxy/', + SentryProxyView.as_view(), name='sentry-proxy'), +] diff --git a/django_project/frontend/views.py b/django_project/frontend/views.py new file mode 100644 index 0000000..f239d39 --- /dev/null +++ b/django_project/frontend/views.py @@ -0,0 +1,48 @@ +from django.views.generic import TemplateView, View +from django.http import HttpResponse +from django.utils.decorators import method_decorator +from django.conf import settings +from django.views.decorators.csrf import csrf_exempt +import json +import requests +from urllib.parse import urlparse + + +class HomeView(TemplateView): + template_name = 'home.html' + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + + return context + + +@method_decorator(csrf_exempt, name="dispatch") +class SentryProxyView(View): + sentry_key = settings.SENTRY_DSN + def post(self, request): + host = "sentry.io" + known_project_ids = [36] # Add your Sentry project IDs here + + envelope = request.body.decode("utf-8") + pieces = envelope.split("\n", 1) + header = json.loads(pieces[0]) + + if "dsn" in header: + dsn = urlparse(header["dsn"]) + project_id = int(dsn.path.strip("/")) + + sentry_url = f"https://{host}/api/{project_id}/envelope/" + headers = { + "Content-Type": "application/x-sentry-envelope", + } + response = requests.post( + sentry_url, + headers=headers, + data=envelope.encode("utf-8"), + timeout=200 + ) + + return HttpResponse(response.content, status=response.status_code) + + return HttpResponse(status=400) diff --git a/django_project/frontend/webpack.config.js b/django_project/frontend/webpack.config.js new file mode 100644 index 0000000..53735c4 --- /dev/null +++ b/django_project/frontend/webpack.config.js @@ -0,0 +1,128 @@ +const path = require("path"); +const BundleTracker = require('webpack-bundle-tracker'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); // require clean-webpack-plugin +const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); +const webpack = require("webpack"); + +const mode = process.env.npm_lifecycle_script; +const isDev = (mode.includes('dev')); +const isServe = (mode.includes('serve')); +const filename = isDev ? "[name]" : "[name].[fullhash]"; +const statsFilename = isDev ? './webpack-stats.dev.json' : './webpack-stats.prod.json'; +const minimized = !isDev; + +let conf = { + entry: { + App: './src/App.tsx' + }, + output: { + path: path.resolve(__dirname, "./bundles/frontend"), + filename: filename + '.js' + }, + module: { + rules: [ + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: [{ loader: 'ts-loader' }], + }, + { + test: /\.s[ac]ss$/i, + use: [ + MiniCssExtractPlugin.loader, + "css-loader", + "sass-loader" + ], + }, + { + test: /\.css$/i, + use: [ + // Translates CSS into CommonJS + MiniCssExtractPlugin.loader, "css-loader", + ], + }, + ], + }, + optimization: { + minimize: minimized, + splitChunks: { + cacheGroups: { + styles: { + name: "styles", + type: "css/mini-extract", + chunks: "all", + enforce: true, + }, + }, + }, + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env.NODE_DEBUG': JSON.stringify(process.env.NODE_DEBUG), + }), + new CleanWebpackPlugin(), + new BundleTracker({ filename: statsFilename }), + new MiniCssExtractPlugin({ + filename: filename + '.css', + chunkFilename: filename + '.css', + ignoreOrder: true, + }), + ], + resolve: { + modules: ['node_modules'], + extensions: [".ts", ".tsx", ".js", ".css", ".scss"], + fallback: { + fs: false, + } + }, + watchOptions: { + ignored: ['node_modules', './**/*.py'], + aggregateTimeout: 300, + poll: 1000 + } +}; +if (isServe) { + if (isDev) { + conf['output'] = { + path: path.resolve(__dirname, "./bundles/frontend"), + filename: filename + '.js', + publicPath: 'http://localhost:9000/static/', + } + } + conf['devServer'] = { + hot: true, + port: 9000, + headers: { + 'Access-Control-Allow-Origin': '*' + }, + devMiddleware: { + writeToDisk: true, + }, + allowedHosts: 'all', + compress: true, + } + conf['devtool'] = 'inline-source-map', + conf['output'] = { + path: path.resolve(__dirname, "./bundles/frontend"), + filename: filename + '.js', + publicPath: 'http://localhost:9000/static/', + } + conf['plugins'].push( + new ReactRefreshWebpackPlugin() + ) +} else if (isDev) { + conf['output'] = { + path: path.resolve(__dirname, "./bundles/frontend"), + filename: filename + '.js' + } + conf['devServer'] = { + hot: true, + port: 9000, + writeToDisk: true, + headers: { + "Access-Control-Allow-Origin": "*", + } + } +} +module.exports = conf; diff --git a/django_project/initialize.py b/django_project/initialize.py new file mode 100644 index 0000000..d006623 --- /dev/null +++ b/django_project/initialize.py @@ -0,0 +1,96 @@ +""" +This script initializes +""" + +######################################################### +# Setting up the context +######################################################### + +######################################################### +# Imports +######################################################### +from django.db import connection +from django.db.utils import OperationalError +from django.contrib.auth import get_user_model +from django.core.management import call_command +import os +import time + +import django + +django.setup() + +# Getting the secrets +admin_username = os.getenv('ADMIN_USERNAME') +admin_password = os.getenv('ADMIN_PASSWORD') +admin_email = os.getenv('ADMIN_EMAIL') + +######################################################### +# 1. Waiting for PostgreSQL +######################################################### + +print("-----------------------------------------------------") +print("1. Waiting for PostgreSQL") +for _ in range(60): + try: + connection.ensure_connection() + break + except OperationalError: + time.sleep(1) +else: + connection.ensure_connection() +connection.close() + +######################################################### +# 2. Running the migrations +######################################################### + +print("-----------------------------------------------------") +print("2. Running the migrations") +call_command('makemigrations') +call_command('migrate', '--noinput') + +######################################################### +# 3. Creating superuser if it doesn't exist +######################################################### + +print("-----------------------------------------------------") +print("3. Creating/updating superuser") +try: + superuser = get_user_model().objects.get(username=admin_username) + superuser.set_password(admin_password) + superuser.is_active = True + superuser.email = admin_email + superuser.save() + print('superuser successfully updated') +except get_user_model().DoesNotExist: + superuser = get_user_model().objects.create_superuser( + admin_username, + admin_email, + admin_password + ) + print('superuser successfully created') + +######################################################### +# 4. Loading fixtures +######################################################### + +print("-----------------------------------------------------") +print("4. Loading fixtures") + +# Disable fixtures loading in prod by including environment variable: +# INITIAL_FIXTURES=False +import ast + +_load_initial_fixtures = ast.literal_eval( + os.getenv('INITIAL_FIXTURES', 'True')) +if _load_initial_fixtures: + call_command('load_fixtures') + +######################################################### +# 4. Collecting static files +######################################################### + +print("-----------------------------------------------------") +print("4. Collecting static files") +call_command('collectstatic', '--noinput', verbosity=0) diff --git a/django_project/manage.py b/django_project/manage.py new file mode 100755 index 0000000..f2a662c --- /dev/null +++ b/django_project/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/django_project/webpack_serve.sh b/django_project/webpack_serve.sh new file mode 100755 index 0000000..c4d446b --- /dev/null +++ b/django_project/webpack_serve.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "TEST" +whoami +npm --prefix /home/web/django_project/frontend run serve diff --git a/docs/assets/AvenirLTStd-Black.otf b/docs/assets/AvenirLTStd-Black.otf new file mode 100644 index 0000000..714fdfb Binary files /dev/null and b/docs/assets/AvenirLTStd-Black.otf differ diff --git a/docs/assets/AvenirLTStd-Book.otf b/docs/assets/AvenirLTStd-Book.otf new file mode 100644 index 0000000..52ab53e Binary files /dev/null and b/docs/assets/AvenirLTStd-Book.otf differ diff --git a/docs/assets/AvenirLTStd-Roman.otf b/docs/assets/AvenirLTStd-Roman.otf new file mode 100644 index 0000000..de238e6 Binary files /dev/null and b/docs/assets/AvenirLTStd-Roman.otf differ diff --git a/docs/assets/logo.svg b/docs/assets/logo.svg new file mode 100644 index 0000000..35acd42 --- /dev/null +++ b/docs/assets/logo.svg @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/build-docs-html.sh b/docs/build-docs-html.sh new file mode 100755 index 0000000..5073ac3 --- /dev/null +++ b/docs/build-docs-html.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# This is only intended for local +# testing. See github workflows for +# how this build is automated. + +# this will create mkdocs.yml +./create-mkdocs-html-config.sh +# and this will build the html site +mkdocs build diff --git a/docs/build-docs-pdf.sh b/docs/build-docs-pdf.sh new file mode 100755 index 0000000..59e2cfd --- /dev/null +++ b/docs/build-docs-pdf.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# This is only intended for local +# testing. See github workflows for +# how this build is automated. + +# this will create mkdocs.yml +./create-mkdocs-pdf-config.sh +# and this will build the PDF document +mkdocs build > /tmp/document.html diff --git a/docs/clean.sh b/docs/clean.sh new file mode 100644 index 0000000..3955e8c --- /dev/null +++ b/docs/clean.sh @@ -0,0 +1,5 @@ +#! /usr/bin/env bash + +rm -rf .venv +rm -rf site +rm -rf __pycache__ diff --git a/docs/create-mkdocs-html-config.sh b/docs/create-mkdocs-html-config.sh new file mode 100755 index 0000000..b696d30 --- /dev/null +++ b/docs/create-mkdocs-html-config.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# This script will assemble a mkdocs.yml +# file with plugins section suitable for +# html site generation. + +# This script is used both in manual +# site compilation (via build-docs-html.sh) +# and via the github workflow for +# publishing the site to github pages +# .github/workflows/BuildMKDocsAndPublishToGithubPages.yml + +cat mkdocs-base.yml > mkdocs.yml +cat mkdocs-html.yml >> mkdocs.yml diff --git a/docs/create-mkdocs-pdf-config.sh b/docs/create-mkdocs-pdf-config.sh new file mode 100755 index 0000000..81ac674 --- /dev/null +++ b/docs/create-mkdocs-pdf-config.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# This script will assemble a mkdocs.yml +# file with plugins section suitable for +# PDF site generation. + +# This script is used both in manual +# site compilation (via build-docs-html.sh) +# and via the github workflow for +# publishing the site to github pages +# .github/workflows/CompileMKDocsToPDF.yml + +cat mkdocs-base.yml > mkdocs.yml +cat mkdocs-pdf.yml >> mkdocs.yml +# This is a kludge: I could not figure out +# how to reference image resources using a relative path in the scss... +cat templates/graphics.scss.templ | sed "s?\[BASE_FOLDER\]?$PWD?g" > templates/graphics.scss diff --git a/docs/create-uuid.py b/docs/create-uuid.py new file mode 100755 index 0000000..7cd8a6b --- /dev/null +++ b/docs/create-uuid.py @@ -0,0 +1,5 @@ +#! /usr/bin/env python + +import shortuuid +uuid = shortuuid.uuid() +print (uuid) diff --git a/docs/css/extra.css b/docs/css/extra.css new file mode 100644 index 0000000..5c8983a --- /dev/null +++ b/docs/css/extra.css @@ -0,0 +1,32 @@ +@font-face { + src: url(../assets/AvenirLTStd-Book.otf); + font-family: avenir; +} +@page { + size: a4 portrait; + margin: 0mm; + padding: 25mm 10mm 25mm 10mm; + counter-increment: page; + font-family: avenir; + font-size: 8pt; + white-space: normal; + color: grey; + @bottom-right { + content: 'Copyright © Kartoza'; + margin-top: -25mm; + margin-right: 10mm; + } + @bottom-center{ + content: 'Page ' counter(page); + margin-top: -25mm; + } + +} + +body{ + background-image: url('../img/kartozaBackgroundBorder.png'); + background-repeat: no-repeat; + background-size: cover; + font-family: avenir; + height: 100vh; +} diff --git a/docs/js/tablesort.js b/docs/js/tablesort.js new file mode 100644 index 0000000..c916015 --- /dev/null +++ b/docs/js/tablesort.js @@ -0,0 +1,6 @@ +document$.subscribe(function() { + var tables = document.querySelectorAll("article table:not([class])") + tables.forEach(function(table) { + new Tablesort(table) + }) + }) \ No newline at end of file diff --git a/docs/mkdocs-base.yml b/docs/mkdocs-base.yml new file mode 100644 index 0000000..5dea035 --- /dev/null +++ b/docs/mkdocs-base.yml @@ -0,0 +1,96 @@ +site_name: Project Name +site_description: "Project technical and user documentation." +site_author: "Kartoza" +docs_dir: ./src +site_dir: ./site +repo_name: "Project Name" +repo_url: "https://github.com/kartoza/" +edit_uri: "https://github.com/kartoza//blob/main/docs/" + +copyright: Kartoza and Contributors + +markdown_extensions: + - attr_list # lets us resize images see https://github.com/mkdocs/mkdocs/issues/1678#issuecomment-455500757 + - sane_lists # needed to keep numbers in ordered lists correct + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + #- mdx_truly_sane_lists + - toc: + permalink: true + #slugify: !!python/name:pymdownx.slugs.slugify + - pymdownx.snippets: + base_path: . + - admonition + - tables + - pymdownx.details + - pymdownx.caret + - pymdownx.keys + - pymdownx.mark + - pymdownx.tilde + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format + - pymdownx.emoji: + emoji_generator: !!python/name:materialx.emoji.to_svg + emoji_index: !!python/name:materialx.emoji.twemoji + +# Navigation +nav: + - Home: + - Home: index.md + - Code of Conduct: about/code-of-conduct.md + - License: about/license.md + - Running Instances: about/running-instances.md + - User: + - user/index.md + - Quickstart: user/quickstart/index.md + - Guide: + - user/guide/index.md + - Manual : + - user/manual/index.md + - Administrators: + - administrator/index.md + - Guide: + - administrator/guide/index.md + - Manual: + - administrator/manual/index.md + - Developers: + - developer/index.md + - Guide: + - developer/guide/index.md + - Architecture: developer/guide/architecture.md + - Prerequisites: developer/guide/prerequisites.md + - Cloning: developer/guide/cloning.md + - IDE Setup: developer/guide/ide-setup.md + - Configuration: developer/guide/configuration.md + - Building: developer/guide/building.md + - Design: developer/guide/design.md + - Road Map: developer/guide/roadmap.md + - Workflows: developer/guide/workflows.md + # Pages to render but exclude from navigation + - "": developer/guide/templates/pull-request-template.md + - "": developer/guide/templates/commit-message-convention.md + - Manual: developer/manual/index.md + - Documentation Writing: + - developer/documentation/index.md + - Simple Workflow: developer/documentation/easy-workflow.md + - Advanced Workflow: developer/documentation/overview.md + - Context Help: developer/documentation/context-help.md + - API: + - developer/api/index.md + - Reference: developer/api/manual/index.md + - Guide: developer/api/guide/index.md + - License: about/license.md + - DevOps: + - devops/index.md + - Guide: devops/guide/index.md + - Manual: devops/manual/index.md + - About: + - About: about/index.md + - License: about/license.md + - Contributing: about/contributing.md + - Disclaimer: about/disclaimer.md + diff --git a/docs/mkdocs-html.yml b/docs/mkdocs-html.yml new file mode 100644 index 0000000..e0ab905 --- /dev/null +++ b/docs/mkdocs-html.yml @@ -0,0 +1,120 @@ + +# Configuration +theme: + name: material + language: en + direction: ltr + include_search_page: false + search_index_only: true + features: + - content.code.annotate + - content.tabs.link + - header.autohide +# - navigation.expand # This causes the nav menu to auto expand + - navigation.indexes + - navigation.instant +# - navigation.sections # This removes the ability to shrink sections on the nav menu but gives the bold headings + - navigation.tabs + - navigation.tabs.sticky + - navigation.top + - navigation.tracking + - search.highlight + - search.share + - search.suggest + - toc.follow + palette: + - scheme: default + primary: blue + accent: grey + toggle: + icon: material/brightness-4 + name: Switch to dark mode + - scheme: slate + primary: blue + accent: grey + toggle: + icon: material/brightness-6 + name: Switch to light mode + font: + text: Roboto + code: Roboto Mono + favicon: assets/logo.png + icon: + logo: material/book + +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/kartoza + - icon: fontawesome/brands/docker + link: https://hub.docker.com/r/kartoza/ + - icon: fontawesome/brands/twitter + link: https://twitter.com/KartozaGeo + - icon: fontawesome/brands/facebook + link: https://kartoza.com + - icon: fontawesome/solid/earth-africa + link: https://kartoza.com + +extra_css: + - css/print.css + +extra_javascript: + - https://unpkg.com/tablesort@5.3.0/dist/tablesort.min.js + - js/tablesort.js + +# Needed for the hooks below to work +plugins: + - search + - mkdocs-video + - mkdocstrings: + handlers: + python: + paths: [../django_project] + import: + - https://docs.python.org/3/objects.inv + - https://mkdocstrings.github.io/autorefs/objects.inv + options: + # Lots of other nice options can be found at + # https://mkdocstrings.github.io/python/usage/ + docstring_style: sphinx + heading_level: 2 + show_bases: true + show_signature: true + separate_signature: true + show_signature_annotations: true + show_source: true + show_root_heading: true + show_root_full_path: true + show_root_members_full_path: true + merge_init_into_class: true + docstring_options: + ignore_init_summary: false + + - redirects: + redirect_maps: + #see https://github.com/mkdocs/mkdocs-redirects/tree/master#using + #'old.md': 'new.md' + #'old/file.md': 'new/file.md' + #'some_file.md': 'http://external.url.com/foobar' + - enumerate-headings: + toc_depth: 3 + strict: true + increment_across_pages: true + include: + - "*" + exclude: + - index.md + - user/index.md + - administrator/index.md + - developer/index.md + - developer/manual/*.md + - devops/index.md + restart_increment_after: + - second_section.md + +# Hook to add a uuid to every anchor +# see also hook.py and https://github.com/squidfunk/mkdocs-material/discussions/3758#discussioncomment-4397373 +# Note that although the above link implies you can use UUIDs, you have to use numeric IDS not UUIDS +hooks: + - ./uuid_redirects_hook.py + - ./python_manual_hook.py diff --git a/docs/mkdocs-pdf.yml b/docs/mkdocs-pdf.yml new file mode 100644 index 0000000..c2b44b6 --- /dev/null +++ b/docs/mkdocs-pdf.yml @@ -0,0 +1,56 @@ +# See mkdocs base and the create-mkdocs* +# scripts for how this is used + +plugins: + - with-pdf: + # Generate the whole site as a single PDF + # Full details on this plugin here: + # https://github.com/orzih/mkdocs-with-pdf + # And don't get it confused with https://github.com/zhaoterryy/mkdocs-pdf-export-plugin + # which is intended to export a single page at a time + output_path: ../pdfs/[PROJECT_NAME]Documentation.pdf + author: Kartoza Pty (Ltd.) + # copyright will draw in page.bottom-right + # do it manually in templates/styles.scss + # for more control + # if you comment out here or use an empty string, + # the copyright text from mkdocs-base.yml will be + # used instead + copyright: " " + cover: true # see templates/cover.html + back_cover: true + cover_title: Title for PDF + cover_subtitle: Mappiness is Happiness + cover_logo: ./resources/img/logo/kartoza-logo.svg + # Print css is defined in templates/styles.scss + #custom_template_path: TEMPLATES PATH + # + toc_title: Contents + #heading_shift: false + toc_level: 2 + # Set to 0 so that it does not generate chapter numbering + # we do the numbering in styles.css rather + ordered_chapter_level: 0 + #excludes_children: + # - 'release-notes/:upgrading' + # - 'release-notes/:changelog' + # + #exclude_pages: + # - 'bugs/' + # - 'appendix/contribute/' + #convert_iframe: + # - src: IFRAME SRC + # img: POSTER IMAGE URL + # text: ALTERNATE TEXT + # - src: ... + #two_columns_level: 3 + # + #render_js: true + #headless_chrome_path: headless-chromium + # + + #enabled_if_env: ENABLE_PDF_EXPORT + # See notes at the top of templates/styles.scss.templ + # for debugging workflow details. + debug_html: true + #show_anchors: true diff --git a/docs/python_manual_hook.py b/docs/python_manual_hook.py new file mode 100755 index 0000000..2eee186 --- /dev/null +++ b/docs/python_manual_hook.py @@ -0,0 +1,45 @@ +import logging +import mkdocs.plugins +import os +log = logging.getLogger('mkdocs') + +@mkdocs.plugins.event_priority(-50) + + +def on_startup(command, dirty): + + template = """ +--- +title: Automatically Generated Python Documentation +summary: DO NOT EDIT THIS FILE MANUALLY : It is created during the mkdocs build process +date: 2023-08-03 +--- + +# Python Reference Manual +""" + ignore_list = [ + "__init__", + "migrations", + "tests"] + for root, dirs, files in os.walk("../django_project"): + for file in files: + file = os.path.join(root, file) + ignored = False; + if file.endswith(".py"): + for item in ignore_list: + if item in file: + ignored = True; + #print (item, file, ignored) + if not ignored: + file = file.replace("../django_project/", "::: ") + file = file.replace("/", ".") + file = file.replace(".py", "") + template = template + file + "\n" + output_path = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "src/developer/manual/index.md") + log.info("Manual will be written to: " + output_path) + file = open(output_path,"wt+") + file.write(template) + file.close() + log.info("Manual written to: " + os.path.realpath(file.name)) diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..462389c --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,14 @@ + +mkdocs-with-pdf +mkdocs-material +mdx_gh_links +mkdocs-pdf-export-plugin +mkdocstrings-python +mkdocs-video +mkdocs-redirects +mkdocs-enumerate-headings-plugin +mkdocs-git-revision-date-localized-plugin +# needed for the create-uuid.py helper script +shortuuid +# Needed for mkdocstrings python documentation generator +black diff --git a/docs/src/about/code-of-conduct.md b/docs/src/about/code-of-conduct.md new file mode 100644 index 0000000..70911b9 --- /dev/null +++ b/docs/src/about/code-of-conduct.md @@ -0,0 +1,86 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Contributor covenant code of conduct + +## Our pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our standards + +Examples of behaviour that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behaviour by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behaviour and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behaviour. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behaviour may be +reported by contacting the project team. All complaints will be reviewed and +investigated and will result in a response that is deemed necessary and +appropriate to the circumstances. The project team is obligated to maintain +confidentiality with regard to the reporter of an incident. Further details of +specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org diff --git a/docs/src/about/contributing.md b/docs/src/about/contributing.md new file mode 100644 index 0000000..44ff38a --- /dev/null +++ b/docs/src/about/contributing.md @@ -0,0 +1,147 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Contributing to [PROJECT_NAME] + +First off, thanks for taking the time to contribute! 🎉 😘 ✨ + +The following is a set of guidelines for contributing to this project. +These are mostly guidelines, not rules. Use your best judgment, and +feel free to propose changes to this document in a pull request. + +## Reporting bugs + +Bugs are tracked as GitHub issues. Search the list and try reproduce on your +local machine with a clean profile before you create an issue. +When you create an issue, please provide the following information by filling +in the template. + +Explain the problem and include additional details to help maintainers reproduce the problem: + +* **Use a clear and descriptive title** for the issue to identify the problem. +* **Describe the exact steps which reproduce the problem** in as many details + as possible. Don't just say what you did, but explain how you did it. For + example, if you moved the cursor to the end of a line, explain if you used a + mouse or a keyboard. +* **Provide specific examples to demonstrate the steps.** Include links to + files or GitHub projects, or copy/paste-able snippets, which you use in those + examples. If you're providing snippets on the issue, use Markdown code blocks. +* **Describe the behaviour you observed after following the steps** and point + out what exactly is the problem with that behaviour. +* **Explain which behaviour you expected to see instead and why.** +* **Include screenshots and animated GIFs** which show you following the + described steps and clearly demonstrate the problem. + +## Suggesting enhancements + +In case you want to suggest an enhancement, please follow this guideline to +help maintainers and the community understand your suggestion. +Before creating suggestions, please check [issue +list](https://github.com/project-name/repository/labels/feature) if +there's already a request. + +Create an issue and provide the following information: + +* **Use a clear and descriptive title** for the issue to identify the + suggestion. +* **Provide a step-by-step description of the suggested enhancement** in as + many details as possible. +* **Provide specific examples to demonstrate the steps.** Include + copy/paste-able snippets which you use in those examples, as Markdown code + blocks. +* **Include screenshots and animated GIFs** which helps demonstrate the steps + or point out the part of project which the suggestion is related to. +* **Explain why this enhancement would be useful** to most users. +* **List some other text editors or applications where this enhancement + exists.** + +## First code contribution + +Unsure where to begin contributing? You can start by looking +through these `document`, `good first issue` and `help wanted` issues: + +* **document issues**: issues which should be reviewed or improved. +* **good first issues**: issues which should only require a few lines of code, + and a test or two. +* **help wanted issues**: issues which should be a bit more involved than + beginner issues. + +## Pull requests + +### Development workflow + +* Set up your development environment +* Make change from a right branch +* Be sure the code passes tests +* Make a pull request + +### Development environment + +* Prepare your machine and it's packages installed. +* Checkout our repository +* Install dependencies by `pip install -r REQUIREMENTS-dev.txt` + +### Make changes + +#### Checkout a branch + +* **master**: PR Base branch. +* **production**: lastest release branch with distribution files. Never make a PR on this. +* **gh-pages**: API docs, examples and demo + +#### Check code style + +Run the pylance extension and make sure all the tests pass. + +#### Test + +Run `TODO` and verify all the tests pass. +If you are adding new commands or features, they must include tests. +If you are changing functionality, update the tests if you need to. + +#### Commit + +Follow our [commit message conventions](../developer/guide/templates/commit-message-convention.md). + +### Yes! Pull request + +Make your pull request, then describe your changes. + +#### Title + +Follow other PR title format on below. + +``` + : Short Description (fix #111) + : Short Description (fix #123, #111, #122) + : Short Description (ref #111) +``` + +* capitalize first letter of Type +* use present tense: 'change' not 'changed' or 'changes' + +#### Description + +If it has related issues, add links to the issues(like `#123`) in the description. +Fill in the [Pull Request Template](../developer/guide/templates/pull-request-template.md) by check your case. + +## Code of conduct + +This project and everyone participating in it is governed by the [Code of +Conduct](code-of-conduct.md). By participating, you are expected to uphold this +code. Please report unacceptable behaviour to tim@kartoza.com. + +> This guide is based on [atom contributing +guide](https://github.com/atom/atom/blob/master/CONTRIBUTING.md), +[CocoaPods](http://guides.cocoapods.org/contributing/contribute-to-cocoapods.html) +and [ESLint](http://eslint.org/docs/developer-guide/contributing/pull-requests) diff --git a/docs/src/about/disclaimer.md b/docs/src/about/disclaimer.md new file mode 100644 index 0000000..7a0ded5 --- /dev/null +++ b/docs/src/about/disclaimer.md @@ -0,0 +1,17 @@ +--- +title: GeoSight-OS Documentation Home +summary: GeoSight is UNICEF's geospatial web-based business intelligence platform. + - Tim Sutton + - Irwan Fathurrahman +date: 2023-08-03 +some_url: https://github.com/unicef-drp/GeoSight-OS +copyright: Copyright 2023, Unicef +contact: geosight-no-reply@unicef.org +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Disclaimer + + +Disclaimer about project. diff --git a/docs/src/about/img/naming-convention.README b/docs/src/about/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/about/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/about/index.md b/docs/src/about/index.md new file mode 100644 index 0000000..90c006b --- /dev/null +++ b/docs/src/about/index.md @@ -0,0 +1,35 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# About + +## License + +Published under AGPL-3. See the [full license](license.md) text. + +## Contributors + + +| Contributor | GitHub Handle | | +| ----------- | ------------- |-| +| Hugh Mann| [NotARobot]() | “” | +| Tim Sutton | [timlinux](https://github.com/timlinux) | “” | + +## Project funders/backers + +This project was conceptualized and initially funded by [FUNDER_1](). + +## Logos + +Another fine project contributed to by: [Kartoza.com](https://kartoza.com) +![Kartoza Logo](../img/KartozaLogo-320x132.png) diff --git a/docs/src/about/license.md b/docs/src/about/license.md new file mode 100644 index 0000000..4ef32f0 --- /dev/null +++ b/docs/src/about/license.md @@ -0,0 +1,651 @@ +GNU Affero General Public License +================================= + +_Version 3, 19 November 2007_ +_Copyright © 2007 Free Software Foundation, Inc. <>_ + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +## Preamble + +The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +Developers that use our General Public Licenses protect your rights +with two steps: **(1)** assert copyright on the software, and **(2)** offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + +A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + +The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + +An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + +The precise terms and conditions for copying, distribution and +modification follow. + +## TERMS AND CONDITIONS + +### 0. Definitions + +“This License” refers to version 3 of the GNU Affero General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this +License. Each licensee is addressed as “you”. “Licensees” and +“recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a “modified version” of the +earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based +on the Program. + +To “propagate” a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” +to the extent that it includes a convenient and prominently visible +feature that **(1)** displays an appropriate copyright notice, and **(2)** +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +### 1. Source Code + +The “source code” for a work means the preferred form of the work +for making modifications to it. “Object code” means any non-source +form of a work. + +A “Standard Interface” means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other +than the work as a whole, that **(a)** is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and **(b)** serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +“Major Component”, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +### 2. Basic Permissions + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +### 3. Protecting Users' Legal Rights From Anti-Circumvention Law + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +### 4. Conveying Verbatim Copies + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +### 5. Conveying Modified Source Versions + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +* **a)** The work must carry prominent notices stating that you modified +it, and giving a relevant date. +* **b)** The work must carry prominent notices stating that it is +released under this License and any conditions added under section 7. +This requirement modifies the requirement in section 4 to +“keep intact all notices”. +* **c)** You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. +* **d)** If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +“aggregate” if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +### 6. Conveying Non-Source Forms + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +* **a)** Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. +* **b)** Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either **(1)** a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or **(2)** access to copy the +Corresponding Source from a network server at no charge. +* **c)** Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. +* **d)** Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. +* **e)** Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A “User Product” is either **(1)** a “consumer product”, which means any +tangible personal property which is normally used for personal, family, +or household purposes, or **(2)** anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, “normally used” refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +### 7. Additional Terms + +“Additional permissions” are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +* **a)** Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or +* **b)** Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or +* **c)** Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or +* **d)** Limiting the use for publicity purposes of names of licensors or +authors of the material; or +* **e)** Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or +* **f)** Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered “further +restrictions” within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +### 8. Termination + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated **(a)** +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and **(b)** permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +### 9. Acceptance Not Required for Having Copies + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +### 10. Automatic Licensing of Downstream Recipients + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +### 11. Patents + +A “contributor” is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, “control” includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To “grant” such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either **(1)** cause the Corresponding Source to be so +available, or **(2)** arrange to deprive yourself of the benefit of the +patent license for this particular work, or **(3)** arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. “Knowingly relying” means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is “discriminatory” if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license **(a)** in connection with copies of the covered work +conveyed by you (or copies made from those copies), or **(b)** primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +### 12. No Surrender of Others' Freedom + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +### 13. Remote Network Interaction; Use with the GNU General Public License + +Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + +### 14. Revised Versions of this License + +The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License “or any later version” applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +### 15. Disclaimer of Warranty + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +### 16. Limitation of Liability + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +### 17. Interpretation of Sections 15 and 16 + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +_END OF TERMS AND CONDITIONS_ + +## How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the “copyright” line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a “Source” link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a “copyright disclaimer” for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +<>. diff --git a/docs/src/about/running-instances.md b/docs/src/about/running-instances.md new file mode 100644 index 0000000..02f2866 --- /dev/null +++ b/docs/src/about/running-instances.md @@ -0,0 +1,14 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Examples of running instances diff --git a/docs/src/administrator/guide/img/naming-convention.README b/docs/src/administrator/guide/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/administrator/guide/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/administrator/guide/index.md b/docs/src/administrator/guide/index.md new file mode 100644 index 0000000..39c4a49 --- /dev/null +++ b/docs/src/administrator/guide/index.md @@ -0,0 +1,16 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +context_id: 1234 +--- + +# Administrator guide + + diff --git a/docs/src/administrator/img/naming-convention.README b/docs/src/administrator/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/administrator/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/administrator/index.md b/docs/src/administrator/index.md new file mode 100644 index 0000000..b11a89f --- /dev/null +++ b/docs/src/administrator/index.md @@ -0,0 +1,22 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# For administrators + + +This is the homepage for all administrator related documentation. + +The content is divided into two sections: + +* The [user guide](guide/index.md), which describes common workflows for system administrators in a tutorial format. +* The [user manual](manual/index.md), which describes each page of the admin user interface and what the various options on that page do. diff --git a/docs/src/administrator/manual/img/naming-convention.README b/docs/src/administrator/manual/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/administrator/manual/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/administrator/manual/index.md b/docs/src/administrator/manual/index.md new file mode 100644 index 0000000..5b1b668 --- /dev/null +++ b/docs/src/administrator/manual/index.md @@ -0,0 +1,15 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Administrator manual + diff --git a/docs/src/developer/api/guide/img/naming-convention.README b/docs/src/developer/api/guide/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/developer/api/guide/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/developer/api/guide/index.md b/docs/src/developer/api/guide/index.md new file mode 100644 index 0000000..69a635c --- /dev/null +++ b/docs/src/developer/api/guide/index.md @@ -0,0 +1,15 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# API guide + diff --git a/docs/src/developer/api/img/naming-convention.README b/docs/src/developer/api/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/developer/api/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/developer/api/index.md b/docs/src/developer/api/index.md new file mode 100644 index 0000000..882f520 --- /dev/null +++ b/docs/src/developer/api/index.md @@ -0,0 +1,19 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# API documentation + +This is the homepage for all API related documentation. + +* The [api guide](./guide/index.md), which describes common workflows for using the restful API. +* The [api manual](./manual/index.md), which describes each API endpoint and its parameters, return values etc. This section is autogenerated. diff --git a/docs/src/developer/api/manual/img/naming-convention.README b/docs/src/developer/api/manual/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/developer/api/manual/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/developer/api/manual/index.md b/docs/src/developer/api/manual/index.md new file mode 100644 index 0000000..164ea99 --- /dev/null +++ b/docs/src/developer/api/manual/index.md @@ -0,0 +1,15 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# API manual + diff --git a/docs/src/developer/documentation/context-help.md b/docs/src/developer/documentation/context-help.md new file mode 100644 index 0000000..a0e225e --- /dev/null +++ b/docs/src/developer/documentation/context-help.md @@ -0,0 +1,131 @@ +--- +title: GeoSight-OS Documentation Context Help +summary: GeoSight is UNICEF's geospatial web-based business intelligence platform. + - Tim Sutton + - Irwan Fathurrahman +date: 2023-08-03 +some_url: https://github.com/unicef-drp/GeoSight-OS +copyright: Copyright 2023, Unicef +contact: geosight-no-reply@unicef.org +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Context Help + +This section describes how the context help system works. + +## Overview + +The context help system provides an integration between the web application and the documentation. + +![](img/context-help-1.png) + +The following concepts are used: + +- **Site:** This is the area for globally setting options relating to the context help system. +- **Blocks:** These are small components displayed as blocks 1️⃣ in the context help panel. Each block links to a section in the help documentation. ![](img/context-help-2.png) +- **Pages:** These are context help panels that are each linked to a particular URL in the application. ![](img/context-help-3.png) +- **Page Blocks:** These are links between pages and their constituent blocks. Each page can have many blocks and each block can be used in many pages. + +## Triggering context help + +There are three ways to trigger context help: + +1. From the top nav bar 1️⃣ ![image.png](img/context-help-4.png) +2. From the side panel 1️⃣ ![image.png](img/context-help-5.png) +3. Next to widgets (not implemented yet) + +## Managing context help + +We manage the context help system from django admin. You need to be a staff user to do this and have been granted read/write/update permissions on the documentation center related tables. First open your user menu 1️⃣ and then the Django Admin area 2️⃣. + +![image.png](img/context-help-6.png) + +Next we can drill into the documentation center to see only the relevant admin activities 1️⃣. + +![image.png](img/context-help-7.png) + +## Site preferences + +Our first activity is to edit the site preferences 1️⃣. + +![image.png](img/context-help-8.png) + +Here our goal is to set the documentation base url for the context help system 1️⃣. Use the URL for your documentation project i.e. https://unicef-drp.github.io/GeoSight-OS + +![image.png](img/context-help-9.png) + +## Managing Pages + +Next we need to create pages for each application end point where we want to include context sensitive help. First select pages 1️⃣ from the documentation center menu: + +![image.png](img/context-help-10.png) + +Now you can edit an existing page 1️⃣ or add a new one 2️⃣: + +![image.png](img/context-help-11.png) + +The page properties you can set are going to determine how the context help panel appears in the application when triggering the help panel 1️⃣: + +![image.png](img/context-help-13.png) + +Here is a detailed breakdown of the options: + +1️⃣ **Name:** A symbolic name for you to easily recognise what the context help is about + +2️⃣ **Relative page url:** This is the relative path to our application page (see underline in image above) e.g. /admin/importer/ + +3️⃣ **Url:** This is where the documentation is, relative to the documentation base URL. For example if your docs base URL is at: https://unicef-drp.github.io/GeoSight-OS/ your help context document relative URL is /administrator/guide/. This will trigger the content panel link 3️⃣ above to point to this page. + +4️⃣ **Title:** This will be displayed as 1️⃣ above in the context help panel. + +5️⃣ **Intro:** This will be shown as lead-in text for the context help panel. See 2️⃣ above. + +![image.png](img/context-help-12.png) + +On the page form you can also manage the blocks that appear in the context help. + +## Managing blocks + +You can view and manage existing blocks from the documentation center 1️⃣ or add a new block 2️⃣. We first create a block then go back to the page to add it to the page. + +![image.png](img/context-help-14.png) + +We can also create a new block directly from within a page. + +- To set a block link within the page use 1️⃣ +- To set the order in which the block appears in the help panel use 2️⃣. For ordering, lower number blocks will be listed before higher number blocks. It is up to you to ensure that each number used for ordering is unique. +- To create a new block component for a page, use 3️⃣ and then go and choose or create the actual block content. + +![image.png](img/context-help-15.png) + +Let's create a new block within the context of an existing page (this is the more normal workflow). + +![image.png](img/context-help-16.png) + +Because we have created it within the page form, the block form appears as a popup window. We can deal with the form components as follows: + +- **The relative url** 1️⃣ (based on the the documentation site wide base url preference) to the documentation page +- **The anchor** 2️⃣ - this is optional and should point to a heading / subheading within the page if populated. +- **The title 3️⃣** - title for the block. This is automatically filled in from the page unless you specify an override title. Normally you would leave this blank. +- **The thumbnail 4️⃣** for the block. This is automatically linked to the first image below the anchor in the help document. Usually you would leave this blank. +- **Description 5️⃣** for the block. This will be automatically populated from the first paragraph in the linked help documentation. + +⚠️ As you can see, the block definition requires only minimal information - the URL and optionally the anchor on the page. Anything else you specify here will override information harvested from the page and likely make your documentation more difficult to maintain. + +![image.png](img/context-help-17.png) + +## Page Blocks + +Generally we will not directly use the PageBlocks management area - use the Page manager to add and remove blocks from your page. + +## Conclusion and notes + +The system for context help has been designed in a generic way. That means that you can use any web site where you can reference content with page links and anchors. + +⛔️ One word of caution. Do not use a web site as your documentation source if you do not control that site. The content from the help site is pulled directly into your application, which could put you in a compromising position if the content is not 'on message' for your organisation. + + + + diff --git a/docs/src/developer/documentation/easy-workflow.md b/docs/src/developer/documentation/easy-workflow.md new file mode 100644 index 0000000..066d338 --- /dev/null +++ b/docs/src/developer/documentation/easy-workflow.md @@ -0,0 +1,91 @@ +--- +title: GeoSight-OS Documentation Home +summary: GeoSight is UNICEF's geospatial web-based business intelligence platform. + - Tim Sutton + - Irwan Fathurrahman +date: 2023-08-03 +some_url: https://github.com/unicef-drp/GeoSight-OS +copyright: Copyright 2023, Unicef +contact: geosight-no-reply@unicef.org +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Documentation Overview + +This document describes the easiest workflow for editing documentation. + +Requirements: + +1. You need to have a GitHub account and be logged in to your account +2. You need to have been given access to the repo by the repo manager + +## General Workflow + +1. Go to the repo for the documentation. +2. Press the ``.`` key on your keyboard. +3. Select a file under the src folder to edit +4. Press Ctrl-S to save your work. +5. Go to the Source Control tab to commit your work. +6. Add a short, descriptive comment describing your changes. +7. Press the ``Commit and push`` button. +8. Wait a few minutes and your changes should be published live. + +## Adding a new page + +Any new page you create needs to be also added to ```mkdocs-base.yml``` so that it gets 'built. +If you wish to build a page but not have it in the menu system, you can give it a blank menu description e.g. + +``` +# Pages to render but exclude from navigation +- "": developer/guide/templates/pull-request-template.md +``` + +Conversely, to ensure it is shown in the menu, find the right place in the navigation tree and then insert it with a short descriptor. e.g. + +``` +# Pages to render and include from navigation +- "My Menu Item": developer/guide/my-page.md +``` + +## Adding images + +You can easily upload images into the documentation sources and then add them to your document. + +1. Take an image using your favourite screenshot tool. +2. Using your file manager, drag the file from your desktop into the img folder in the relevant part of the documentation you are working on. +3. ``Shift+Drag`` the image into your markdown document. +4. Edit the image description (the part in square brackets) + + +## Adding links + +You can add a link to any text by doing the following: + +1. Copy the link from your web browser to your clipboard. +2. Either + 2.1 Past the link directly into the document sources. + 2.2 or, write some words ine square brackets and paste the link in round brackets after, VSCode will create a markdown formatted link. + +This is a normal link https://staging-geosight.unitst.org/, [this is a link](https://staging-geosight.unitst.org/). + +The above in markdown: + +``` +This is a normal link https://staging-geosight.unitst.org/, [this is a link](https://staging-geosight.unitst.org/). + +``` + +## Page previews + +You can easily preview the page you are working on by doing this: + +1. Press ``Ctl-Shift-V`` to open a preview of the page you are currently working in. +2. Drag and drop the preview tab to the right side of the editing environment for a side-by-side view. + +## Leaving the editor viewer + +How to leave the interactive editor. + +1. Click the 'hamburger' menu and go to the repository. +2. Wait a few moments and the 'normal' GitHub page will load. \ No newline at end of file diff --git a/docs/src/developer/documentation/img/check-branch.png b/docs/src/developer/documentation/img/check-branch.png new file mode 100644 index 0000000..1955d1d Binary files /dev/null and b/docs/src/developer/documentation/img/check-branch.png differ diff --git a/docs/src/developer/documentation/img/context-help-1.png b/docs/src/developer/documentation/img/context-help-1.png new file mode 100644 index 0000000..ed08203 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-1.png differ diff --git a/docs/src/developer/documentation/img/context-help-10.png b/docs/src/developer/documentation/img/context-help-10.png new file mode 100644 index 0000000..855c0cf Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-10.png differ diff --git a/docs/src/developer/documentation/img/context-help-11.png b/docs/src/developer/documentation/img/context-help-11.png new file mode 100644 index 0000000..d1c3b95 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-11.png differ diff --git a/docs/src/developer/documentation/img/context-help-12.png b/docs/src/developer/documentation/img/context-help-12.png new file mode 100644 index 0000000..3c0b349 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-12.png differ diff --git a/docs/src/developer/documentation/img/context-help-13.png b/docs/src/developer/documentation/img/context-help-13.png new file mode 100644 index 0000000..4c00432 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-13.png differ diff --git a/docs/src/developer/documentation/img/context-help-14.png b/docs/src/developer/documentation/img/context-help-14.png new file mode 100644 index 0000000..1240ac1 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-14.png differ diff --git a/docs/src/developer/documentation/img/context-help-15.png b/docs/src/developer/documentation/img/context-help-15.png new file mode 100644 index 0000000..907c517 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-15.png differ diff --git a/docs/src/developer/documentation/img/context-help-16.png b/docs/src/developer/documentation/img/context-help-16.png new file mode 100644 index 0000000..f1f42c8 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-16.png differ diff --git a/docs/src/developer/documentation/img/context-help-17.png b/docs/src/developer/documentation/img/context-help-17.png new file mode 100644 index 0000000..0d07e78 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-17.png differ diff --git a/docs/src/developer/documentation/img/context-help-2.png b/docs/src/developer/documentation/img/context-help-2.png new file mode 100644 index 0000000..71344c0 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-2.png differ diff --git a/docs/src/developer/documentation/img/context-help-3.png b/docs/src/developer/documentation/img/context-help-3.png new file mode 100644 index 0000000..19e75a1 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-3.png differ diff --git a/docs/src/developer/documentation/img/context-help-4.png b/docs/src/developer/documentation/img/context-help-4.png new file mode 100644 index 0000000..dadb859 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-4.png differ diff --git a/docs/src/developer/documentation/img/context-help-5.png b/docs/src/developer/documentation/img/context-help-5.png new file mode 100644 index 0000000..baa76a0 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-5.png differ diff --git a/docs/src/developer/documentation/img/context-help-6.png b/docs/src/developer/documentation/img/context-help-6.png new file mode 100644 index 0000000..d2d6453 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-6.png differ diff --git a/docs/src/developer/documentation/img/context-help-7.png b/docs/src/developer/documentation/img/context-help-7.png new file mode 100644 index 0000000..fd32afc Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-7.png differ diff --git a/docs/src/developer/documentation/img/context-help-8.png b/docs/src/developer/documentation/img/context-help-8.png new file mode 100644 index 0000000..02bd567 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-8.png differ diff --git a/docs/src/developer/documentation/img/context-help-9.png b/docs/src/developer/documentation/img/context-help-9.png new file mode 100644 index 0000000..c4ba5d5 Binary files /dev/null and b/docs/src/developer/documentation/img/context-help-9.png differ diff --git a/docs/src/developer/documentation/img/edit-navigation-1.png b/docs/src/developer/documentation/img/edit-navigation-1.png new file mode 100644 index 0000000..33f76ec Binary files /dev/null and b/docs/src/developer/documentation/img/edit-navigation-1.png differ diff --git a/docs/src/developer/documentation/img/edit-navigation-2.png b/docs/src/developer/documentation/img/edit-navigation-2.png new file mode 100644 index 0000000..dffd480 Binary files /dev/null and b/docs/src/developer/documentation/img/edit-navigation-2.png differ diff --git a/docs/src/developer/documentation/img/edit-navigation-3.png b/docs/src/developer/documentation/img/edit-navigation-3.png new file mode 100644 index 0000000..baf29c4 Binary files /dev/null and b/docs/src/developer/documentation/img/edit-navigation-3.png differ diff --git a/docs/src/developer/documentation/img/edit-navigation-4.png b/docs/src/developer/documentation/img/edit-navigation-4.png new file mode 100644 index 0000000..bfb762d Binary files /dev/null and b/docs/src/developer/documentation/img/edit-navigation-4.png differ diff --git a/docs/src/developer/documentation/img/fork-repo-1.png b/docs/src/developer/documentation/img/fork-repo-1.png new file mode 100644 index 0000000..b5b30f5 Binary files /dev/null and b/docs/src/developer/documentation/img/fork-repo-1.png differ diff --git a/docs/src/developer/documentation/img/fork-repo-2.png b/docs/src/developer/documentation/img/fork-repo-2.png new file mode 100644 index 0000000..3c49701 Binary files /dev/null and b/docs/src/developer/documentation/img/fork-repo-2.png differ diff --git a/docs/src/developer/documentation/img/html-workflow.png b/docs/src/developer/documentation/img/html-workflow.png new file mode 100644 index 0000000..cdd6f39 Binary files /dev/null and b/docs/src/developer/documentation/img/html-workflow.png differ diff --git a/docs/src/developer/documentation/img/naming-convention.README b/docs/src/developer/documentation/img/naming-convention.README new file mode 100644 index 0000000..b7fd046 --- /dev/null +++ b/docs/src/developer/documentation/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/developer/documentation/img/new-file-1.png b/docs/src/developer/documentation/img/new-file-1.png new file mode 100644 index 0000000..4d1a2f2 Binary files /dev/null and b/docs/src/developer/documentation/img/new-file-1.png differ diff --git a/docs/src/developer/documentation/img/new-file-2.png b/docs/src/developer/documentation/img/new-file-2.png new file mode 100644 index 0000000..27932ea Binary files /dev/null and b/docs/src/developer/documentation/img/new-file-2.png differ diff --git a/docs/src/developer/documentation/img/new-file-3.png b/docs/src/developer/documentation/img/new-file-3.png new file mode 100644 index 0000000..b62d765 Binary files /dev/null and b/docs/src/developer/documentation/img/new-file-3.png differ diff --git a/docs/src/developer/documentation/img/new-file-4.png b/docs/src/developer/documentation/img/new-file-4.png new file mode 100644 index 0000000..cd5034b Binary files /dev/null and b/docs/src/developer/documentation/img/new-file-4.png differ diff --git a/docs/src/developer/documentation/img/pdf-workflow.png b/docs/src/developer/documentation/img/pdf-workflow.png new file mode 100644 index 0000000..416d418 Binary files /dev/null and b/docs/src/developer/documentation/img/pdf-workflow.png differ diff --git a/docs/src/developer/documentation/img/pull-request-1.png b/docs/src/developer/documentation/img/pull-request-1.png new file mode 100644 index 0000000..f8a4776 Binary files /dev/null and b/docs/src/developer/documentation/img/pull-request-1.png differ diff --git a/docs/src/developer/documentation/img/pull-request-2.png b/docs/src/developer/documentation/img/pull-request-2.png new file mode 100644 index 0000000..123f29f Binary files /dev/null and b/docs/src/developer/documentation/img/pull-request-2.png differ diff --git a/docs/src/developer/documentation/img/upload-img-1.png b/docs/src/developer/documentation/img/upload-img-1.png new file mode 100644 index 0000000..6fb165e Binary files /dev/null and b/docs/src/developer/documentation/img/upload-img-1.png differ diff --git a/docs/src/developer/documentation/img/upload-img-2.png b/docs/src/developer/documentation/img/upload-img-2.png new file mode 100644 index 0000000..80ae899 Binary files /dev/null and b/docs/src/developer/documentation/img/upload-img-2.png differ diff --git a/docs/src/developer/documentation/img/upload-img-3.png b/docs/src/developer/documentation/img/upload-img-3.png new file mode 100644 index 0000000..569e2c0 Binary files /dev/null and b/docs/src/developer/documentation/img/upload-img-3.png differ diff --git a/docs/src/developer/documentation/img/upload-img-4.png b/docs/src/developer/documentation/img/upload-img-4.png new file mode 100644 index 0000000..e11ce48 Binary files /dev/null and b/docs/src/developer/documentation/img/upload-img-4.png differ diff --git a/docs/src/developer/documentation/img/web-editor-1.png b/docs/src/developer/documentation/img/web-editor-1.png new file mode 100644 index 0000000..43adf54 Binary files /dev/null and b/docs/src/developer/documentation/img/web-editor-1.png differ diff --git a/docs/src/developer/documentation/img/web-editor-2.png b/docs/src/developer/documentation/img/web-editor-2.png new file mode 100644 index 0000000..d3300c3 Binary files /dev/null and b/docs/src/developer/documentation/img/web-editor-2.png differ diff --git a/docs/src/developer/documentation/img/web-editor-3.png b/docs/src/developer/documentation/img/web-editor-3.png new file mode 100644 index 0000000..9d48cdb Binary files /dev/null and b/docs/src/developer/documentation/img/web-editor-3.png differ diff --git a/docs/src/developer/documentation/img/web-editor-4.png b/docs/src/developer/documentation/img/web-editor-4.png new file mode 100644 index 0000000..84c9a0f Binary files /dev/null and b/docs/src/developer/documentation/img/web-editor-4.png differ diff --git a/docs/src/developer/documentation/img/web-editor-5.png b/docs/src/developer/documentation/img/web-editor-5.png new file mode 100644 index 0000000..ab3793f Binary files /dev/null and b/docs/src/developer/documentation/img/web-editor-5.png differ diff --git a/docs/src/developer/documentation/img/web-editor-6.png b/docs/src/developer/documentation/img/web-editor-6.png new file mode 100644 index 0000000..c21a126 Binary files /dev/null and b/docs/src/developer/documentation/img/web-editor-6.png differ diff --git a/docs/src/developer/documentation/img/web-editor-7.png b/docs/src/developer/documentation/img/web-editor-7.png new file mode 100644 index 0000000..4f758d7 Binary files /dev/null and b/docs/src/developer/documentation/img/web-editor-7.png differ diff --git a/docs/src/developer/documentation/index.md b/docs/src/developer/documentation/index.md new file mode 100644 index 0000000..dfd36d6 --- /dev/null +++ b/docs/src/developer/documentation/index.md @@ -0,0 +1,20 @@ +--- +title: GeoSight-OS Documentation Home +summary: GeoSight is UNICEF's geospatial web-based business intelligence platform. + - Tim Sutton + - Irwan Fathurrahman +date: 2023-08-03 +some_url: https://github.com/unicef-drp/GeoSight-OS +copyright: Copyright 2023, Unicef +contact: geosight-no-reply@unicef.org +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Documentation + + +In this section of the documentation, we explain how to work with the documentation. The content is organised as follows: + +* **[Overview:](./overview.md)** Here we outline the documentation system and the standard workflows needed. +* **[Context help:](./context-help.md)** Here we outline the procedure for adding context help into the application and linking it to this documentation tree. diff --git a/docs/src/developer/documentation/overview.md b/docs/src/developer/documentation/overview.md new file mode 100644 index 0000000..066731d --- /dev/null +++ b/docs/src/developer/documentation/overview.md @@ -0,0 +1,210 @@ +--- +title: GeoSight-OS Documentation Home +summary: GeoSight is UNICEF's geospatial web-based business intelligence platform. + - Tim Sutton + - Irwan Fathurrahman +date: 2023-08-03 +some_url: https://github.com/unicef-drp/GeoSight-OS +copyright: Copyright 2023, Unicef +contact: geosight-no-reply@unicef.org +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Documentation Overview + +This section provides an overview of how the documentation system works. + +## Background + +Welcome to the instructions for those wishing to contribute to our documentation! + +Our documentation system is based on the popular [mkdocs](https://www.mkdocs.org/) system. We encourage you to read the upstream documentation from mkdocs for the finer details of how mkdocs. In particular, read [this page](https://www.mkdocs.org/user-guide/writing-your-docs/) before you get to work. Mkdocs is not hard, but it may feel initially a little different if you are used to creating your documentation in word. + +We use mkdocs because it has some great and useful features. Most especially: + +* The code and the documentation are versioned together. This means that for whatever version of the code we have in our production release, we can be sure the documentation matches that release. We can also look back at changes over time through the version history when needed. +* It can render beautiful static (not needing a backend server) web sites with great features like search, styling, intuitive navigation etc. +* It can optionally render PDF documents from the same source markdown. +* An ecosystem of plugins and themes makes mkdocs really flexible and extensible. + +### Some terminology + +In our documentation, we have organised the information using a specific nomenclature: + +* **guide**: A guide is a multi-step workflow / tutorial that leads your through common activities. +* **manual**: A collection of documents that describe each part of the project in a matter of fact way without presupposing any specific workflow is being undertaken. + +For each of the main topic areas (user, admin, developer, devops, api user) we provide guides and manuals as is appropriate. + +### Organisation + +The documentation is broadly organised in the following structure. This structure may change over time as sections are added / moved / removed: + +``` +src +├── about +├── administrator +│ ├── guide +│ └── manual +├── developer +│ ├── documentation +│ ├── guide +│ └── manual +├── devops +│ ├── guide +│ └── manual +└── user + ├── api + ├── guide + ├── manual + └── quickstart +``` + +## File naming conventions + +Please follow these conventions when writing your documentation: + +1. Write file names in all lower case, with hyphens separating words (no spaces). e.g. ``important-file.md`` not ``Important File.md`` or other deviations. +2. Place the image files in the img folder adjacent to your content. +3. Do not abbreviate any words in file names - but try to use terse, descriptive names. +4. Place your content into the appropriate place as outline in the structure above. +5. Each file should only one level one heading e.g. ``# Page title`` +6. Headings and subheadings should be written as a terse phrase starting with a capital letter and subsequent words in lower case unless they are proper nouns. Do not place a colon after the heading. +7. Use unicode number markers to reference numbers in images e.g. 1️⃣ +8. Every heading / sub-heading should have a single line underneath it summarising the content that will follow. This sentence will be used in the help center in the application to give the user a reference point for the text that will follow. It also makes the help text more consistent and readable. +9. For every section that images, the first image will be used as the thumbnail if the heading is referenced from the application. + +## Contributing to the documentation + +:pencil2: Note: The repo name in the images below is blurred out, you should work against the GeoRepo-OS repository when following these notes. + +To start adding to the documentation navigate to the [home page](https://github.com/unicef-drp/GeoRepo-OS) of the repository. + +Once on the repository home page, 1️⃣ click on Fork +![Fork Repository 1](img/fork-repo-1.png) + +On the next page 1️⃣ Make sure your github account is selected as the owner and 2️⃣ make sure the "**Copy the** `main` **branch only**" option is ticked as you will only need the main branch. +![Fork Repository 2](img/fork-repo-2.png) + +Once you have forked the repository, ensure that you are working in the main branch. +![Change Branch](img/check-branch.png) + +Once you are in your fork of the repository, click on `.` on your keyboard. This will open a web editor where you can begin adding to, or editing, the documentation. +![Web Editor 1](img/web-editor-1.png) + +Once the editor loads, you will be greeted by 1️⃣ a preview of the project's README.txt. 2️⃣ Click on the `docs` directory in the menu on the left, this will expand the directory. To confirm that you are working in the right branch 3️⃣️ it will say `main` in the bottom left of the editor. +![Web Editor 2](img/web-editor-2.png) + +Once you have expanded the `docs` directory, 1️⃣ click on the `src` directory. All sub-directories within the `src` directory contain the files that become the documentation. Each sub-directory contains an `index.md` file that is required for the building of the documentation and static site. If you add a new sub-directory into any folder it must also contain a populated `index.md` file. +![Web Editor 3](img/web-editor-3.png){: style="height:300px"} + +Once you have chosen which section of documentation you would like to edit (e.g. user/guide/index.md), click on the file and it will open in the web editor. +![Web Editor 4](img/web-editor-4.png) + +Once you have the file open, you can start adding to the documentation using [Markdown](https://www.markdownguide.org/) syntax. If you need to add images to your documentation, add them to the relative `img` sub-directories following the naming conventions set out in the `naming-convention.README` within the `img` folders. +![Web Editor 5](img/web-editor-5.png) + +When you have completed making additions to (or editing) the documentation, 1️⃣ click on the source control tab then 2️⃣ click on the `plus` symbol next to the changes you are finished with to stage them, 3️⃣️ add a commit message that is associated with the work you have done, and the 4️⃣ Click on `Commit & Push` +![Web Editor 6](img/web-editor-6.png) + +Once you have committed your changes, 1️⃣ Click on the burger menu and then 2️⃣ click on `Go To Repository` +![Web Editor 7](img/web-editor-7.png) + +Your fork of the repository will be opened in a new tab within your browser, navigate to that tab. Once there 1️⃣ ensure you are on the `main`, you should see how many commits ahead of the upstream branch you are, then 2️⃣ click on `Contribute`-> `Open pull request`. +![Pull Request 1](img/pull-request-1.png) + +On the next screen, 1️⃣ give your pull request a meaningful title, 2️⃣ give additional details regarding changes made in the larger text box, then 3️⃣️ click on `Create pull request`. Also ensure you are creating a pull request to the upstream `main` branch from your `main` branch. +![Pull Request 2](img/pull-request-2.png) + +Once your pull request is opened you need to wait for it to be merged before you can open a new one. + +## Creating new files + +### Page metadata +Whenever you create a new file, you should add the standard header to the top of the file: + +``` +--- +title: GeoRepo-OS Documentation +summary: GeoRepo is a UNICEF's geospatial web-based data storage and administrative boundary harmonization platform. + - Tim Sutton + - Dimas Tri Ciputra + - Danang Tri Massandy +date: 2023-08-03 +copyright: Copyright 2023, Unicef +contact: georepo-no-reply@unicef.org +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- +``` + +The summary can be updated to include your name for documents you contribute to. + +The context_id is used to create a unique permalink to this document, and is optional. See further down in this document for more details. + +### Navigation + +All pages need to be added to the 'Nav' section of the `mkdocs-base.yml` file. This will ensure that it is available in the menus and that mkdocs renders without errors. For example, if you wish to add a new page to the User Guide area, in Nav you would add a line like this: + + +`- "Navigating the map": users/guide/map-navigation.md` + +Sometimes you may not wish to have the new page displayed in the menu system (this can be useful when, for example, it is accessed via a link in another page. In these cases, leave the menu entry part blank e.g. + +`- "": users/guide/map-navigation.md` + + +Mkdocs will still generate the page but it will not be added to the menu. + + +## Technical notes + +### Working locally + +If you want to work with the documentation locally (i.e. directly on your PC), you need to follow this general process: + +1. Install python +2. Install pip +3. Install virtualenv (`pip install virtualenv`) +4. Make the docs folder your working directory (`cd docs`) +4. Create the virtual env in the docs folder (`python -m venv env`) +5. Activate the venv (`source env/bin/activate`) +5. Install the python modules listed in docs/requirements.txt (`pip install -r requirements.txt`) +6. If you are on Linux or macOS, open the docs directory in a shell and run ``build-docs-html.sh`` +7. In the docs directory, run ``mkdocs serve`` +8. Open your web browser at https://localhost:8000 to view the rendered docs. + +Note that ``mkdocs serve`` will dynamically re-render the docs any time you make a change. The process above is illustrated in the diagram below: + +![](img/html-workflow.png) + +### Hooks + +We implement two hooks (plugins for mkdocs that are invoked during the docs rendering process). + +* **uuid_redirects_hook.py** - this is used to handle page redirects from a uuid - see below for more details +* **python_manual_hook.py** - this is used to auto-generate the reference guide for the python modules, classes and functions that make up the code base for this project. + +### Permalinks for user and admin docs + +If you are a developer, you should be aware of the workflow for creating user and administrator documentation for each page you create. + +Every page should have a help link on it that leads to the appropriate manual page. The workflow for doing this is: + +1. Generate a new page UUID using the provided python utility e.g. ``./create-uuid.py`` +2. Create a new page in the appropriate manual section e.g. ``docs/src/user/manual/login.md`` +3. In the metadata section at the top of the page, add the context id e.g. ``context_id: V4cVEFd2TmwYJVb5HvWRwa`` +4. In your django view, set up your help button to point to the site url and your context id. e.g. ``https://siteurl/V4cVEFd2TmwYJVb5HvWRwa`` + +Whenever the user visits the page using the UUID URL, they will be redirected to the correct page e.g. ``https://siteurl/login/``. This system protects us from file renaming and reorganising on the site, and ensures that the help link will always remain valid. + + +### Generating PDFS + +To generate PDFS, `cd` into `GEOREPO-OS/docs` and then run the `build-docs-pdf` in a local terminal + +### Generating Static Site + +To generate HTML, `cd` into `GEOREPO-OS/docs` and then run the `build-docs-html` in a local terminal. +You can then run `mkdocs serve` to generate the static site on your local host, if there is a port conflict you can specify the port using the `-a` flag e.g `mkdocs serve -a 127.0.0.1:8001`. diff --git a/docs/src/developer/guide/architecture.md b/docs/src/developer/guide/architecture.md new file mode 100644 index 0000000..a0e2b93 --- /dev/null +++ b/docs/src/developer/guide/architecture.md @@ -0,0 +1,54 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# System architecture + +In this section, we outline the system architecture using ER Diagrams, Software Component Diagrams etc. and key libraries / frameworks used in this project. + +## Software components used + + +The following is a list, with brief descriptions, of the key components used in creating this platform. Please refer to their individual documentation for in-depth technical information. + +| Logo | Name | Notes | +|------------|---------|----------------| +|![](https://static.djangoproject.com/img/logos/django-logo-negative.svg){: style="height:30px;width:30px"} | [Django](https://djangoproject.com) | Django makes it easier to build better web apps more quickly and with less code. | +|![File:React-icon.svg - Wikimedia Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/2300px-React-icon.svg.png){: style="height:30px;width:30px"}| [ReactJS](https://react.dev/) | React lets you build user interfaces out of individual pieces called components. Create your own React components like `Thumbnail`, `LikeButton`, and `Video`. Then combine them into entire screens, pages, and apps.| +| ![](img/architecture-material-ui.svg){: style="height:30px;width:30px"} | [MUI](https://mui.com/)| Move faster with intuitive React UI tools. MUI offers a comprehensive suite of free UI tools to help you ship new features faster. Start with Material UI, our fully-loaded component library, or bring your own design system to our production-ready components. | +| ![](img/architecture-docker.svg){: style="height:30px;width:30px"} | [Docker](https://docker.com) | Accelerate how you build, share, and run applications. Docker helps developers build, share, and run applications anywhere — without tedious environment configuration or management. | +| ![](img/architecture-celery.svg){: style="height:30px;width:30px"} | [Celery](https://docs.celeryq.dev) | Celery is a simple, flexible, and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system. It’s a task queue with focus on real-time processing, while also supporting task scheduling. | +| ![](img/architecture-celery.svg){: style="height:30px;width:30px"} | [Celery Beat](https://github.com/celery/django-celery-beat) | This extension enables you to store the periodic task schedule in your database. The periodic tasks can be managed from the Django Admin interface, where you can create, edit and delete periodic tasks and how often they should run. | +| ![](img/architecture-drf.png){: style="height:30px;width:30px"} | [Django Rest Framework](https://www.django-rest-framework.org/) | Django REST framework is a powerful and flexible toolkit for building Web APIs. | +| ![](img/architecture-maplibre-logo.svg){: style="height:30px;width:30px"} | [MapLibre](https://maplibre.org/) | Open-source mapping libraries for web and mobile app developers. | +| ![](img/architecture-deckgl.png){: style="height:30px;width:30px"} | []() | deck.gl is a WebGL-powered framework for visual exploratory data analysis of large datasets. | +| ![](img/architecture-postgis.svg){: style="height:30px;width:30px"} | [PostGIS](https://postgis.net/) | PostGIS extends the capabilities of the PostgreSQL relational database by adding support storing, indexing and querying geographic data. | +| ![](img/architecture-postgresql.png){: style="height:30px;width:30px"} | [PostgreSQL](https://www.postgresql.org/) | PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. | +| ![](img/architecture-tegola.png){: style="height:30px;width:30px"} | [Tegola](https://tegola.io/) | An open source vector tile server written in Go, Tegola takes geospatial data and slices it into vector tiles that can be efficiently delivered to any client. | +| ![](img/architecture-gdal.png){: style="height:30px;width:30px"} | [GDAL](https://gdal.org) | GDAL is a translator library for raster and vector geospatial data formats that is released under an MIT style Open Source License by the Open Source Geospatial Foundation. As a library, it presents a single raster abstract data model and single vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing. | + +## Docker components + +The following diagram represents the docker containers, ports and volumes that are used to compose this platform. + + +![Architecture Docker Diagram]() + +## ER diagram + + +The following diagram represents all of the database entities that are created by the Django ORM (Object Relational Mapper). Right click the image and open it in its own tab to see it at full resolution. + + +![Architecture ERD]() + +🪧 If you already have all of the above criteria met, you can move on to [Prerequisites](prerequisites.md) to start the process of getting your local development environment set up. diff --git a/docs/src/developer/guide/building.md b/docs/src/developer/guide/building.md new file mode 100644 index 0000000..35aea2c --- /dev/null +++ b/docs/src/developer/guide/building.md @@ -0,0 +1,70 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Building the dev environment + +This section covers the process of building and running the application from your IDE. + +🚩 Make sure you have gone through the [IDE Setup Process](ide-setup.md) before following these notes. + +Press `Ctrl -> P` 1️⃣ and then `>`and search for `Rebuild`. Select `Dev Containers: Rebuild and Reopen in Container`2️⃣. This will essentially mount your code tree inside a docker container and switch the development context of VSCode to be inside the container where all of the python etc. dependencies will be installed. + +![image.png](img/building-1.png) + +Once the task is running, a notification 1️⃣ will be shown in the bottom right of the VSCode window. Clicking in the notification will show you the setup progress 2️⃣. Note that this make take quite a while depending on the internet bandwidth you have and the CPU power of your machine. + +![image.png](img/building-2.png) + +## Open a dev container terminal + +Open terminal within the dev container context by clicking the `+`icon in the terminal pane 1️⃣. The new terminal 2️⃣ will show up in the list of running terminals 3️⃣ + +![image.png](img/building-3.png) + +## Install FrontEnd libraries + +``` +make frontend-dev +``` + +![image.png](img/building-4.png) + + +## Run django migration + +``` +cd /home/web/project/django_project +python manage.py migrate +``` + +## Create super user + +``` +cd /home/web/project/django_project +python manage.py createsuperuser +``` + +During this process you will be prompted for your user name (defaults to root), email address and a password (which you need to confirm). Complete these as needed. + + +## Viewing your test instance + +After completing the steps above, you should have the development server available on port 2000 of your local host: + +``` +http://localhost:2000 +``` + +![image.png](img/building-5.png) + +The site will be rather bare bones since it will need to be configured in the admin area to set up the theme etc. diff --git a/docs/src/developer/guide/cloning.md b/docs/src/developer/guide/cloning.md new file mode 100644 index 0000000..d3f99e6 --- /dev/null +++ b/docs/src/developer/guide/cloning.md @@ -0,0 +1,29 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Checking out the code + +This section outlines the process of checking out the code for local development. + +🚩 Make sure you have gone through the [Prerequisites Section](prerequisites.md) before following these notes. + +Git Code check out [PROJECT_URL] + +``` +git clone https://github.com/project-name/repository.git +``` + + +📒**Which branch to use?**: Note that we deploy our staging work from the `develop` branch and our production environment from the `main` branch. If you are planning on contributing improvements to the project, please submit them against the `develop` branch. + +🪧 Now that you have the code checked out, move on to the [IDE Setup](ide-setup.md) documentation. diff --git a/docs/src/developer/guide/configuration.md b/docs/src/developer/guide/configuration.md new file mode 100644 index 0000000..bda3a31 --- /dev/null +++ b/docs/src/developer/guide/configuration.md @@ -0,0 +1,80 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Project setup + + +## Clone [PROJECT_NAME] repository + +This will clone the [PROJECT_NAME] repository to your machine +``` +git clone https://github.com/project/repository.git +``` + + +## Set up the project + +This will set up the [PROJECT_NAME] project on your machine + +``` +cd [PROJECT_NAME] +cd deployment +cp docker-compose.override.template.yml docker-compose.override.yml +cp .template.env .env +cd .. +make up +``` + +Wait until everything is done. + +After everything is done, open up a web browser and go to [http://127.0.0.1/](http://127.0.0.1/) and the dashboard will open: + +By Default, we can use the admin credential: + +``` +username : admin +password : admin +``` + +## Set up different environment + +To set up different environment, for example the Default credential, or the port of server, open **deployment/.env**. +You can check the description below for each of variable. + +``` +COMPOSE_PROJECT_NAME=[PROJECT_NAME] +NGINX_TAG=0.0.1 -> Change this for different nginx image +DJANGO_TAG=0.0.1 -> Change this for different django image +DJANGO_DEV_TAG=0.0.1 -> Change this for different django dev image + +# Environments +DJANGO_SETTINGS_MODULE=core.settings.prod -> Change this to use different django config file +ADMIN_USERNAME=admin -> Default admin username +ADMIN_PASSWORD=admin -> Default admin password +ADMIN_EMAIL=admin@example.com -> Default admin email +INITIAL_FIXTURES=True +HTTP_PORT=80 -> Change the port of nginx + +# Database Environment +DATABASE_NAME=django -> Default database name +DATABASE_USERNAME=docker -> Default database username +DATABASE_PASSWORD=docker -> Default database password +DATABASE_HOST=db -> Default database host. Change this if you use cloud database or any new docker container. +RABBITMQ_HOST=rabbitmq + +# Onedrive +PUID=1000 +PGID=1000 +``` + +After you change the desired variable and do `make up`. It will rerun the project with new environment. diff --git a/docs/src/developer/guide/design.md b/docs/src/developer/guide/design.md new file mode 100644 index 0000000..805dae8 --- /dev/null +++ b/docs/src/developer/guide/design.md @@ -0,0 +1,41 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Design + + +This section describes the visual design approach for the user interface. + +![Design Overview]() + +## Design sheet + +The following documents provide guidance for the standard visual design we use when building the site: + + + +| Preview | Name | Notes | +|------------|---------|----------------| +|![Colours](){: style="height:100px;width:75px"} | [Colours]() | Colour Palettes | +|![Buttons](){: style="height:100px;width:75px"} | [Buttons]() | Designs for Buttons. | +|![Form Fields](){: style="height:100px;width:75px"} | [Form Fields]() | Form elements such as input boxes, select lists, radio buttons etc. | +|![Icons](){: style="height:100px;width:75px"} | [Icons]() | Standard iconography to be used in forms and views. | +|![Tables](){: style="height:100px;width:75px"} | [Tables]() | Design for tables and presentation of tabular data. | +|![Others](){: style="height:100px;width:75px"} | [Others]() | Other user interface elements. | + +🪧 Once you have reviewed the design sheets, you can move on to our [Roadmap](roadmap.md). + +## Wire-frame model + + +[Wire-frame Model]() diff --git a/docs/src/developer/guide/ide-setup.md b/docs/src/developer/guide/ide-setup.md new file mode 100644 index 0000000..bdc90c4 --- /dev/null +++ b/docs/src/developer/guide/ide-setup.md @@ -0,0 +1,202 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Setting up your IDE + +This section outlines the process for configuring your IDE for development. + +🚩 Make sure you have gone through the [Cloning Section](cloning.md) before following these notes. + +## VS Code setup + +Open the project in VSCode (1️⃣, 2️⃣) by navigating the the place on your file system where you checked out the code in the pre-requisites step above (3️⃣). + +![IDE Setup 1.png](./img/ide-setup-1.png) + +Accept the 'trust authors' prompt + +![IDE Setup 2.png](./img/ide-setup-2.png) + +### Copying the .env + +Copy the `template.env` to `.env` + +![IDE Setup 3.png](./img/ide-setup-3.png) + +Edit the `.env` file and change the + +``` +DJANGO_SETTINGS_MODULE=core.settings.prod +``` + +to + +``` +DJANGO_SETTINGS_MODULE=core.settings.dev +``` + +![image.png](./img/ide-setup-4.png) + +### Override Docker configurations + +We are going to copy the docker overrides template to a local file that will not be under version control. + +![image.png](./img/ide-setup-5.png) + +Rename the file to `docker-compose.override.yml` + +![image.png](./img/ide-setup-6.png) + +Initially you will not need to change anything in this file, though you may want to take a look through the various configurations provided here if you want to tweak your local setup. + +Now that you have your IDE set up, we can move on to [building the project](building.md). + +## Using PyCharm + +📒 ⛔️ This section needs to be reviewed and organised into our docs framework. + +This section is for using pycharm. + +Requirements: + +- Pycharm +- Finished **Setting up the project** + +## Setup interpreter + +1. Go to File -> Settings -> Project -> Project Interpreter. Then click on the cog -> add +
![Project Interpreter ](img/1.png "Project Interpreter")

+ +2. Go to the ssh interpreter tab and fill in the form as below +
![Project Interpreter ](img/2.png "Project Interpreter")

+ +3. Click next and fill in **docker** as the password +
![Project Interpreter ](img/3.png "Project Interpreter")

+ +4. Click next and change the interpreter as below, then click finish. +
![Project Interpreter ](img/4.png "Project Interpreter")

+ +5. After you click finish, it will show all of the packages like below. +
![Project Interpreter ](img/5.png "Project Interpreter")

+ +6. In current page, click **path mappings**, click + button and put local path to where the project (django-project folder) and remote path is like below. and click oK. +
![Project Interpreter ](img/6.png "Project Interpreter") + +Now the interpreter is done. When we restart the machine, we need to do `make up` to run the project. + +## Setup run configuration + +After the interpreter is done, we need configuration to run the project in development mode. + +1. Click "Add configuration" like in the cursor in the image below. (top-right) +
![Project Interpreter ](img/7.png "Project Interpreter")

+ +2. There will be a popup, and click +, then click **django server** like below +
![Project Interpreter ](img/8.png "Project Interpreter") +
![Project Interpreter ](img/9.png "Project Interpreter")

+ +3. It will show the form and fill like below. +
![Project Interpreter ](img/10.png "Project Interpreter")

+ +4. Don't click the OK yet, but click **Environment Variables** and add environments like below (by clicking + button). +
![Project Interpreter ](img/11.png "Project Interpreter")

+ +5. After that, click OK. + +6. Now we need to run the server by clicking **go** button in below image. +
![Project Interpreter ](img/12.png "Project Interpreter")

+ +7. When we click the **go** button, pycharm will run a process until like image below. +
![Project Interpreter ](img/13.png "Project Interpreter")

+ +8. Now it is done. We can access the development server in [http://localhost:2000/](http://localhost:2000/) + +This development mode is DEBUG mode, and also whenever we change the code, the site will also change in runtime. + +For more information how to set up on pycharm, please visit [Using a Docker Compose-Based Python Interpreter in PyCharm](https://kartoza.com/en/blog/using-docker-compose-based-python-interpreter-in-) + +## Quick setup guide + +⛔️📒 This content needs to be reviewed and moved to the readme. + +### Production + +``` +git clone https://github.com/project-name/repository +cd project-name/deployment +docker-compose up -d +``` + +The web will be available at `http://127.0.0.1/` + +To stop containers: + +``` +docker-compose kill +``` + +To stop and delete containers: + +``` +docker-compose down +``` + +### Development + +``` +git clone https://github.com/project-name/repository +cd project-name/deployment +cp .template.env .env +cp docker-compose.override.template.yml docker-compose.override.yml +``` + +After that, + +- open new terminal +- on folder root of project, do + +``` +make frontend-dev +``` + +Wait until it is done +when there is sentence "webpack xxx compiled successfully in xxx ms".
+After that, don't close the terminal. +If it is accidentally closed, do `make frontend-dev` again + +Next step: +- Open new terminal +- Do commands below +``` +make up +make dev +``` + +Wait until it is on. + +The web can be accessed using `http://localhost:2000/` + +If the web is taking long time to load, restart project-name_dev container by `make dev-reload`.
+The sequence should be `make frontend-dev`, after that run or restart project-name_dev. + +To stop dev: + +``` +make dev-kill +``` + +To reload container: + +``` +make dev-reload +``` diff --git a/docs/src/developer/guide/img/1.png b/docs/src/developer/guide/img/1.png new file mode 100644 index 0000000..4a8ebf7 Binary files /dev/null and b/docs/src/developer/guide/img/1.png differ diff --git a/docs/src/developer/guide/img/10.png b/docs/src/developer/guide/img/10.png new file mode 100644 index 0000000..febfae5 Binary files /dev/null and b/docs/src/developer/guide/img/10.png differ diff --git a/docs/src/developer/guide/img/11.png b/docs/src/developer/guide/img/11.png new file mode 100644 index 0000000..0748ab0 Binary files /dev/null and b/docs/src/developer/guide/img/11.png differ diff --git a/docs/src/developer/guide/img/12.png b/docs/src/developer/guide/img/12.png new file mode 100644 index 0000000..26eda82 Binary files /dev/null and b/docs/src/developer/guide/img/12.png differ diff --git a/docs/src/developer/guide/img/13.png b/docs/src/developer/guide/img/13.png new file mode 100644 index 0000000..aab1614 Binary files /dev/null and b/docs/src/developer/guide/img/13.png differ diff --git a/docs/src/developer/guide/img/2.png b/docs/src/developer/guide/img/2.png new file mode 100644 index 0000000..6648990 Binary files /dev/null and b/docs/src/developer/guide/img/2.png differ diff --git a/docs/src/developer/guide/img/3.png b/docs/src/developer/guide/img/3.png new file mode 100644 index 0000000..6a431cf Binary files /dev/null and b/docs/src/developer/guide/img/3.png differ diff --git a/docs/src/developer/guide/img/4.png b/docs/src/developer/guide/img/4.png new file mode 100644 index 0000000..69d0b72 Binary files /dev/null and b/docs/src/developer/guide/img/4.png differ diff --git a/docs/src/developer/guide/img/5.png b/docs/src/developer/guide/img/5.png new file mode 100644 index 0000000..974a089 Binary files /dev/null and b/docs/src/developer/guide/img/5.png differ diff --git a/docs/src/developer/guide/img/6.png b/docs/src/developer/guide/img/6.png new file mode 100644 index 0000000..0fbedb9 Binary files /dev/null and b/docs/src/developer/guide/img/6.png differ diff --git a/docs/src/developer/guide/img/7.png b/docs/src/developer/guide/img/7.png new file mode 100644 index 0000000..5f28dee Binary files /dev/null and b/docs/src/developer/guide/img/7.png differ diff --git a/docs/src/developer/guide/img/8.png b/docs/src/developer/guide/img/8.png new file mode 100644 index 0000000..8f63d7b Binary files /dev/null and b/docs/src/developer/guide/img/8.png differ diff --git a/docs/src/developer/guide/img/9.png b/docs/src/developer/guide/img/9.png new file mode 100644 index 0000000..8961893 Binary files /dev/null and b/docs/src/developer/guide/img/9.png differ diff --git a/docs/src/developer/guide/img/architecture-celery.svg b/docs/src/developer/guide/img/architecture-celery.svg new file mode 100644 index 0000000..82900b1 --- /dev/null +++ b/docs/src/developer/guide/img/architecture-celery.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/developer/guide/img/architecture-deckgl.png b/docs/src/developer/guide/img/architecture-deckgl.png new file mode 100644 index 0000000..bf29c4b Binary files /dev/null and b/docs/src/developer/guide/img/architecture-deckgl.png differ diff --git a/docs/src/developer/guide/img/architecture-docker.svg b/docs/src/developer/guide/img/architecture-docker.svg new file mode 100644 index 0000000..4242689 --- /dev/null +++ b/docs/src/developer/guide/img/architecture-docker.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/src/developer/guide/img/architecture-drf.png b/docs/src/developer/guide/img/architecture-drf.png new file mode 100644 index 0000000..73de34f Binary files /dev/null and b/docs/src/developer/guide/img/architecture-drf.png differ diff --git a/docs/src/developer/guide/img/architecture-gdal.png b/docs/src/developer/guide/img/architecture-gdal.png new file mode 100644 index 0000000..7329ebe Binary files /dev/null and b/docs/src/developer/guide/img/architecture-gdal.png differ diff --git a/docs/src/developer/guide/img/architecture-maplibre-logo.svg b/docs/src/developer/guide/img/architecture-maplibre-logo.svg new file mode 100644 index 0000000..c007c4e --- /dev/null +++ b/docs/src/developer/guide/img/architecture-maplibre-logo.svg @@ -0,0 +1,12 @@ + diff --git a/docs/src/developer/guide/img/architecture-material-ui.svg b/docs/src/developer/guide/img/architecture-material-ui.svg new file mode 100644 index 0000000..cbcd08c --- /dev/null +++ b/docs/src/developer/guide/img/architecture-material-ui.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/src/developer/guide/img/architecture-postgis.svg b/docs/src/developer/guide/img/architecture-postgis.svg new file mode 100644 index 0000000..ea09e7f --- /dev/null +++ b/docs/src/developer/guide/img/architecture-postgis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/src/developer/guide/img/architecture-postgresql.png b/docs/src/developer/guide/img/architecture-postgresql.png new file mode 100644 index 0000000..94612cf Binary files /dev/null and b/docs/src/developer/guide/img/architecture-postgresql.png differ diff --git a/docs/src/developer/guide/img/architecture-tegola.png b/docs/src/developer/guide/img/architecture-tegola.png new file mode 100644 index 0000000..12fb99d Binary files /dev/null and b/docs/src/developer/guide/img/architecture-tegola.png differ diff --git a/docs/src/developer/guide/img/building-1.png b/docs/src/developer/guide/img/building-1.png new file mode 100644 index 0000000..42059f9 Binary files /dev/null and b/docs/src/developer/guide/img/building-1.png differ diff --git a/docs/src/developer/guide/img/building-2.png b/docs/src/developer/guide/img/building-2.png new file mode 100644 index 0000000..5a6cc5c Binary files /dev/null and b/docs/src/developer/guide/img/building-2.png differ diff --git a/docs/src/developer/guide/img/building-3.png b/docs/src/developer/guide/img/building-3.png new file mode 100644 index 0000000..d984996 Binary files /dev/null and b/docs/src/developer/guide/img/building-3.png differ diff --git a/docs/src/developer/guide/img/building-4.png b/docs/src/developer/guide/img/building-4.png new file mode 100644 index 0000000..27e83b3 Binary files /dev/null and b/docs/src/developer/guide/img/building-4.png differ diff --git a/docs/src/developer/guide/img/building-5.png b/docs/src/developer/guide/img/building-5.png new file mode 100644 index 0000000..d0048b5 Binary files /dev/null and b/docs/src/developer/guide/img/building-5.png differ diff --git a/docs/src/developer/guide/img/ide-setup-1.png b/docs/src/developer/guide/img/ide-setup-1.png new file mode 100644 index 0000000..4ecbc40 Binary files /dev/null and b/docs/src/developer/guide/img/ide-setup-1.png differ diff --git a/docs/src/developer/guide/img/ide-setup-2.png b/docs/src/developer/guide/img/ide-setup-2.png new file mode 100644 index 0000000..f26b138 Binary files /dev/null and b/docs/src/developer/guide/img/ide-setup-2.png differ diff --git a/docs/src/developer/guide/img/ide-setup-3.png b/docs/src/developer/guide/img/ide-setup-3.png new file mode 100644 index 0000000..b284ce8 Binary files /dev/null and b/docs/src/developer/guide/img/ide-setup-3.png differ diff --git a/docs/src/developer/guide/img/ide-setup-4.png b/docs/src/developer/guide/img/ide-setup-4.png new file mode 100644 index 0000000..818b6dd Binary files /dev/null and b/docs/src/developer/guide/img/ide-setup-4.png differ diff --git a/docs/src/developer/guide/img/ide-setup-5.png b/docs/src/developer/guide/img/ide-setup-5.png new file mode 100644 index 0000000..6755828 Binary files /dev/null and b/docs/src/developer/guide/img/ide-setup-5.png differ diff --git a/docs/src/developer/guide/img/ide-setup-6.png b/docs/src/developer/guide/img/ide-setup-6.png new file mode 100644 index 0000000..f91ebb0 Binary files /dev/null and b/docs/src/developer/guide/img/ide-setup-6.png differ diff --git a/docs/src/developer/guide/img/naming-convention.README b/docs/src/developer/guide/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/developer/guide/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/developer/guide/index.md b/docs/src/developer/guide/index.md new file mode 100644 index 0000000..cc6e3b7 --- /dev/null +++ b/docs/src/developer/guide/index.md @@ -0,0 +1,26 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Developer guide + +In this section of the documentation, we aim to onboard developers onto the process of setting up a developer workstation, understanding the system architecture, contributing back to the project and so forth. Here is a brief overview of the content provided here: + +* **[Architecture:](./architecture.md)** - Here we outline the system architecture using ER Diagrams, Software Component Diagrams etc. +* **[Prerequisites:](./prerequisites.md)** - An overview of the software that needs to be installed before you can start. +* **[Cloning:](./cloning.md)** - In this section we cover how to make a local working copy on your own machine. +* **[IDE Setup:](./ide-setup.md)** - Here we walk through setting up your IDE. +* **[Building:](./building.md)** - This covers tasks related to building the application so you can test it in your browser. +* **[Configuration:](./configuration.md)** - This covers standard configuration tasks that need to be done once the site is brought online. +* **[Design:](./design.md)** - This section describes the visual design approach for the user interface. +* **[Workflows:](./workflows.md)** - Examples of typical workflows for adding features, fixing bugs etc. +* **[Roadmap:](./roadmap.md)** - Here we outline future plans for the project. diff --git a/docs/src/developer/guide/prerequisites.md b/docs/src/developer/guide/prerequisites.md new file mode 100644 index 0000000..c4047b3 --- /dev/null +++ b/docs/src/developer/guide/prerequisites.md @@ -0,0 +1,15 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Project prerequisites + diff --git a/docs/src/developer/guide/roadmap.md b/docs/src/developer/guide/roadmap.md new file mode 100644 index 0000000..7a661ef --- /dev/null +++ b/docs/src/developer/guide/roadmap.md @@ -0,0 +1,15 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Project roadmap + diff --git a/docs/src/developer/guide/templates/commit-message-convention.md b/docs/src/developer/guide/templates/commit-message-convention.md new file mode 100644 index 0000000..6da95d9 --- /dev/null +++ b/docs/src/developer/guide/templates/commit-message-convention.md @@ -0,0 +1,15 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Commit message convention + diff --git a/docs/src/developer/guide/templates/pull-request-template.md b/docs/src/developer/guide/templates/pull-request-template.md new file mode 100644 index 0000000..47f752d --- /dev/null +++ b/docs/src/developer/guide/templates/pull-request-template.md @@ -0,0 +1,15 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Pull Request template + diff --git a/docs/src/developer/guide/workflows.md b/docs/src/developer/guide/workflows.md new file mode 100644 index 0000000..7280038 --- /dev/null +++ b/docs/src/developer/guide/workflows.md @@ -0,0 +1,41 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Developer workflows + + +## Adding a feature + +- Create an Issue +- Wait for it to be added to a Sprint +- Functional Tests +- Playwright Tests +- Write end user documentation + +## Fixing a bug + +- Claim an Issue +- Wait for it to be added to a Sprint +- Regression Test +- Implement Fix + +## Make PR for feature/bug fix + +### Committing to project + +Follow our [Commit message conventions](./templates/commit-message-convention.md). + +### Pull request template + +If it has related issues, add links to the issues(like `#123`) in the description. +Fill in the [Pull Request template](./templates/pull-request-template.md) by check your case. diff --git a/docs/src/developer/img/naming-convention.README b/docs/src/developer/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/developer/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/developer/index.md b/docs/src/developer/index.md new file mode 100644 index 0000000..fe47eb8 --- /dev/null +++ b/docs/src/developer/index.md @@ -0,0 +1,22 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# For Developers + + +This is the homepage for all developer related documentation. + +* The [developer guide](guide/index.md), which describes common workflows for developers in a tutorial format. This includes instructions on how to set up your developer environment, check out the code, run it locally etc. +* The [developer manual](manual/index.md), which describes each python module and its classes, functions etc. This section is autogenerated. +* The [api guide](api/guide/index.md), which describes common workflows for using the restful API. +* The [api manual](api/manual/index.md), which describes each API endpoint and its parameters, return values etc. This section is autogenerated. diff --git a/docs/src/developer/manual/img/naming-convention.README b/docs/src/developer/manual/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/developer/manual/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/developer/manual/index.md b/docs/src/developer/manual/index.md new file mode 100644 index 0000000..847d36a --- /dev/null +++ b/docs/src/developer/manual/index.md @@ -0,0 +1,25 @@ + +--- +title: Automatically Generated Python Documentation +summary: DO NOT EDIT THIS FILE MANUALLY : It is created during the mkdocs build process +date: 2023-08-03 +--- + +# Python Reference Manual +::: manage +::: initialize +::: core.context_processors +::: core.urls +::: core.asgi +::: core.celery +::: core.wsgi +::: core.settings.contrib +::: core.settings.utils +::: core.settings.prod +::: core.settings.project +::: core.settings.base +::: core.settings.dev +::: frontend.urls +::: frontend.admin +::: frontend.views +::: frontend.apps diff --git a/docs/src/devops/guide/img/naming-convention.README b/docs/src/devops/guide/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/devops/guide/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/devops/guide/index.md b/docs/src/devops/guide/index.md new file mode 100644 index 0000000..2926dc8 --- /dev/null +++ b/docs/src/devops/guide/index.md @@ -0,0 +1,15 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- +# DevOps guide + + diff --git a/docs/src/devops/img/naming-convention.README b/docs/src/devops/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/devops/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/devops/index.md b/docs/src/devops/index.md new file mode 100644 index 0000000..98f8555 --- /dev/null +++ b/docs/src/devops/index.md @@ -0,0 +1,22 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# DevOps documentation + + +This section contains all documentation relevant to DevOps procedures. + +The devops content is divided into two sections: + +* The [devops guide](guide/index.md), which describes common workflows for deployment and management of running instances in a tutorial format. +* The [devops manual](manual/index.md), which provides links and references to deployment configuration files, frameworks and deployment systems used etc. diff --git a/docs/src/devops/manual/img/naming-convention.README b/docs/src/devops/manual/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/devops/manual/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/devops/manual/index.md b/docs/src/devops/manual/index.md new file mode 100644 index 0000000..6eb3b29 --- /dev/null +++ b/docs/src/devops/manual/index.md @@ -0,0 +1,29 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# DevOps documentation + + +## Containers used + +## SDLC + +## Continuous integration + +## Testing deployments + +## Backend orchestration + +### Deployments + +### Kubernetes diff --git a/docs/src/img/KartozaBackgroundBorder.png b/docs/src/img/KartozaBackgroundBorder.png new file mode 100644 index 0000000..af4817f Binary files /dev/null and b/docs/src/img/KartozaBackgroundBorder.png differ diff --git a/docs/src/img/KartozaLogo-320x132.png b/docs/src/img/KartozaLogo-320x132.png new file mode 100644 index 0000000..4d1a103 Binary files /dev/null and b/docs/src/img/KartozaLogo-320x132.png differ diff --git a/docs/src/img/favicon.ico b/docs/src/img/favicon.ico new file mode 100644 index 0000000..48e801a Binary files /dev/null and b/docs/src/img/favicon.ico differ diff --git a/docs/src/img/logo.png b/docs/src/img/logo.png new file mode 100644 index 0000000..48e801a Binary files /dev/null and b/docs/src/img/logo.png differ diff --git a/docs/src/img/logo.svg b/docs/src/img/logo.svg new file mode 100644 index 0000000..35acd42 --- /dev/null +++ b/docs/src/img/logo.svg @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..53bf15d --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,120 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Template project title + + +Strapline + +![main_screenshot]() + +## Introduction + + + + + +## Key concepts + +A **project** (dashboard) is the most important feature of PROJECT_NAME. Projects +combine different elements (Reference datasets, indicators, and context layers) +and enable data visualization/analysis for all end users. + +**Context layers** are geospatial layers used to contextualise the information +presented in a project. + +**Indicators layers** derive from spreadsheets or other intelligence assets +harvested by the platform. + +**Widgets** are visual components such as charts generated by performing data +analysis on country/regional levels and the indicator data. + +### Disclaimer + +
+The software provided by this project is provided 'as is'. All information provided +within the platform should be independently verified before using as the basis for +action. The contributors and developers of this platform take no responsibility +for any loss of revenue, life, physical harm or any other adverse outcome that may +occur as a result of the use of this platform. +
+ +### Purpose + +### Scope of project + +### Project roadmap + +![Project Roadmap]() +[Project Roadmap]() + + +#### Contributing + +We would love to collaborate with you! But first, please read our [contributor +guidelines](about/contributing.md) which describe how to report +issues, plan and contribute feature additions etc. + +#### Code of conduct + +Our community in this project is aligned with our [Code of +Conduct](about/code-of-conduct.md) - please be sure to read and abide by that +document in all interactions with out community. + +#### Diversity statement + +This project welcomes and encourages participation by everyone. + +No matter how you identify yourself or how others perceive you: we welcome you. +We welcome contributions from everyone as long as they interact constructively +with our community. + +While much of the work for our project is technical in nature, we value and +encourage contributions from those with expertise in other areas, and welcome +them into our community. + +## Project partners + + +![Project Partner 1]() +[Project Partner 1]() + +#### Releases + + +[GitHub releases page]() +[Releases page]() + +| | **Project Badges** | | +| ----------------------- | ----------------------- | ----------------------- | +| ![License](https://img.shields.io/github/license/{username}/{repo-name}.svg) | ![Version](https://img.shields.io/github/release/{username}/{repo-name}.svg) | ![Commits](https://img.shields.io/github/commits-since/{username}/{repo-name}/{version}.svg) | +| ![Issue Tracker](https://img.shields.io/github/issues/{username}/{repo-name}.svg) | ![Closed Issues](https://img.shields.io/github/issues-closed/{username}/{repo-name}.svg) | ![Pull requests](https://img.shields.io/github/issues-pr/{username}/{repo-name}.svg) | + +#### Project chatroom + + +[Chatroom]() + +#### Contributor License Agreement (CLA) + +Contributions to this project will be subject to our [Contributor License Agreement]() + +#### License + +This project is open source, published under the AGPL-3. +You can read our license to find out what rights this license bestows to users and contributors. + +[License](about/license.md) + + +![Kartoza Logo](img/KartozaLogo-320x132.png) diff --git a/docs/src/user/guide/img/naming-convention.README b/docs/src/user/guide/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/user/guide/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/user/guide/index.md b/docs/src/user/guide/index.md new file mode 100644 index 0000000..def344d --- /dev/null +++ b/docs/src/user/guide/index.md @@ -0,0 +1,16 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# User guide + + diff --git a/docs/src/user/img/naming-convention.README b/docs/src/user/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/user/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/user/index.md b/docs/src/user/index.md new file mode 100644 index 0000000..b816541 --- /dev/null +++ b/docs/src/user/index.md @@ -0,0 +1,22 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# User documentation + +This is the homepage for all user related documentation. + +The user content is divided into three sections: + +- The [quickstart tutorial](quickstart/index.md), which aims to get you familiar with the basics of platform in around 5 minutes. +- The [user guide](guide/index.md), which describes common workflows in a tutorial format. +- The [user manual](manual/index.md), which describes each page of the user interface and what the various options on that page do. diff --git a/docs/src/user/manual/img/naming-convention.README b/docs/src/user/manual/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/user/manual/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/user/manual/index.md b/docs/src/user/manual/index.md new file mode 100644 index 0000000..5f97176 --- /dev/null +++ b/docs/src/user/manual/index.md @@ -0,0 +1,19 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# User manual + +This section of the documentation describes every page in the application and +what the various components of that page do. The manual is intended to function +as a reference for the application. For narrative / workflow based tutorials, +you may prefer to work through our [user guide](../guide/index.md). diff --git a/docs/src/user/quickstart/img/naming-convention.README b/docs/src/user/quickstart/img/naming-convention.README new file mode 100644 index 0000000..74a045a --- /dev/null +++ b/docs/src/user/quickstart/img/naming-convention.README @@ -0,0 +1,7 @@ +# Image naming convention + +Images should be named according to reference doc, sub-section and order in the document. +e.g. + +- The 1st image in instructions regarding zooming will be something like zooming-1, the 2nd image will be zooming-2, etc. +- The 1st image in quickstart regarding logging in will be login-1, etc diff --git a/docs/src/user/quickstart/index.md b/docs/src/user/quickstart/index.md new file mode 100644 index 0000000..846e95b --- /dev/null +++ b/docs/src/user/quickstart/index.md @@ -0,0 +1,29 @@ +--- +title: PROJECT_TITLE +summary: PROJECT_SUMMARY + - PERSON_1 + - PERSON_2 +date: DATE +some_url: PROJECT_GITHUB_URL +copyright: Copyright 2023, PROJECT_OWNER +contact: PROJECT_CONTACT +license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. +#context_id: 1234 +--- + +# Quickstart + + +## Installing the product + + +## Getting started + + +### Releases + + +[GitHub releases page]() +[Releases page]() diff --git a/docs/templates/KartozaSymbolCMYK.svg b/docs/templates/KartozaSymbolCMYK.svg new file mode 100644 index 0000000..cd2b423 --- /dev/null +++ b/docs/templates/KartozaSymbolCMYK.svg @@ -0,0 +1,52 @@ + + + + + + + + diff --git a/docs/templates/cover.html b/docs/templates/cover.html new file mode 100644 index 0000000..d9df512 --- /dev/null +++ b/docs/templates/cover.html @@ -0,0 +1,9 @@ +
+

The Kartoza Handbook

+
+ +
+

Your Open Source Geospatial Experts.

+

Kartoza Pty (Ltd.)

+

2022

+
\ No newline at end of file diff --git a/docs/templates/footer.svg b/docs/templates/footer.svg new file mode 100644 index 0000000..aeb820e --- /dev/null +++ b/docs/templates/footer.svg @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/templates/graphics.scss b/docs/templates/graphics.scss new file mode 100644 index 0000000..8eeffc8 --- /dev/null +++ b/docs/templates/graphics.scss @@ -0,0 +1,7 @@ +/* BASE FOLDER token will be replaced at compile time by our bash script. */ + + +$logo-url: url('file:///home/timlinux/dev/documentation/TheKartozaHandbook/docs/assets/logo.svg'); +$corner-logo-url: url('file:///home/timlinux/dev/documentation/TheKartozaHandbook/docs/templates/KartozaSymbolCMYK.svg'); +$header-url: url('file:///home/timlinux/dev/documentation/TheKartozaHandbook/docs/templates/header.svg'); +$footer-url: url('file:///home/timlinux/dev/documentation/TheKartozaHandbook/docs/templates/footer.svg'); \ No newline at end of file diff --git a/docs/templates/graphics.scss.templ b/docs/templates/graphics.scss.templ new file mode 100644 index 0000000..6e2c521 --- /dev/null +++ b/docs/templates/graphics.scss.templ @@ -0,0 +1,7 @@ +/* BASE FOLDER token will be replaced at compile time by our bash script. */ + + +$logo-url: url('file://[BASE_FOLDER]/assets/logo.svg'); +$corner-logo-url: url('file://[BASE_FOLDER]/templates/KartozaSymbolCMYK.svg'); +$header-url: url('file://[BASE_FOLDER]/templates/header.svg'); +$footer-url: url('file://[BASE_FOLDER]/templates/footer.svg'); \ No newline at end of file diff --git a/docs/templates/header.svg b/docs/templates/header.svg new file mode 100644 index 0000000..c750c49 --- /dev/null +++ b/docs/templates/header.svg @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/templates/styles.scss b/docs/templates/styles.scss new file mode 100644 index 0000000..3d10316 --- /dev/null +++ b/docs/templates/styles.scss @@ -0,0 +1,551 @@ +/* Sass property declarations - these two files contain stuff you can edit. + Don't edit anything in this file unless you are wanting to improve the base style. + This file is only used for the pdf generation. + */ +@import "variables.scss"; +@import "graphics.scss"; +/* To debug and define css rules, run the generator in debug mode + by editing mkdocs-pdf.yml and enabling debug mode. Then + redirect the generator output to an html file e.g. + +./build-docs-pdf.sh > /tmp/output.html +xdg-open /tmp/output.html + + Then use the inspect tool in your browser to identify the css paths + of styles you want to modify. + +*/ + +@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&family=Source+Code+Pro&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100&display=swap'); + +// +// Print media specific page setup +// + +html { + font-family: 'Roboto Slab', serif; + font-size: $font-size; + color: $font-color; +} + +img { + display: block; + margin-left: auto; + margin-right: auto; + width: 50%; +} + +.cover-logo { + background-image: $logo-url; + background-repeat: no-repeat; + width: 440px; + height: 440px; + z-index: 1000; + /* Center on page */ + margin-left: auto; + margin-right: auto; + margin-top: 40px; + width: 50%; + background-color: #fff; + /* ensures that svg stretches to fill the container */ + background-size: contain; +} + +@font-face { + src: url(../assets/AvenirLTStd-Book.otf); + font-family: avenir; +} + +@page { + /* size: a4 portrait; */ + size: 210mm 297mm; + margin: 0mm; + padding: 0mm; + counter-increment: page; + font-family: Georgia, serif; + font-size: $font-size; + white-space: normal; + color: $font-color; + /* + Margin properties next: + + See https://www.quackit.com/css/at-rules/css_bottom-left-corner_at-rule.cfm + for a nice explanation of the margin properties for css print layouts */ + + + @top-left-corner { + @if $show-top-left-corner-logo { + background: $corner-logo-url; + } + + background-repeat: no-repeat; + background-position: 0% 0%; + background-size: contain; + z-index: 99; + //Hack needed or image will not show + content: " "; + } + + + @top-left { + /* Note this element gets obscured by top-center if it is solid. */ + z-index: 95; + content: $document-title; + color: $document-title-color; + } + + @top-center { + /* Idiosyncratic note: The top center section is the + only one that you can expand out to the full width of the page. + Also: The left elements will render under it, the right elements + over it (the z order increases as you move right). + + Be careful trying to use a PNG background as the DPI is hard to configure + and your graphics will appear pixelated or not scale correctly + so rather use an SVG. + + The setup below will span your SVG across the page, make sure your + SVG document has exactly the same dimensions. Leave a pixel or two + white space to the very right of your SVG as the right edge is + difficult to page align. + */ + background-color: transparent; + /* Dont remove these two lines, they force the center element + to the width of the page and height of the footer image. */ + min-width: 210mm; + min-height: 22mm; + background-repeat: no-repeat; + background-position: 0% 0%; + background-size: contain; + size: 210mm 22mm; + border: none; + background: $header-url; + /* Hack needed or image will not show */ + content: " "; + z-index: 90; + } + + @top-right { + min-width: 100mm; + background-color: transparent; + /* hack to make it appear as box */ + content: " "; + } + + @bottom-left-corner { + /* has no effect on corner elements */ + max-width: 0mm; + background-color: transparent; + /* hack to make it appear as box */ + content: " "; + } + + @bottom-left { + background-color: transparent; + /* hack to make it appear as box */ + content: " "; + } + + @bottom-center { + /* Idiosyncratic note: The bottom center section is the + only one that you can expand out to the full width of the page. + Also: The left elements will render under it, the right elements + over it (the z order increases as you move right). + + Be careful trying to use a PNG background as the DPI is hard to configure + and your graphics will appear pixelated or not scale correctly + so rather use an SVG. + + The setup below will span your SVG across the page, make sure your + SVG document has exactly the same dimensions. Leave a pixel or two + white space to the very right of your SVG as the right edge is + difficult to page align. + */ + background-color: transparent; + /* Dont remove these two lines, they force the center element + to the width of the page and height of the footer image. */ + min-width: 210mm; + min-height: 22mm; + background-repeat: no-repeat; + background-position: 0% 0%; + background-size: contain; + size: 210mm 22mm; + background: $footer-url; + /* Note you cannot do concatenation in CSS content + except I figured out this little trick below TS */ + content: " " counter(page) " "; + } + + @bottom-right { + max-width: 0mm; + background-color: transparent; + /* hack to make it appear as box */ + content: " "; + } + + @bottom-right-corner { + /* has no effect on corner elements */ + max-width: 0mm; + background-color: transparent; + /* hack to make it appear as box */ + content: " "; + } +} + + + +/** Setting margins */ + +@page { + margin: 2cm; + padding-top: 10mm; +} + + +/* The first page of a print can be manipulated as well */ + +@page :first { + position: absolute; + top: 0px; + right: 0px; +} + +// +// Heading counters and styles +// + +h1 { + counter-increment: c1; + counter-reset: c2; + counter-reset: c3; + counter-reset: c4; +} + +h2 { + counter-increment: c2; + counter-reset: c3; + counter-reset: c4; +} + +h3 { + counter-increment: c3; + counter-reset: c4; +} + +h4 { + counter-increment: c4; +} + +h1:before, +h2:before, +h3:before, +h4:before { + width: 2cm; + display: inline-block; + text-align: right; + padding-right: 0.25cm; +} + +h1:before { + color: $primary-color; + content: counter(c1); +} + +h2:before { + color: $secondary-color; + content: counter(c1) "." counter(c2); +} + +h3:before { + color: $tertiary-color; + content: counter(c1) "." counter(c2) "." counter(c3); +} + +h4:before { + color: $primary-color; + content: counter(c1) "." counter(c2) "." counter(c3) "." counter(c4); +} + +article h1, +h2, +h3, +h4 { + width: 100%; + padding-right: 20pt; + text-align: right; + background: white; + color: black; + page-break-after: avoid; + page-break-inside: avoid; + display: inline-block; +} + + +article h1 { + border-bottom: 1px solid $primary-color; + color: $primary-color; + padding-top: 24px; + text-decoration-style: double; + margin-bottom: 32px; +} + +article h2 { + color: $secondary-color; + border-bottom: 2px solid $secondary-color; + padding-top: 12px; + margin-bottom: 12px; +} + +article h3 { + border-bottom: none; + color: $tertiary-color; + padding-top: 8px; + margin-bottom: 8px; +} + +article h4 { + border-bottom: none; + color: $primary-color; + padding-top: 8px; + margin-bottom: 8px; +} + +/* MKdocs renders code blocks inside a pre element and + inline code simply inside code elements + + Code block related items below are based on the article + at https://css-tricks.com/styling-code-in-and-out-of-blocks/ + + */ + +code { + font-family: monospace; + font-size: inherit; + color: $font-color; +} + + +/* Code in text */ + +p>code, +li>code, +dd>code, +td>code { + display: inline; + background: $inline-code-background; + white-space: pre-wrap; + //max-width: 100%; + //min-width: 100px; + word-wrap: break-word; + box-decoration-break: clone; + border-radius: .2rem; + font-size: $font-size; + color: #000 !important; +} + + +/* code in blocks */ + +pre code:before { + display: block; + width: 25%; + position: relative; + top: -33px; + left: -20px; + content: '🧑‍💻 Code:'; + padding: 1em 1em; + margin-left: 0; + margin-top: 1em; + margin-bottom: 1em; + border-left: 5px solid $codeblock-label-border; + background: $codeblock-label-background; + font-size: $font-size; + color: $codeblock-label-font-color; + font-weight: bolder; +} + +pre code { + display: block; + white-space: pre; + max-width: 100%; + min-width: 100px; + padding: 0; + font-size: $code-font-size; + font-family: $code-font-family; + /* margin: 1em 3em; + */ + padding: 1em 1em; + margin-left: 8px; + margin-top: 1em; + margin-bottom: 1em; + width: 100%; + border-left: 5px solid $codeblock-border; + background: $codeblock-background; + color: $font-color; +} + + +/* End of code blocks */ + +blockquote:before { + display: block; + width: 25%; + position: relative; + top: -33px; + left: -20px; + content: '🧑‍🔧 Note:'; + padding: 1em 1em; + margin-top: 10mm; + margin-left: 0; + margin-bottom: 1em; + border-left: 5px solid $blockquote-label-border; + background: $blockquote-label-background; + font-size: $font-size; + color: $blockquote-label-font-color; + font-weight: bolder !important; +} + +blockquote { + margin-left: 8px; + margin-top: 0mm; + margin-bottom: 0mm; + width: 100%; + border-left: 5px solid $blockquote-border; + background: $blockquote-background; + font-size: $font-size; + color: $font-color; +} + +blockquote p { + margin: 0; +} + +img { + page-break-inside: avoid; + page-break-after: avoid; +} + +table, +pre { + page-break-inside: avoid; +} + +ul, +ol, +dl { + page-break-before: avoid; +} + +table>tbody>tr>td>img { + height: 80px; + width: 80px; +} + + + +/* Next section based on https://dev.to/dcodeyt/creating-beautiful-html-tables-with-css-428l */ + +table { + border-collapse: collapse; + margin: 25px 0; + font-size: 0.9em; + font-family: sans-serif; + min-width: 400px; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.15); + margin-left: auto; + margin-right: auto; +} + + +table thead tr { + background-color: $primary-color; + color: #ffffff; + text-align: left; +} + +table th, +table td { + padding: 12px 15px; +} + +table tbody tr { + border-bottom: 1px solid $primary-color; +} + +table tbody tr:nth-of-type(even) { + background-color: #f3f3f3; +} + +table tbody tr:last-of-type { + border-bottom: 2px solid $primary-color; +} + +table tbody tr.active-row { + font-weight: bold; + color: #009879; +} + +/* End of section based on https://dev.to/dcodeyt/creating-beautiful-html-tables-with-css-428l */ + +ol, +ul { + padding-top: 1ch; + padding-bottom: 1ch; +} + +li { + padding-left: 1ch; +} + +ul.li::marker { + color: $primary-color; + font-weight: bold; + content: '⧈'; + margin-right: 10px; +} + + + +/* CSS Reset Rules from https://perishablepress.com/a-killer-collection-of-global-css-reset-styles/ */ + +* { + vertical-align: baseline; + font-family: inherit; + font-style: inherit; + font-size: 100%; + border: none; + padding: 0; + margin: 0; +} + +h1, +h2, +h3, +h4, +h5, +h6, +p, +pre, +blockquote, +form, +ul, +ol, +dl { + margin: 0px 0; +} + +article p { + color: $font-color; + padding-top: 5px; +} + +li, +dd, +blockquote { + margin-left: 40px; +} + + +/* End of resets ------------------------------- */ \ No newline at end of file diff --git a/docs/templates/variables.scss b/docs/templates/variables.scss new file mode 100644 index 0000000..2e86b0e --- /dev/null +++ b/docs/templates/variables.scss @@ -0,0 +1,33 @@ +/* Sass property declarations */ +$document-title: 'The Kartoza Handbook'; +$document-title-color: #ffffff; +$show-top-left-corner-logo: true; +$primary-color: #54a2cc; +$secondary-color: #f4b751; +$tertiary-color: #8a8b8b; +$primary-color-light: #90acc1; +$secondary-color-light: #f2debd; +$tertiary-color-light: #d5d5d5; +$primary-color-dark: #068dd5; +$secondary-color-dark: #df8c00; +$tertiary-color-dark: #3e3e3e; + +$font-size: 10pt; +$font-color: #000; + +$code-font-size: 8pt; +$code-font-family: 'Noto Sans Mono', monospace; + +$inline-code-background: #bfe9ff; + +$codeblock-label-font-color: white; +$codeblock-label-background: $primary-color; +$codeblock-label-border: $primary-color-dark; +$codeblock-background: $inline-code-background; +$codeblock-border: $primary-color; + +$blockquote-label-font-color: white; +$blockquote-label-background: $secondary-color; +$blockquote-label-border: $secondary-color-dark; +$blockquote-background: $secondary-color-light; +$blockquote-border: $secondary-color; \ No newline at end of file diff --git a/docs/uuid_redirects_hook.py b/docs/uuid_redirects_hook.py new file mode 100644 index 0000000..638549b --- /dev/null +++ b/docs/uuid_redirects_hook.py @@ -0,0 +1,30 @@ +import logging +import mkdocs.plugins + +log = logging.getLogger('mkdocs') + +@mkdocs.plugins.event_priority(-50) + +def on_page_content(html, page, config, files): + + # get redirect config + redirect_plugin = config.get('plugins', {}).get('redirects') + redirects = redirect_plugin.config.get('redirect_maps',{}) + + if "context_id" in page.meta: + context_id = page.meta.get("context_id") + key = f"{context_id}.md" + if key in redirects: + log_context_id_warning(page.meta.context_id, page.file.src_path, redirects[key]) + redirects[key] = page.file.src_path + + for item in page.toc.items: + # maybe implement check for UUID or something else + if item.id.isdigit(): + key = f"{item.id}.md" + if key in redirects: + log_context_id_warning(item.id, page.file.src_path, redirects[key]) + redirects[key] = f"{page.file.src_path}{item.url}" + +def log_context_id_warning(context_id, markdown1, markdown2): + log.warning(f"Context ID {context_id} used in {markdown1} and {markdown2}") diff --git a/playwright/ci-test/.envrc b/playwright/ci-test/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/playwright/ci-test/.envrc @@ -0,0 +1 @@ +use nix diff --git a/playwright/ci-test/.gitignore b/playwright/ci-test/.gitignore new file mode 100644 index 0000000..e0258ff --- /dev/null +++ b/playwright/ci-test/.gitignore @@ -0,0 +1,8 @@ +node_modules/ +/test-results/ +/playwright-report/ +/playwright/.cache/ +states +package-lock.json +playwright-results +*auth.json \ No newline at end of file diff --git a/playwright/ci-test/README.md b/playwright/ci-test/README.md new file mode 100644 index 0000000..42a38f1 --- /dev/null +++ b/playwright/ci-test/README.md @@ -0,0 +1,98 @@ +# Validation Tests + +These tests are designed to run from GitHub action or CI. + +They are intended to verify basic functionality is working during the building of the application(Just before deployment to staging or production). + +## Essential reading: + +* [https://playwright.dev/](https://playwright.dev/) +* [https://playwright.dev/docs/ci-intro](https://playwright.dev/docs/ci-intro) +* [https://direnv.net/docs/installation.html](https://direnv.net/docs/installation.html) + +## Setting up your environment + +Before you can run, you need to set up your environment. + +Running these tests requires playwright set up on your local machine, as well as NodeJS. + +### NixOS + +If you are a NixOS user, you can set up direnv and then cd into this directory in your shell. + +When you do so the first time, you will be prompted to allow direnv which you can do using this command: + +```bash +direnv allow +``` + +>  This may take a while the first time as NixOS builds you a sandbox environment. + +### Non-NixOS + +For a non-NixOS user(Debian/Ubuntu) set up your environment by the following commands: + +```bash +npm install +``` + +To install playwright browsers with OS-level dependencies use: + +```bash +npx playwright install --with-deps chromium +``` + +**NOTE:** This only works with Debian/Ubuntu as they receive official support from playwright. It will also request your master password to install the dependencies. + +## Recording a test + +There is a bash helper script that will let you quickly create a new test: + +``` +Usage: ./record-test.sh TESTNAME +e.g. ./record-test.sh mytest +will write a new test to tests/mytest.spec.ts +Do not use spaces in your test name. +Test files MUST END in .spec.ts + +After recording your test, close the test browser. +You can then run your test by doing: +./run-tests.sh +``` + +>  The first time you record a test, it will store your session credentials in a file ending in ``auth.json``. This file should **NEVER** be committed to git / shared publicly. There is a gitignore rule to ensure this. + +## Running a test + +By default, this will run in `headless` mode just as it is in CI. + +```bash +./run-tests.sh +``` + +**NOTE:** To run it in `UI` mode, add the `--ui` tag to the script. + +```bash +$PLAYWRIGHT \ + test \ + --ui \ + --project chromium +``` + +## Adding a CI test + +To add tests for CI, use the recorded tests then modify it for CI. + +The tests can be modified to include time-outs, and waiting for events/actions etc. For more look go through [playwright's documentation](https://playwright.dev/docs/writing-tests). + +An example of a line-recorded test would look like: + +```typescript +await page.getByRole('img', { name: 'image' }).click(); +``` + +For the CI the line could be modified and turned into an assertion using `expect` to test if the specific element is visible. + +```typescript +await expect(page.getByRole('img', { name: 'image' })).toBeVisible(); +``` diff --git a/playwright/ci-test/base-url.sh b/playwright/ci-test/base-url.sh new file mode 100755 index 0000000..808ac7d --- /dev/null +++ b/playwright/ci-test/base-url.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +echo "Setting BASE_URL for test site" +BASE_URL=http://localhost:61100 diff --git a/playwright/ci-test/create-auth.sh b/playwright/ci-test/create-auth.sh new file mode 100755 index 0000000..386a047 --- /dev/null +++ b/playwright/ci-test/create-auth.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +source base-url.sh + +source playwright-path.sh + +echo "This script will write a new test to tests/deleteme.spec.ts" +echo "then delete it, leaving only the auth config." +echo "" +echo "When the playwright browser opens, log in to the site then exit." +echo "After recording your test, close the test browser." +echo "Recording auth token to auth.json" + +# File exists and write permission granted to user +# show prompt +echo "Continue? y/n" +read ANSWER +case $ANSWER in + [yY] ) echo "Writing auth.json" ;; + [nN] ) echo "Cancelled."; exit ;; +esac + +$PLAYWRIGHT \ + codegen \ + --target playwright-test \ + --save-storage=auth.json \ + -o tests/deleteme.spec.ts \ + $BASE_URL + +# We are only interested in auth.json +rm tests/deleteme.spec.ts + +echo "Auth file creation completed." +echo "You can then run your tests by doing e.g.:" +echo "playwright test --project chromium" diff --git a/playwright/ci-test/nodesource-install.sh b/playwright/ci-test/nodesource-install.sh new file mode 100755 index 0000000..eb2ef0f --- /dev/null +++ b/playwright/ci-test/nodesource-install.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +echo "NodeJS will be installed if not present" +echo "sudo password will be required" + +USES_APT=$(which apt | grep -w "apt" | wc -l) +USES_RPM=$(which rpm | grep -w "rpm" | wc -l) + +if [ $USES_APT -eq 1 ]; then + curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh + sudo chmod 500 nsolid_setup_deb.sh + sudo ./nsolid_setup_deb.sh 20 + sudo apt-get install nodejs -y + +elif [ $USES_RPM -eq 1 ]; then + curl -SLO https://rpm.nodesource.com/nsolid_setup_rpm.sh + sudo chmod 500 nsolid_setup_rpm.sh + sudo ./nsolid_setup_rpm.sh 20 + sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 +fi + +echo "Done" +echo "" diff --git a/playwright/ci-test/package.json b/playwright/ci-test/package.json new file mode 100644 index 0000000..b0c259c --- /dev/null +++ b/playwright/ci-test/package.json @@ -0,0 +1,20 @@ +{ + "name": "ci-test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "directories": { + "test": "tests" + }, + "scripts": {}, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@playwright/test": "^1.39.0", + "@types/node": "^20.8.9" + }, + "dependencies": { + "playwright": "^1.39.0" + } +} diff --git a/playwright/ci-test/playwright-path.sh b/playwright/ci-test/playwright-path.sh new file mode 100755 index 0000000..41a24a0 --- /dev/null +++ b/playwright/ci-test/playwright-path.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +echo "This script will discover the path to your playwright install" +echo "If you are not in a NixOS environment and it is not installed," +echo "playwright will be installed." +echo "" +echo "At the end of calling this script , you should have a PLAYWRIGHT" +echo "" + +# Are we on nixos or a distro with Nix installed for packages +# Y + # Are we in direnv? + # Y: should all be set up + # N: run nix-shell +#N + # Are we in a deb based distro? + # Are we in an rpm based distro? + # Are we on macOS? + # Are we in windows? + +HAS_PLAYWRIGHT=$(which playwright 2> /dev/null | grep -v "which: no" | wc -l) +PLAYWRIGHT="playwright" +if [ $HAS_PLAYWRIGHT -eq 0 ]; then + PLAYWRIGHT="npx playwright" + + # check if OS is a deb based distro and uses apt + USES_APT=$(which apt 2> /dev/null | grep -w "apt" | wc -l) + # check if OS is an rpm-based distro + USES_RPM=$(which rpm | grep -w "rpm" | wc -l) + + if [ $USES_APT -eq 1 ]; then + # check if nodejs is installed + HAS_NODEJS=$(which node | grep -w "node" | wc -l) + + # if nodejs is present then + if [ $HAS_NODEJS -eq 0 ]; then + source nodesource-install.sh + fi + + # check if npm is present + HAS_NPM=$(which npm | grep -w "npm" | wc -l) + + if [ $HAS_NPM -eq 1 ]; then + NPM="npm" + PLAYWRIGHT_INSTALL=$($NPM ls --depth 1 playwright | grep -w "@playwright/test" | wc -l) + + if [ $PLAYWRIGHT_INSTALL -eq 0 ]; then + $NPM install -D @playwright/test@latest + $NPM ci + $PLAYWRIGHT install --with-deps chromium + fi + + fi + + elif [ $USES_RPM -eq 1 ]; then + + # check if nodejs is installed + HAS_NODEJS=$(which node | grep -w "node" | wc -l) + + # if nodejs is present then + if [ $HAS_NODEJS -eq 0 ]; then + source nodesource-install.sh + fi + + # check if npm is present + HAS_NPM=$(which npm | grep -w "npm" | wc -l) + + if [ $HAS_NPM -eq 1 ]; then + NPM="npm" + PLAYWRIGHT_INSTALL=$($NPM ls --depth 1 playwright | grep -w "@playwright/test" | wc -l) + + if [ $PLAYWRIGHT_INSTALL -eq 0 ]; then + $NPM install -D @playwright/test@latest + $NPM ci + $PLAYWRIGHT install + fi + + fi + fi +fi + +echo "Done." +echo "" diff --git a/playwright/ci-test/playwright.config.ts b/playwright/ci-test/playwright.config.ts new file mode 100644 index 0000000..f1f554f --- /dev/null +++ b/playwright/ci-test/playwright.config.ts @@ -0,0 +1,86 @@ + +import { defineConfig, devices } from '@playwright/test'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ + +//require('dotenv').config(); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + testDir: './tests', + /* Run tests in files in parallel */ + timeout: 30 * 1000, + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + // baseURL: 'http://127.0.0.1:3000', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + baseURL: process.env.STAGING === '1' ? 'http://example.com' : 'http://localhost:61100/' + }, + + /* Configure projects for major browsers */ + projects: [ + { name: 'setup', testMatch: /.*\.setup\.ts/ }, + { + name: 'chromium', + use: { ...devices['Desktop Chrome'], + // Use prepared auth state. + storageState: 'auth.json', + }, + dependencies: ['setup'], + }, + // + // { + // name: 'firefox', + // use: { ...devices['Desktop Firefox'] }, + // }, + // + // { + // name: 'webkit', + // use: { ...devices['Desktop Safari'] }, + // }, + + /* Test against mobile viewports. */ + // { + // name: 'Mobile Chrome', + // use: { ...devices['Pixel 5'] }, + // }, + // { + // name: 'Mobile Safari', + // use: { ...devices['iPhone 12'] }, + // }, + + /* Test against branded browsers. */ + // { + // name: 'Microsoft Edge', + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, + // }, + // { + // name: 'Google Chrome', + // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, + // }, + ], + + /* Run your local dev server before starting the tests */ + // webServer: { + // command: 'npm run start', + // url: 'http://127.0.0.1:3000', + // reuseExistingServer: !process.env.CI, + // }, +}); diff --git a/playwright/ci-test/record-test.sh b/playwright/ci-test/record-test.sh new file mode 100755 index 0000000..6b4fb74 --- /dev/null +++ b/playwright/ci-test/record-test.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +source base-url.sh + +source playwright-path.sh + +if [ -z "$1" ] +then + echo "Usage: $0 TESTNAME" + echo "e.g. $0 mytest" + echo "will write a new test to tests/mytest.spec.ts" + echo "Do not use spaces in your test name." + echo "" + echo "After recording your test, close the test browser." + echo "You can then run your test by doing:" + echo "npx playwright test tests/mytest.spec.py" + exit +else + echo "Recording test to tests/${1}" +fi + +if [ -w "tests/${1}.spec.ts" ]; then + # File exists and write permission granted to user + # show prompt + echo "File tests/${1}.spec.ts exists. Overwrite? y/n" + read ANSWER + case $ANSWER in + [yY] ) echo "Writing recorded test to tests/${1}.spec.ts" ;; + [nN] ) echo "Cancelled."; exit ;; + esac +fi +TESTNAME=$1 + +$PLAYWRIGHT \ + codegen \ + --target playwright-test \ + --load-storage=auth.json \ + -o tests/$1.spec.ts \ + $BASE_URL + + +echo "Test recording completed." +echo "You can then run your test by doing:" +echo "./run-tests.sh" diff --git a/playwright/ci-test/run-tests.sh b/playwright/ci-test/run-tests.sh new file mode 100755 index 0000000..5ff10ab --- /dev/null +++ b/playwright/ci-test/run-tests.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +source playwright-path.sh + +echo "This script will run the tests defined in tests/" +echo "Before running the tests you need to create the auth config" +echo "" + +$PLAYWRIGHT \ + test \ + --ui \ + --project chromium + +echo "--done--" diff --git a/playwright/ci-test/shell.nix b/playwright/ci-test/shell.nix new file mode 100644 index 0000000..595c145 --- /dev/null +++ b/playwright/ci-test/shell.nix @@ -0,0 +1,28 @@ +let + # + # Note that I am using a snapshot from NixOS unstable here + # so that we can use a more bleeding edge version which includes the test --ui . + # If you want use a different version, go to nix packages search, and find the + # github hash of the version you want to be using, then replace in the URL below. + # + nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/4059c4f71b3a7339261c0183e365fd8016f24bdb.tar.gz"; + pkgs = import nixpkgs { config = { }; overlays = [ ]; }; +in +with pkgs; +mkShell { + buildInputs = [ + nodejs + playwright-test + # python311Packages.playwright + # python311Packages.pytest + ]; + + PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}"; + + shellHook = '' + # Remove playwright from node_modules, so it will be taken from playwright-test + rm node_modules/@playwright/ -R + export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers} + export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true + ''; +} diff --git a/playwright/ci-test/tests/auth.setup.ts b/playwright/ci-test/tests/auth.setup.ts new file mode 100644 index 0000000..0f5ead4 --- /dev/null +++ b/playwright/ci-test/tests/auth.setup.ts @@ -0,0 +1,38 @@ +import { test as setup, expect } from '@playwright/test'; + +let url = '/'; + +let user_email = 'admin@example.com'; +let password = 'admin'; +const authFile = 'auth.json'; + + +setup.describe('login', () => { + + setup('login', async ({page}) => { + + await page.goto(url); + + const buttonSelector = 'LOGIN'; + + await page.waitForSelector(buttonSelector, {timeout: 2000}); + + const initialURL = page.url(); + + await page.click(buttonSelector); + + await page.waitForURL('**/login/'); + + await expect(page.getByRole('heading', { name: 'Login' })).toBeVisible(); + + await page.getByPlaceholder('E-mail address').fill(user_email); + + await page.getByPlaceholder('Password').fill(password); + + await page.getByRole('button', { name: 'LOGIN' }).click(); + + await page.context().storageState({ path: authFile }); + + }); + +}); diff --git a/playwright/ci-test/tests/landingPage.spec.ts b/playwright/ci-test/tests/landingPage.spec.ts new file mode 100644 index 0000000..83b3eb0 --- /dev/null +++ b/playwright/ci-test/tests/landingPage.spec.ts @@ -0,0 +1,18 @@ +import { test, expect } from '@playwright/test'; + +let url = '/'; + + +test.describe('navigation', () => { + test.beforeEach(async ({ page }) => { + // Go to the starting url before each test. + await page.goto(url); + }); + + test('has title', async ({ page }) => { + await page.waitForSelector('.landing-page-banner-text-header', { timeout: 2000 }); + await expect(page.locator('div.landing-page-banner-text-header')).toHaveText(); + }) + test('navigates', async ({page}) => { + }); +}); diff --git a/playwright/staging-tests/.envrc b/playwright/staging-tests/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/playwright/staging-tests/.envrc @@ -0,0 +1 @@ +use nix diff --git a/playwright/staging-tests/.gitignore b/playwright/staging-tests/.gitignore new file mode 100644 index 0000000..af81d4c --- /dev/null +++ b/playwright/staging-tests/.gitignore @@ -0,0 +1,10 @@ +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ +*auth.json +.env +.direnv/ +/test-results/ +__pycache__ diff --git a/playwright/staging-tests/README.md b/playwright/staging-tests/README.md new file mode 100644 index 0000000..ac0de06 --- /dev/null +++ b/playwright/staging-tests/README.md @@ -0,0 +1,72 @@ +# Validation Tests + +These tests are designed to run from your local machine (i.e. not from a GitHub action or CI). +The are intended to verify basic functionality is working after a deployment is made to staging, and prior to deployment to production. + +## Essential reading: + +* https://playwright.dev/ +* https://direnv.net/docs/installation.html + +## Setting up your environment + +Before you can run or record tests, you need to set up your environment. + +Running these tests require playwright set up on your local machine, as well as NodeJS. + +**NixOS** + +If you are a NixOS user, you can set up direnv and then cd into this directory in your shell. + +When you do so the first time, you will be prompted to allow direnv which you can do using this command: + + +``` +direnv allow +``` + +>  This may take a while the first time as NixOS builds you a sandbox environment. + +**NON-NixOS** + +For a non-NixOS user(Debian/Ubuntu) set up your environment by the following commands: + +```bash +npm install +``` + +To install playwright browsers with OS-level dependencies use: + + +```bash +npm playwright install --with-deps chromium +``` + +**NOTE:** This only works with Debian/Ubuntu as they recieve official support from playwright. It will also request your master password to install the dependencies. + +## Recording a test + +There is a bash helper script that will let you quickly create a new test: + +``` +Usage: ./record-test.sh TESTNAME +e.g. ./record-test.sh mytest +will write a new test to tests/mytest.spec.ts +Do not use spaces in your test name. +Test files MUST END in .spec.ts + +After recording your test, close the test browser. +You can then run your test by doing: +./run-tests.sh +``` + + +>  The first time you record a test, it will store your session credentials in a file ending in ``auth.json``. This file should **NEVER** be committed to git / shared publicly. There is a gitignore rule to ensure this. + +## Running a test + + +``` +./run-tests.sh +``` + diff --git a/playwright/staging-tests/base-url.sh b/playwright/staging-tests/base-url.sh new file mode 100755 index 0000000..2b3082e --- /dev/null +++ b/playwright/staging-tests/base-url.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +echo "Setting BASE_URL for test site" +BASE_URL=https://example.com diff --git a/playwright/staging-tests/create-auth.sh b/playwright/staging-tests/create-auth.sh new file mode 100755 index 0000000..386a047 --- /dev/null +++ b/playwright/staging-tests/create-auth.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +source base-url.sh + +source playwright-path.sh + +echo "This script will write a new test to tests/deleteme.spec.ts" +echo "then delete it, leaving only the auth config." +echo "" +echo "When the playwright browser opens, log in to the site then exit." +echo "After recording your test, close the test browser." +echo "Recording auth token to auth.json" + +# File exists and write permission granted to user +# show prompt +echo "Continue? y/n" +read ANSWER +case $ANSWER in + [yY] ) echo "Writing auth.json" ;; + [nN] ) echo "Cancelled."; exit ;; +esac + +$PLAYWRIGHT \ + codegen \ + --target playwright-test \ + --save-storage=auth.json \ + -o tests/deleteme.spec.ts \ + $BASE_URL + +# We are only interested in auth.json +rm tests/deleteme.spec.ts + +echo "Auth file creation completed." +echo "You can then run your tests by doing e.g.:" +echo "playwright test --project chromium" diff --git a/playwright/staging-tests/nodesource-install.sh b/playwright/staging-tests/nodesource-install.sh new file mode 100755 index 0000000..eb2ef0f --- /dev/null +++ b/playwright/staging-tests/nodesource-install.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +echo "NodeJS will be installed if not present" +echo "sudo password will be required" + +USES_APT=$(which apt | grep -w "apt" | wc -l) +USES_RPM=$(which rpm | grep -w "rpm" | wc -l) + +if [ $USES_APT -eq 1 ]; then + curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh + sudo chmod 500 nsolid_setup_deb.sh + sudo ./nsolid_setup_deb.sh 20 + sudo apt-get install nodejs -y + +elif [ $USES_RPM -eq 1 ]; then + curl -SLO https://rpm.nodesource.com/nsolid_setup_rpm.sh + sudo chmod 500 nsolid_setup_rpm.sh + sudo ./nsolid_setup_rpm.sh 20 + sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 +fi + +echo "Done" +echo "" diff --git a/playwright/staging-tests/package-lock.json b/playwright/staging-tests/package-lock.json new file mode 100644 index 0000000..515588d --- /dev/null +++ b/playwright/staging-tests/package-lock.json @@ -0,0 +1,91 @@ +{ + "name": "staging-tests", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "staging-tests", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "@playwright/test": "^1.40.1", + "@types/node": "^20.8.9" + } + }, + "node_modules/@playwright/test": { + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.1.tgz", + "integrity": "sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==", + "dev": true, + "dependencies": { + "playwright": "1.40.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@types/node": { + "version": "20.9.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.2.tgz", + "integrity": "sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/playwright": { + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz", + "integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==", + "dev": true, + "dependencies": { + "playwright-core": "1.40.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz", + "integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==", + "dev": true, + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + } + } +} diff --git a/playwright/staging-tests/package.json b/playwright/staging-tests/package.json new file mode 100644 index 0000000..a76e840 --- /dev/null +++ b/playwright/staging-tests/package.json @@ -0,0 +1,14 @@ +{ + "name": "staging-tests", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": {}, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@playwright/test": "^1.40.1", + "@types/node": "^20.8.9" + } +} diff --git a/playwright/staging-tests/playwright-path.sh b/playwright/staging-tests/playwright-path.sh new file mode 100755 index 0000000..41a24a0 --- /dev/null +++ b/playwright/staging-tests/playwright-path.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +echo "This script will discover the path to your playwright install" +echo "If you are not in a NixOS environment and it is not installed," +echo "playwright will be installed." +echo "" +echo "At the end of calling this script , you should have a PLAYWRIGHT" +echo "" + +# Are we on nixos or a distro with Nix installed for packages +# Y + # Are we in direnv? + # Y: should all be set up + # N: run nix-shell +#N + # Are we in a deb based distro? + # Are we in an rpm based distro? + # Are we on macOS? + # Are we in windows? + +HAS_PLAYWRIGHT=$(which playwright 2> /dev/null | grep -v "which: no" | wc -l) +PLAYWRIGHT="playwright" +if [ $HAS_PLAYWRIGHT -eq 0 ]; then + PLAYWRIGHT="npx playwright" + + # check if OS is a deb based distro and uses apt + USES_APT=$(which apt 2> /dev/null | grep -w "apt" | wc -l) + # check if OS is an rpm-based distro + USES_RPM=$(which rpm | grep -w "rpm" | wc -l) + + if [ $USES_APT -eq 1 ]; then + # check if nodejs is installed + HAS_NODEJS=$(which node | grep -w "node" | wc -l) + + # if nodejs is present then + if [ $HAS_NODEJS -eq 0 ]; then + source nodesource-install.sh + fi + + # check if npm is present + HAS_NPM=$(which npm | grep -w "npm" | wc -l) + + if [ $HAS_NPM -eq 1 ]; then + NPM="npm" + PLAYWRIGHT_INSTALL=$($NPM ls --depth 1 playwright | grep -w "@playwright/test" | wc -l) + + if [ $PLAYWRIGHT_INSTALL -eq 0 ]; then + $NPM install -D @playwright/test@latest + $NPM ci + $PLAYWRIGHT install --with-deps chromium + fi + + fi + + elif [ $USES_RPM -eq 1 ]; then + + # check if nodejs is installed + HAS_NODEJS=$(which node | grep -w "node" | wc -l) + + # if nodejs is present then + if [ $HAS_NODEJS -eq 0 ]; then + source nodesource-install.sh + fi + + # check if npm is present + HAS_NPM=$(which npm | grep -w "npm" | wc -l) + + if [ $HAS_NPM -eq 1 ]; then + NPM="npm" + PLAYWRIGHT_INSTALL=$($NPM ls --depth 1 playwright | grep -w "@playwright/test" | wc -l) + + if [ $PLAYWRIGHT_INSTALL -eq 0 ]; then + $NPM install -D @playwright/test@latest + $NPM ci + $PLAYWRIGHT install + fi + + fi + fi +fi + +echo "Done." +echo "" diff --git a/playwright/staging-tests/playwright.config.js b/playwright/staging-tests/playwright.config.js new file mode 100644 index 0000000..a09bb2c --- /dev/null +++ b/playwright/staging-tests/playwright.config.js @@ -0,0 +1,83 @@ +// @ts-check +const { defineConfig, devices } = require('@playwright/test'); + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// require('dotenv').config(); + +/** + * @see https://playwright.dev/docs/test-configuration + */ +module.exports = defineConfig({ + testDir: './tests', + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + // baseURL: 'http://127.0.0.1:3000', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'], + // Use prepared auth state. + storageState: 'auth.json', + }, + // dependencies: ['setup'], + }, + + // { + // name: 'firefox', + // use: { ...devices['Desktop Firefox'] }, + // }, + + // { + // name: 'webkit', + // use: { ...devices['Desktop Safari'] }, + // }, + + /* Test against mobile viewports. */ + // { + // name: 'Mobile Chrome', + // use: { ...devices['Pixel 5'] }, + // }, + // { + // name: 'Mobile Safari', + // use: { ...devices['iPhone 12'] }, + // }, + + /* Test against branded browsers. */ + // { + // name: 'Microsoft Edge', + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, + // }, + // { + // name: 'Google Chrome', + // use: { ..devices['Desktop Chrome'], channel: 'chrome' }, + // }, + ], + + /* Run your local dev server before starting the tests */ + // webServer: { + // command: 'npm run start', + // url: 'http://127.0.0.1:3000', + // reuseExistingServer: !process.env.CI, + // }, +}); + diff --git a/playwright/staging-tests/record-test.sh b/playwright/staging-tests/record-test.sh new file mode 100755 index 0000000..6b4fb74 --- /dev/null +++ b/playwright/staging-tests/record-test.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +source base-url.sh + +source playwright-path.sh + +if [ -z "$1" ] +then + echo "Usage: $0 TESTNAME" + echo "e.g. $0 mytest" + echo "will write a new test to tests/mytest.spec.ts" + echo "Do not use spaces in your test name." + echo "" + echo "After recording your test, close the test browser." + echo "You can then run your test by doing:" + echo "npx playwright test tests/mytest.spec.py" + exit +else + echo "Recording test to tests/${1}" +fi + +if [ -w "tests/${1}.spec.ts" ]; then + # File exists and write permission granted to user + # show prompt + echo "File tests/${1}.spec.ts exists. Overwrite? y/n" + read ANSWER + case $ANSWER in + [yY] ) echo "Writing recorded test to tests/${1}.spec.ts" ;; + [nN] ) echo "Cancelled."; exit ;; + esac +fi +TESTNAME=$1 + +$PLAYWRIGHT \ + codegen \ + --target playwright-test \ + --load-storage=auth.json \ + -o tests/$1.spec.ts \ + $BASE_URL + + +echo "Test recording completed." +echo "You can then run your test by doing:" +echo "./run-tests.sh" diff --git a/playwright/staging-tests/run-tests.sh b/playwright/staging-tests/run-tests.sh new file mode 100755 index 0000000..5ff10ab --- /dev/null +++ b/playwright/staging-tests/run-tests.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +source playwright-path.sh + +echo "This script will run the tests defined in tests/" +echo "Before running the tests you need to create the auth config" +echo "" + +$PLAYWRIGHT \ + test \ + --ui \ + --project chromium + +echo "--done--" diff --git a/playwright/staging-tests/shell.nix b/playwright/staging-tests/shell.nix new file mode 100644 index 0000000..595c145 --- /dev/null +++ b/playwright/staging-tests/shell.nix @@ -0,0 +1,28 @@ +let + # + # Note that I am using a snapshot from NixOS unstable here + # so that we can use a more bleeding edge version which includes the test --ui . + # If you want use a different version, go to nix packages search, and find the + # github hash of the version you want to be using, then replace in the URL below. + # + nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/4059c4f71b3a7339261c0183e365fd8016f24bdb.tar.gz"; + pkgs = import nixpkgs { config = { }; overlays = [ ]; }; +in +with pkgs; +mkShell { + buildInputs = [ + nodejs + playwright-test + # python311Packages.playwright + # python311Packages.pytest + ]; + + PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}"; + + shellHook = '' + # Remove playwright from node_modules, so it will be taken from playwright-test + rm node_modules/@playwright/ -R + export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers} + export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true + ''; +} diff --git a/playwright/staging-tests/tests/test.spec.ts b/playwright/staging-tests/tests/test.spec.ts new file mode 100644 index 0000000..623eb63 --- /dev/null +++ b/playwright/staging-tests/tests/test.spec.ts @@ -0,0 +1,18 @@ +import { test, expect } from '@playwright/test'; + +test.use({ + storageState: 'auth.json' +}); + +test('test', async ({ page }) => { + await page.goto('https://example.com/'); + await expect(page.getByRole('heading', { name: 'Example Domain' })).toBeVisible(); + await expect(page.getByText('This domain is for use in')).toBeVisible(); + await page.getByRole('heading', { name: 'Example Domain' }).click(); + await page.getByText('This domain is for use in').click(); + await page.getByRole('link', { name: 'More information...' }).click(); + await page.getByRole('heading', { name: 'Example Domains' }).click(); + await page.getByRole('link', { name: 'Homepage' }).click(); + await page.locator('h1').click(); + await page.getByText('The global coordination of').click(); +}); \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5b1c45a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,21 @@ +#Alternative for pdf creation - broken on nixos and lately ubuntu +mkdocs-with-pdf +# Export to pdf - see https://comwes.github.io/mkpdfs-mkdocs-plugin/index.html +#mkpdfs-mkdocs +# Rather do +# pip install -e git+https://github.com/jwaschkau/mkpdfs-mkdocs-plugin.git#egg=mkpdfs-mkdocs +mkdocs-material +mdx_gh_links +mkdocs-pdf-export-plugin +mkdocstrings-python +mkdocs-video +mkdocs-redirects +mkdocs-enumerate-headings-plugin +mkdocs-git-revision-date-localized-plugin +# needed for the create-uuid.py helper script +shortuuid +# Needed for mkdocstrings python documentation generator +black +cffi +# Needed for PDF back page QR Code +qrcode diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..712eb3d --- /dev/null +++ b/shell.nix @@ -0,0 +1,20 @@ +{ pkgs ? import {}}: + +let + my-python = pkgs.python310; + python-with-my-packages = my-python.withPackages + (p: with p; [ + mkdocs + mkdocs-material + ]); +in pkgs.mkShell { + packages = [ + pkgs.vim + ]; + buildInputs = [ + python-with-my-packages + ]; + shellHook = '' + PYTHONPATH=${python-with-my-packages}/${python-with-my-packages.sitePackages} + ''; +}