Compare commits

...

21 Commits

Author SHA1 Message Date
3a4773ebce Revert "feat: pass private key as env variable SSH_KEY"
This reverts commit 73f25ab8d2.
2025-05-23 15:15:45 +00:00
b88313f598 Revert "feat: remove key mounts"
This reverts commit b41097d23d.
2025-05-23 15:15:41 +00:00
8375989fd2 feat: add command to update secre key 2025-05-23 12:36:55 +00:00
b41097d23d feat: remove key mounts 2025-05-23 12:25:35 +00:00
73f25ab8d2 feat: pass private key as env variable SSH_KEY 2025-05-23 12:22:25 +00:00
c84f7ec54f Revert "feat: pass private key as argument to start.sh"
This reverts commit 5a2cab497c.
2025-05-23 12:19:28 +00:00
0e53249507 feat: add command to update start.sh 2025-05-23 09:40:23 +00:00
5a2cab497c feat: pass private key as argument to start.sh 2025-05-23 09:07:25 +00:00
1cbc443b70 feat: update path of workspaces project to /app/private 2025-05-23 09:02:21 +00:00
63fa06ee66 feat: change name from analytics-backend-workspace to workspaces 2025-05-22 17:12:02 +00:00
cae2b53209 feat: map host uid:gid to 1000:1000 inside container 2025-05-22 16:45:34 +00:00
4f61a71d12 feat: apply host group permissions inside the container 2025-05-22 16:05:18 +00:00
dd0cefd6c9 feat: split data into public and private
enable working with shared podman socket
2025-05-21 11:23:51 +00:00
79e3e0fe3f fix: correct event name mkdir -> create 2025-05-21 10:54:10 +00:00
c9c334c244 refactor: rename setgit -> setgid 2025-05-21 10:50:14 +00:00
0b3473b9c4 feat: add files to setgid on folders inside user public repos 2025-05-21 10:45:23 +00:00
3396a4360a revert: partial reverse of c333b45b (previous commit) 2025-05-20 21:20:35 +00:00
4c7171dc9b feat: add update podman_access command to gitops pipeline 2025-05-20 20:23:27 +00:00
c333b45b76 chore: remove redundant access file 2025-05-20 19:56:02 +00:00
d414a61c62 Revert "feat: add CONTAINER_CONNECTION=my_remote environment variable"
This reverts commit bd9559ad79.
2025-05-20 19:00:05 +00:00
bd9559ad79 feat: add CONTAINER_CONNECTION=my_remote environment variable 2025-05-20 18:52:07 +00:00
5 changed files with 34 additions and 21 deletions

View File

@ -1,13 +0,0 @@
pallav:
fixedArgsCommands:
build:
- base
- workspace
- all
clean:
status:
multiArgsCommands:
remove:
- palak
- param
- darshan

View File

@ -149,9 +149,9 @@ validate_command "$PERSON" "$cmd" "${args[@]}"
case "$cmd" in case "$cmd" in
build) build)
case "${args[0]}" in case "${args[0]}" in
base) podman build --target base -t analytics-backend-base . ;; base) podman build --target base -t workspaces-base . ;;
workspace) podman build --target workspace -t analytics-backend-workspace . ;; workspace) podman build --target workspace -t workspaces . ;;
all) podman build -t analytics-backend-workspace . ;; all) podman build -t workspaces . ;;
*) log ERROR "build: invalid arg '${args[0]}'" ;; *) log ERROR "build: invalid arg '${args[0]}'" ;;
esac esac
;; ;;
@ -160,14 +160,20 @@ update)
containerfile) update 0 Containerfile . 500 ;; containerfile) update 0 Containerfile . 500 ;;
access) update 2 access.yml . 400 ;; access) update 2 access.yml . 400 ;;
authorized_keys) update 2 authorized_keys .ssh 400 ;; authorized_keys) update 2 authorized_keys .ssh 400 ;;
secret_key) update 2 keys/"${args[1]}"/id_ed25519 secrets/"${args[1]}" 400 ;;
podman_access)
update 2 podman_access.keys . 400
scp podman_access.keys mypodmanuser@alps:~/.ssh/authorized_keys
;;
ssh_router) update 1 ssh_router.sh .local/bin 500 ;; ssh_router) update 1 ssh_router.sh .local/bin 500 ;;
gitops_router) update 1 gitops_router.sh .local/bin 500 ;; gitops_router) update 1 gitops_router.sh .local/bin 500 ;;
validate_command) update 1 validate_command_access.sh .local/bin 500 ;; validate_command) update 1 validate_command_access.sh .local/bin 500 ;;
home_tar) home_tar)
podman cp "$PERSON":/app/workspaces/home.tar.gz "$HOME"/ podman cp "$PERSON":/app/private/workspaces/home.tar.gz "$HOME"/
chmod 600 "$HOME"/home.tar.gz chmod 600 "$HOME"/home.tar.gz
;; ;;
gitconfig) update 0 gitconfig.template . 500 ;; gitconfig) update 0 gitconfig.template . 500 ;;
start.sh) update 0 start.sh . 500 ;;
*) log ERROR "update: invalid arg '${args[0]}'" ;; *) log ERROR "update: invalid arg '${args[0]}'" ;;
esac esac
;; ;;

12
setgid-watcher.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Ensure setgid bit on all new directories in /mnt/private/workspaces-data/public
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/setgid-watcher.sh
User=root
Restart=on-failure
[Install]
WantedBy=multi-user.target

6
setgid-watcher.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
WATCH_DIR="/mnt/private/workspaces-data/public"
inotifywait -m -r -e create --format '%w%f' "$WATCH_DIR" | while read -r newdir; do
chmod g+s "$newdir"
done

View File

@ -3,7 +3,7 @@ set -euo pipefail
PERSON="${1:?Usage: $0 <person>}" PERSON="${1:?Usage: $0 <person>}"
WORKSPACE="${SSH_ORIGINAL_COMMAND:-}" WORKSPACE="${SSH_ORIGINAL_COMMAND:-}"
IMAGE="localhost/analytics-backend-workspace:latest" IMAGE="localhost/workspaces:latest"
DEV_USER="devuser" DEV_USER="devuser"
XDG_RUNTIME_DIR="/run/user/$(id -u)" XDG_RUNTIME_DIR="/run/user/$(id -u)"
LOG_FILE="/tmp/.ssh-router-${PERSON}.log" LOG_FILE="/tmp/.ssh-router-${PERSON}.log"
@ -45,7 +45,7 @@ if [[ -z "$WORKSPACE" ]]; then
WORKSPACE="$PERSON" WORKSPACE="$PERSON"
log INFO "Defaulted WORKSPACE → $WORKSPACE" log INFO "Defaulted WORKSPACE → $WORKSPACE"
fi fi
TMUX_SESSION="${WORKSPACE}|analytics-backend" TMUX_SESSION="${WORKSPACE}|workspace"
# ───────────────────────────────────────────── # ─────────────────────────────────────────────
# Ensure Podman socket is up # Ensure Podman socket is up
@ -120,11 +120,13 @@ start_container_if_needed() {
generate_gitconfig "$PERSON" generate_gitconfig "$PERSON"
podman run -dit \ podman run -dit \
--name "$WORKSPACE" \ --name "$WORKSPACE" \
--userns=keep-id \ --userns=keep-id:uid=1000,gid=1000 \
--group-add keep-groups \
--user "$DEV_USER" \ --user "$DEV_USER" \
--hostname "$WORKSPACE" \ --hostname "$WORKSPACE" \
--label auto-cleanup=true \ --label auto-cleanup=true \
-v "$HOME/data/$WORKSPACE:/app:Z" \ -v "/mnt/private/workspaces-data/public/$WORKSPACE:/app/public" \
-v "/mnt/private/workspaces-data/private/$WORKSPACE:/app/private" \
-v "$HOME/secrets/$WORKSPACE/gitconfig:/home/$DEV_USER/.gitconfig:ro,Z" \ -v "$HOME/secrets/$WORKSPACE/gitconfig:/home/$DEV_USER/.gitconfig:ro,Z" \
-v "$HOME/secrets/$WORKSPACE/id_ed25519:/home/$DEV_USER/.ssh/id_ed25519:ro,Z" \ -v "$HOME/secrets/$WORKSPACE/id_ed25519:/home/$DEV_USER/.ssh/id_ed25519:ro,Z" \
-v "$HOME/secrets/$WORKSPACE/id_ed25519.pub:/home/$DEV_USER/.ssh/id_ed25519.pub:ro,Z" \ -v "$HOME/secrets/$WORKSPACE/id_ed25519.pub:/home/$DEV_USER/.ssh/id_ed25519.pub:ro,Z" \