joj3 setup #32

Closed
opened 2024-09-08 17:23:51 +08:00 by manuel · 22 comments
Owner

goal: ease joj deployment through a (ephemeral?) clone of a "template container"

idea:

  • prepare a generic joj template container (JTC)
  • prepare external hooks to automatically run "per course" deployment (run on host at container creation)
  • prepare internal hooks to automatically run "per course" deployment (run inside container on 1st run)
  • write basic usage doc
goal: ease joj deployment through a (ephemeral?) clone of a "template container" idea: - [x] prepare a generic joj template container (JTC) - [x] prepare external hooks to automatically run "per course" deployment (run on host at container creation) - [x] prepare internal hooks to automatically run "per course" deployment (run inside container on 1st run) - [ ] write basic usage doc
manuel added the
enhancement
component
framework
labels 2024-09-08 17:23:51 +08:00
manuel self-assigned this 2024-09-08 17:23:51 +08:00
周赵嘉程521432910016 was assigned by manuel 2024-09-08 17:23:51 +08:00
Author
Owner

@zzjc123 can you please list what software should be installed in JTC (docker, joj3/go, etc.)

for the hooks, we probably want to start with a simple script to

  • install course specific software
  • add an ssh key
  • configure joj3

in the end the hook could simply clone a repo and run the above tasks based on the files in the repo (eg. list of packages to install, ssh keys of TAs, etc.)

@zzjc123 can you please list what software should be installed in JTC (docker, joj3/go, etc.) for the hooks, we probably want to start with a simple script to - install course specific software - add an ssh key - configure joj3 in the end the hook could simply clone a repo and run the above tasks based on the files in the repo (eg. list of packages to install, ssh keys of TAs, etc.)

I think git, golang, docker might be enough

  • git (clone the latest JOJ repo, or we can just download release with wget)
  • docker (create images)
  • golang (compile the joj3, can be ignored if we download release)
I think git, golang, docker might be enough - git (clone the latest JOJ repo, or we can just download release with wget) - docker (create images) - golang (compile the joj3, can be ignored if we download release)
Author
Owner

what dependencies are needed for a JOJ release? (containers should ship a joj release)?

what dependencies are needed for a JOJ release? (containers should ship a joj release)?

you mean what softwares are needed for compiling the job or packages we used? If softwares I think golang itself is enough.

you mean what softwares are needed for compiling the job or packages we used? If softwares I think golang itself is enough.

containers should ship a joj release?

We may not need compile JOJ release if basic docker images (containing joj) are prepared.

> containers should ship a joj release? We may not need compile JOJ release if basic docker images (containing joj) are prepared.
Author
Owner

new joj container ready for testing: ssh -p 22151 tt@111.186.58.48

\to all pub keys have been imported, so everybody should be able to connect. please now use this one for testing

the container is "minimal", nvim, docker, git are installed. please report here anything that is missing.

notes:

  • this container should feature everything that is needed to run JOJ and nothing more. the goal is just to have a "secure/isolated" environment to run joj through docker.
  • this container is unprivileged (prev one was priviledged)

@all

new joj container ready for testing: `ssh -p 22151 tt@111.186.58.48` $\to$ all pub keys have been imported, so everybody should be able to connect. please now use this one for testing the container is "minimal", nvim, docker, git are installed. please report here anything that is missing. notes: - this container should feature everything that is needed to run JOJ and nothing more. the goal is just to have a "secure/isolated" environment to run joj through docker. - this container is unprivileged (prev one was priviledged) @all
Author
Owner

tt user is for teaching team to connect, we probably want a joj user to run joj

tt user is for teaching team to connect, we probably want a joj user to run joj

register docker process

docker pull gitea/act_runner:latest

# generate config to modify if needed
docker run --entrypoint="" --rm -it gitea/act_runner:latest act_runner generate-config > config.yaml

# create image
docker run \
    -v $(pwd)/config.yaml:/config.yaml \
    -v $(pwd)/data:/data \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e CONFIG_FILE=/config.yaml \
    -e GITEA_INSTANCE_URL=https://focs.ji.sjtu.edu.cn/git \
    -e GITEA_RUNNER_REGISTRATION_TOKEN=GdyxWCm3ga7ITvvgzqJtH1TltE6DhaCInz5fbm85 \
    -e GITEA_RUNNER_NAME=templateRunner \
    --name templateRunner \
    -d gitea/act_runner
# register docker process ```bash docker pull gitea/act_runner:latest # generate config to modify if needed docker run --entrypoint="" --rm -it gitea/act_runner:latest act_runner generate-config > config.yaml # create image docker run \ -v $(pwd)/config.yaml:/config.yaml \ -v $(pwd)/data:/data \ -v /var/run/docker.sock:/var/run/docker.sock \ -e CONFIG_FILE=/config.yaml \ -e GITEA_INSTANCE_URL=https://focs.ji.sjtu.edu.cn/git \ -e GITEA_RUNNER_REGISTRATION_TOKEN=GdyxWCm3ga7ITvvgzqJtH1TltE6DhaCInz5fbm85 \ -e GITEA_RUNNER_NAME=templateRunner \ --name templateRunner \ -d gitea/act_runner ```

we may need to change the ownership of runner-image folder to keep it secure

we may need to change the ownership of runner-image folder to keep it secure
Author
Owner

progress:

  • pipx, go-judge, acl, tmux, sudo installed in JTC
  • teapot installed through pipx in joj-test1
  • initial config repo prepared

@zzjc123

  • is the GITEA_RUNNER_REGISTRATION_TOKEN different for each course/instance of the runner?
  • joj3 is a single binary?

we may need to change the ownership of runner-image folder to keep it secure

we'll use acl to ensure things are ok

progress: - pipx, go-judge, acl, tmux, sudo installed in JTC - teapot installed through pipx in joj-test1 - initial config repo prepared @zzjc123 - is the `GITEA_RUNNER_REGISTRATION_TOKEN` different for each course/instance of the runner? - joj3 is a single binary? > we may need to change the ownership of runner-image folder to keep it secure we'll use acl to ensure things are ok

progress:

  • pipx, go-judge, acl, tmux, sudo installed in JTC
  • teapot installed through pipx in joj-test1
  • initial config repo prepared

@zzjc123

  • is the GITEA_RUNNER_REGISTRATION_TOKEN different for each course/instance of the runner?
  • joj3 is a single binary?

we may need to change the ownership of runner-image folder to keep it secure

we'll use acl to ensure things are ok

TOKEN can be repo level or higher level, currently repo level

We need joj3, healthcheck binary to run whole process

> progress: > - pipx, go-judge, acl, tmux, sudo installed in JTC > - teapot installed through pipx in joj-test1 > - initial config repo prepared > > @zzjc123 > - is the `GITEA_RUNNER_REGISTRATION_TOKEN` different for each course/instance of the runner? > - joj3 is a single binary? > > > we may need to change the ownership of runner-image folder to keep it secure > > we'll use acl to ensure things are ok > TOKEN can be repo level or higher level, currently repo level We need joj3, healthcheck binary to run whole process
docker run \
    -v $(pwd)/config.yaml:/config.yaml \
    -v $(pwd)/data:/data \
    -v $(pwd)/bin:/joj3-bin \
    -v /usr/bin/pipx:/usr/bin/pipx \
    -v /home/tt/.local/config:/root/.local/config \
    -v /home/tt/.local/bin:/root/.local/bin \
    -v /home/tt/.local/pipx/venvs/joint-teapot:/root/.local/pipx/venvs/joint-teapot \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e CONFIG_FILE=/config.yaml \
    -e GITEA_INSTANCE_URL=https://focs.ji.sjtu.edu.cn/git \
    -e GITEA_RUNNER_REGISTRATION_TOKEN=GdyxWCm3ga7ITvvgzqJtH1TltE6DhaCInz5fbm85 \
    -e GITEA_RUNNER_NAME=templateRunner \
    -e PATH="/joj3-bin:$PATH" \
    --name templateRunner \
    -d gitea/act_runner

For this file, binary in $(pwd)/bin works, but joint-teapot couldn't work

```bash docker run \ -v $(pwd)/config.yaml:/config.yaml \ -v $(pwd)/data:/data \ -v $(pwd)/bin:/joj3-bin \ -v /usr/bin/pipx:/usr/bin/pipx \ -v /home/tt/.local/config:/root/.local/config \ -v /home/tt/.local/bin:/root/.local/bin \ -v /home/tt/.local/pipx/venvs/joint-teapot:/root/.local/pipx/venvs/joint-teapot \ -v /var/run/docker.sock:/var/run/docker.sock \ -e CONFIG_FILE=/config.yaml \ -e GITEA_INSTANCE_URL=https://focs.ji.sjtu.edu.cn/git \ -e GITEA_RUNNER_REGISTRATION_TOKEN=GdyxWCm3ga7ITvvgzqJtH1TltE6DhaCInz5fbm85 \ -e GITEA_RUNNER_NAME=templateRunner \ -e PATH="/joj3-bin:$PATH" \ --name templateRunner \ -d gitea/act_runner ``` For this file, binary in $(pwd)/bin works, but joint-teapot couldn't work

I think it might related to virtual env but even add it , it returns

bash: joint-teapot: No such file or directory
I think it might related to virtual env but even add it , it returns ```bash bash: joint-teapot: No such file or directory ```
Author
Owner

1st line of .local/bin/joint-teapot

#!/home/tt/.local/pipx/venvs/joint-teapot/bin/python

might need to change (at least) this. might be easier to run pipx ./joint-teapot inside docker? then install would be ok i guess

mounting the whole .local/pipx could also help? (instead of the teapot venv)

1st line of `.local/bin/joint-teapot` ```python #!/home/tt/.local/pipx/venvs/joint-teapot/bin/python ``` might need to change (at least) this. might be easier to run `pipx ./joint-teapot` inside docker? then install would be ok i guess mounting the whole `.local/pipx` could also help? (instead of the teapot venv)

how can we run pipx inside docker?

how can we run pipx inside docker?
Author
Owner

seems python3 is missing from the containter :-D

seems python3 is missing from the containter :-D

Can we just leave teapot in image?

Can we just leave teapot in image?
Author
Owner

not sure, having bits and pieces in different places make it harder to maintain.teapot is also likely to receive quite a few updates so more maintenance

notes:

  • at least some of the paths are correct, try to add python then we can see how far we are from maing it work.
  • other course specific binary will also have to be imported (eg. clang, clang++, octave, clang-tidy, cppcheck, cpplint) with all their dependencies
not sure, having bits and pieces in different places make it harder to maintain.teapot is also likely to receive quite a few updates so more maintenance notes: - at least some of the paths are correct, try to add python then we can see how far we are from maing it work. - other course specific binary will also have to be imported (eg. clang, clang++, octave, clang-tidy, cppcheck, cpplint) with all their dependencies

Install a python in container or mount python path? I tried to mount all python path I can find, but still couldn't make anythin work.

Install a python in container or mount python path? I tried to mount all python path I can find, but still couldn't make anythin work.

maybe we need to compile everything manually

maybe we need to compile everything manually
Author
Owner

all python commands are "not found" in docker. some dependencies are probably still missing.

all python commands are "not found" in docker. some dependencies are probably still missing.

true, so I am trying to compile one for it

true, so I am trying to compile one for it
Sign in to join this conversation.
No description provided.