diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 05bce14..a228718 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,14 +16,35 @@ "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_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 @@ -60,7 +81,7 @@ }, // 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, @@ -72,7 +93,7 @@ "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 }, diff --git a/.devcontainer/forge.code-workspace b/.devcontainer/forge.code-workspace index 2e33fd2..019ea8c 100644 --- a/.devcontainer/forge.code-workspace +++ b/.devcontainer/forge.code-workspace @@ -2,6 +2,9 @@ "folders": [ { "path": ".." + }, + { + "path": "../../../data" } ], "settings": { diff --git a/.devcontainer/install-dev-tools.sh b/.devcontainer/install-dev-tools.sh index 4b6eaad..eac5b14 100644 --- a/.devcontainer/install-dev-tools.sh +++ b/.devcontainer/install-dev-tools.sh @@ -39,7 +39,7 @@ poetry install --no-root -C /workspaces/forge/anvil echo "" echo -e "${YELLOW}Installing ansible dependencies${ENDCOLOR}" echo "" -ansible-galaxy collection install -r /workspaces/forge/anvil/ansible/collections/requirements.yml +ansible-galaxy collection install --force -r /workspaces/forge/anvil/ansible/collections/requirements.yml # Finish echo "" diff --git a/.devcontainer/prepare_mount.sh b/.devcontainer/prepare_mount.sh new file mode 100755 index 0000000..2fb165d --- /dev/null +++ b/.devcontainer/prepare_mount.sh @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2552ea3..63ce326 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +## Devcontainer +.devcontainer/mountpoint + ## Ansible **/collections !**/collections/requirements.yml diff --git a/.vscode/cspell_custom.txt b/.vscode/cspell_custom.txt index e87ad30..7a394ab 100644 --- a/.vscode/cspell_custom.txt +++ b/.vscode/cspell_custom.txt @@ -1,7 +1,9 @@ +aggrid CHACHA configmap devcontainer devcontainers +dotenv ENDCOLOR ensurepath envsubst @@ -24,11 +26,13 @@ pipx posix Proto redirections +refreshable rvproxy serverstransport traefik ublue varnames venvs +VIRTUALENVS wantlist websecure diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d12d169 --- /dev/null +++ b/.vscode/launch.json @@ -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}" + } + ] +}