10 files + 386 − 1 Inline Compare changes Side-by-side Inline Show whitespace changes Files 10 .docker/entrypoint.sh 0 → 100644 +49 −0 Original line number Diff line number Diff line #!/bin/bash echo "Copying static files ..." cp -r /usr/share/uffd/uffd/static /var/www/uffd db_ready="false" count=0 while [ $count -lt 4 ] && [ "$db_ready" != "true" ] ;do if uffd-admin db current >> /dev/null 2>&1 ;then db_ready="true" else echo "Waiting for db to become ready..." ((duration=2**$count)) sleep $duration ((count=$count+1)) fi done if [ "$db_ready" == "true" ] ;then echo "Running datbase migrations ..." uffd-admin db upgrade if [ -n "$UFFD_INITIAL_ADMIN_PW" ] && [ "$(uffd-admin user list)" == "" ]; then echo "Creating groups and roles for initial admin user ..." if ! uffd-admin group show 'uffd_admin' >> /dev/null 2>&1 ;then uffd-admin group create 'uffd_admin' fi if ! uffd-admin group show 'uffd_access' >> /dev/null 2>&1 ;then uffd-admin group create 'uffd_access' fi if ! uffd-admin role show 'uffd_admin' >> /dev/null 2>&1 ;then uffd-admin role create 'uffd_admin' --add-group 'uffd_admin' --add-group 'uffd_access' fi if [ -z "$UFFD_INITIAL_ADMIN_USER" ] ;then UFFD_INITIAL_ADMIN_USER='uffd_admin' fi if [ -z "$UFFD_INITIAL_ADMIN_MAIL" ] ;then UFFD_INITIAL_ADMIN_MAIL='uffd_admin@localhost' fi echo "Creating initial admin user ..." uffd-admin user create "$UFFD_INITIAL_ADMIN_USER" --password "$UFFD_INITIAL_ADMIN_PW" --mail "$UFFD_INITIAL_ADMIN_MAIL" --add-role 'uffd_admin' fi else echo "WARNING: Database is not ready yet, skipping migration and initialization" fi echo "Starting server ..." runuser --preserve-environment -u uffd -- \ uwsgi --ini /etc/uwsgi/apps-enabled/uffd.ini --socket 0.0.0.0:3031 --master --stats 0.0.0.0:9191 .dockerignore 0 → 100644 +158 −0 Original line number Diff line number Diff line examples tests ## All below is copied from .gitignore at 05460269538ad6b2bd8b80f6f8a6202cee1dd065 # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ # Translations *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # Swap [._]*.s[a-v][a-z] !*.svg # comment out if you don't need vector files [._]*.sw[a-p] [._]s[a-rt-v][a-z] [._]ss[a-gi-z] [._]sw[a-p] # Session Session.vim Sessionx.vim # Temporary .netrwhist *~ # Auto-generated tag files tags # Persistent undo [._]*.un~ # Auto-generated development key/certificate devcert.crt devcert.key .gitlab-ci.yml +28 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ variables: APT_API_URL: https://packages.cccv.de APT_REPO: uffd PYLINT_PIN: pylint~=2.10.0 DOCKER_IMAGE_TAG: latest before_script: - python3 -V Loading Loading @@ -40,6 +41,20 @@ build:apt: paths: - ./*.deb build:docker: extends: .build image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] before_script: [] script: - mkdir -p /kaniko/.docker - /kaniko/executor --force --use-new-run --context $CI_PROJECT_DIR --no-push --destination $CI_REGISTRY_IMAGE --tarPath image.tar artifacts: paths: - image.tar when: on_success db_migrations_updated: stage: test script: Loading Loading @@ -221,3 +236,15 @@ publish:apt: - 'curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X PUT -H "Content-Type: application/json" --data "{ }" "${APT_API_URL}/api/publish/uffd/bullseye"' dependencies: - build:apt publish:docker: extends: .publish image: name: gcr.io/go-containerregistry/crane:debug entrypoint: [""] before_script: [] script: - crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - crane push image.tar $CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG needs: - build:docker Dockerfile 0 → 100644 +42 −0 Original line number Diff line number Diff line FROM
.docker/entrypoint.sh 0 → 100644 +49 −0 Original line number Diff line number Diff line #!/bin/bash echo "Copying static files ..." cp -r /usr/share/uffd/uffd/static /var/www/uffd db_ready="false" count=0 while [ $count -lt 4 ] && [ "$db_ready" != "true" ] ;do if uffd-admin db current >> /dev/null 2>&1 ;then db_ready="true" else echo "Waiting for db to become ready..." ((duration=2**$count)) sleep $duration ((count=$count+1)) fi done if [ "$db_ready" == "true" ] ;then echo "Running datbase migrations ..." uffd-admin db upgrade if [ -n "$UFFD_INITIAL_ADMIN_PW" ] && [ "$(uffd-admin user list)" == "" ]; then echo "Creating groups and roles for initial admin user ..." if ! uffd-admin group show 'uffd_admin' >> /dev/null 2>&1 ;then uffd-admin group create 'uffd_admin' fi if ! uffd-admin group show 'uffd_access' >> /dev/null 2>&1 ;then uffd-admin group create 'uffd_access' fi if ! uffd-admin role show 'uffd_admin' >> /dev/null 2>&1 ;then uffd-admin role create 'uffd_admin' --add-group 'uffd_admin' --add-group 'uffd_access' fi if [ -z "$UFFD_INITIAL_ADMIN_USER" ] ;then UFFD_INITIAL_ADMIN_USER='uffd_admin' fi if [ -z "$UFFD_INITIAL_ADMIN_MAIL" ] ;then UFFD_INITIAL_ADMIN_MAIL='uffd_admin@localhost' fi echo "Creating initial admin user ..." uffd-admin user create "$UFFD_INITIAL_ADMIN_USER" --password "$UFFD_INITIAL_ADMIN_PW" --mail "$UFFD_INITIAL_ADMIN_MAIL" --add-role 'uffd_admin' fi else echo "WARNING: Database is not ready yet, skipping migration and initialization" fi echo "Starting server ..." runuser --preserve-environment -u uffd -- \ uwsgi --ini /etc/uwsgi/apps-enabled/uffd.ini --socket 0.0.0.0:3031 --master --stats 0.0.0.0:9191
.dockerignore 0 → 100644 +158 −0 Original line number Diff line number Diff line examples tests ## All below is copied from .gitignore at 05460269538ad6b2bd8b80f6f8a6202cee1dd065 # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ # Translations *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # Swap [._]*.s[a-v][a-z] !*.svg # comment out if you don't need vector files [._]*.sw[a-p] [._]s[a-rt-v][a-z] [._]ss[a-gi-z] [._]sw[a-p] # Session Session.vim Sessionx.vim # Temporary .netrwhist *~ # Auto-generated tag files tags # Persistent undo [._]*.un~ # Auto-generated development key/certificate devcert.crt devcert.key
.gitlab-ci.yml +28 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ variables: APT_API_URL: https://packages.cccv.de APT_REPO: uffd PYLINT_PIN: pylint~=2.10.0 DOCKER_IMAGE_TAG: latest before_script: - python3 -V Loading Loading @@ -40,6 +41,20 @@ build:apt: paths: - ./*.deb build:docker: extends: .build image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] before_script: [] script: - mkdir -p /kaniko/.docker - /kaniko/executor --force --use-new-run --context $CI_PROJECT_DIR --no-push --destination $CI_REGISTRY_IMAGE --tarPath image.tar artifacts: paths: - image.tar when: on_success db_migrations_updated: stage: test script: Loading Loading @@ -221,3 +236,15 @@ publish:apt: - 'curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X PUT -H "Content-Type: application/json" --data "{ }" "${APT_API_URL}/api/publish/uffd/bullseye"' dependencies: - build:apt publish:docker: extends: .publish image: name: gcr.io/go-containerregistry/crane:debug entrypoint: [""] before_script: [] script: - crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - crane push image.tar $CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG needs: - build:docker