Skip to content

Commit

Permalink
feat: add graphical user interface (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
tepene authored May 10, 2024
1 parent c3ed45a commit 4f2130b
Show file tree
Hide file tree
Showing 43 changed files with 2,939 additions and 971 deletions.
38 changes: 33 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,37 @@
"version": "1.8.2"
}
},
// Create symbolic link for forge data dir mount
"initializeCommand": "${localWorkspaceFolder}/.devcontainer/prepare_mount.sh",
// Container user definition - This is needed for compatibility with podman -> https://github.com/containers/podman/issues/15001#issuecomment-1193321924
"remoteUser": "vscode",
"containerUser": "vscode",
// Container environment variables
"containerEnv": {
// poetry settings
"POETRY_VIRTUALENVS_CREATE": "false",
"LAZYGIT_VERSION": "0.41.0"
// lazygit settings
"LAZYGIT_VERSION": "0.41.0",
// Nicegui settings
"NICEGUI_DIR": "/workspaces/forge/anvil/nicegui",
// Ansible settings
"ANSIBLE_DIR": "/workspaces/forge/anvil/ansible",
"ANSIBLE_INVENTORY": "${ANSIBLE_DIR}/inventory.yml",
"ANSIBLE_CACHE_PLUGIN": "community.general.yaml",
"ANSIBLE_CACHE_PLUGIN_CONNECTION": "${ANSIBLE_DIR}/fact_cache",
"ANSIBLE_ROLES_PATH": "${ANSIBLE_DIR}/roles",
"ANSIBLE_COLLECTIONS_PATH": "${ANSIBLE_DIR}/collections",
"ANSIBLE_PRIVATE_KEY_FILE": "/certs/ssh/ublue-os_forge-id_ed25519",
"ANSIBLE_DISPLAY_SKIPPED_HOSTS": "False",
"ANSIBLE_STDOUT_CALLBACK": "yaml",
"ANSIBLE_CALLBACKS_ENABLED": "ansible.posix.profile_tasks",
"ANSIBLE_HOST_KEY_CHECKING:": "False"
},
// Mount folder from host system
"mounts": [
// forge config data folder | used for testing only
"source=${localWorkspaceFolder}/.devcontainer/mountpoint,target=/data,type=bind,consistency=cached"
],
// Install and configure DEV tools
"postCreateCommand": "bash ./.devcontainer/install-dev-tools.sh",
// VSCode settings
Expand Down Expand Up @@ -52,23 +75,28 @@
"**/playbooks/*.yml": "ansible",
"**/roles/**/tasks/*.yml": "ansible",
"**/inventory*.yml": "ansible",
"**/*.just": "just"
"**/*.just": "just",
"**/.containerignore": "ignore"
},
// Python configuration
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
// Ansible configuration
"ansible.validation.enabled": true,
"ansible.validation.lint.arguments": "-c ansible/.ansible-lint",
"ansible.validation.lint.arguments": "-c /workspaces/forge/anvil/ansible/.ansible-lint",
"ansible.python.interpreterPath": "/usr/local/python/current/bin/python",
"ansible.ansible.reuseTerminal": true,
"ansible.lightspeed.enabled": true,
"ansible.lightspeed.suggestions.enabled": true,
"ansible.lightspeed.URL": "https://c.ai.ansible.redhat.com",
// Template configuration
"templates.folder": "./.vscode/templates",
"templates.folder": "${localWorkspaceFolder}/.vscode/templates",
// Spell-Check configuration
"cSpell.customDictionaries": {
"project-words": {
"name": "custom-dictionary",
"path": "${workspaceRoot}/.vscode/cspell_custom.txt",
"path": "${workspaceFolder}/.vscode/cspell_custom.txt",
"description": "Words used in this project",
"addWords": true
},
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/forge.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"folders": [
{
"path": ".."
},
{
"path": "../../../data"
}
],
"settings": {
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/install-dev-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ git config --local commit.template .gitmessage
echo ""
echo -e "${YELLOW}Installing project dependencies${ENDCOLOR}"
echo ""
poetry install --no-root -C /workspaces/forge/ansible
poetry install --no-root -C /workspaces/forge/anvil

# Install ansible dependencies
echo ""
echo -e "${YELLOW}Installing ansible dependencies${ENDCOLOR}"
echo ""
ansible-galaxy collection install -r /workspaces/forge/ansible/collections/requirements.yml
ansible-galaxy collection install --force -r /workspaces/forge/anvil/ansible/collections/requirements.yml

# Finish
echo ""
Expand Down
13 changes: 13 additions & 0 deletions .devcontainer/prepare_mount.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# bin/bash

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
FORGE_POD_DATA_DIR="$(podman volume inspect ublue-os_forge-data | jq -r '.[0].Mountpoint')"
MOUNTPOINT_SYMLINK="$SCRIPT_DIR/mountpoint"

echo "Preparing mount"
if [ -L $MOUNTPOINT_SYMLINK ]; then
echo "Existing symlink found. Doing nothing"
else
echo "No existing symlink found. Creating new"
ln -s $FORGE_POD_DATA_DIR $MOUNTPOINT_SYMLINK
fi
172 changes: 169 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,169 @@
# ansible
**/ansible/collections/*
!**/ansible/collections/requirements.yml
## Devcontainer
.devcontainer/mountpoint

## Ansible
**/collections
!**/collections/requirements.yml
**/fact_cache

## Python
# 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/
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/
cover/

# Translations
*.mo
*.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
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__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/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
6 changes: 6 additions & 0 deletions .vscode/cspell_custom.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
aggrid
CHACHA
configmap
containerignore
devcontainer
devcontainers
dotenv
ENDCOLOR
ensurepath
envsubst
Expand All @@ -14,6 +17,7 @@ lightspeed
lineinfile
minica
Mountpoint
nicegui
noarchive
noimageindex
Nosniff
Expand All @@ -23,11 +27,13 @@ pipx
posix
Proto
redirections
refreshable
rvproxy
serverstransport
traefik
ublue
varnames
venvs
VIRTUALENVS
wantlist
websecure
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: NiceGui",
"type": "debugpy",
"request": "launch",
"program": "anvil/nicegui/main.py",
"console": "integratedTerminal",
"autoStartBrowser": true,
"cwd": "${workspaceFolder}"
}
]
}
25 changes: 0 additions & 25 deletions ansible/Containerfile

This file was deleted.

23 changes: 0 additions & 23 deletions ansible/ansible.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions ansible/entrypoint.sh

This file was deleted.

4 changes: 0 additions & 4 deletions ansible/group_vars/all/data.yml

This file was deleted.

Loading

0 comments on commit 4f2130b

Please sign in to comment.