wip - devcontainer enhancements

This commit is contained in:
Stephan Lüscher 2024-05-09 21:00:56 +00:00
parent 9895bc3bc5
commit aaa38993bd
No known key found for this signature in database
GPG key ID: 445779060FF3D3CF
7 changed files with 65 additions and 4 deletions

View file

@ -16,14 +16,35 @@
"version": "1.8.2" "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 // Container user definition - This is needed for compatibility with podman -> https://github.com/containers/podman/issues/15001#issuecomment-1193321924
"remoteUser": "vscode", "remoteUser": "vscode",
"containerUser": "vscode", "containerUser": "vscode",
// Container environment variables // Container environment variables
"containerEnv": { "containerEnv": {
// poetry settings
"POETRY_VIRTUALENVS_CREATE": "false", "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 // Install and configure DEV tools
"postCreateCommand": "bash ./.devcontainer/install-dev-tools.sh", "postCreateCommand": "bash ./.devcontainer/install-dev-tools.sh",
// VSCode settings // VSCode settings
@ -60,7 +81,7 @@
}, },
// Ansible configuration // Ansible configuration
"ansible.validation.enabled": true, "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.python.interpreterPath": "/usr/local/python/current/bin/python",
"ansible.ansible.reuseTerminal": true, "ansible.ansible.reuseTerminal": true,
"ansible.lightspeed.enabled": true, "ansible.lightspeed.enabled": true,
@ -72,7 +93,7 @@
"cSpell.customDictionaries": { "cSpell.customDictionaries": {
"project-words": { "project-words": {
"name": "custom-dictionary", "name": "custom-dictionary",
"path": "${workspaceRoot}/.vscode/cspell_custom.txt", "path": "${workspaceFolder}/.vscode/cspell_custom.txt",
"description": "Words used in this project", "description": "Words used in this project",
"addWords": true "addWords": true
}, },

View file

@ -2,6 +2,9 @@
"folders": [ "folders": [
{ {
"path": ".." "path": ".."
},
{
"path": "../../../data"
} }
], ],
"settings": { "settings": {

View file

@ -39,7 +39,7 @@ poetry install --no-root -C /workspaces/forge/anvil
echo "" echo ""
echo -e "${YELLOW}Installing ansible dependencies${ENDCOLOR}" echo -e "${YELLOW}Installing ansible dependencies${ENDCOLOR}"
echo "" 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 # Finish
echo "" echo ""

13
.devcontainer/prepare_mount.sh Executable file
View file

@ -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

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
## Devcontainer
.devcontainer/mountpoint
## Ansible ## Ansible
**/collections **/collections
!**/collections/requirements.yml !**/collections/requirements.yml

View file

@ -1,7 +1,9 @@
aggrid
CHACHA CHACHA
configmap configmap
devcontainer devcontainer
devcontainers devcontainers
dotenv
ENDCOLOR ENDCOLOR
ensurepath ensurepath
envsubst envsubst
@ -24,11 +26,13 @@ pipx
posix posix
Proto Proto
redirections redirections
refreshable
rvproxy rvproxy
serverstransport serverstransport
traefik traefik
ublue ublue
varnames varnames
venvs venvs
VIRTUALENVS
wantlist wantlist
websecure websecure

17
.vscode/launch.json vendored Normal file
View file

@ -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}"
}
]
}