Sunday 14 July 2024

migrating zap.py -> docker compose = codium nirvana?

 I have a script doing containers, I want to move them to docker compose. 

the init:

        podman build -t cos .

        podman build -t py py


the run:

        podman run -v ~/v:/v:ro -v .:/app:exec -p 5000:5000 --rm -it --name py1 py bash -c 'python py/serve.py'

        podman run -v .:/app:exec -p 3000:3000 --rm -it --name cos1 cos bash -ci 'npm run dev -- --port 3000 --host 0.0.0.0'


Also, some other things. These all become:

version: '3.8'

x-defaults: &defaults
stdin_open: true
tty: true
restart: always

services:
cos:
build:
context: .
dockerfile: Containerfile
volumes:
- .:/app:exec
ports:
- "3000:3000"
command: bash -ci 'npm run dev -- --port 3000 --host 0.0.0.0'
container_name: cos1
<<: *defaults

py:
build:
context: py
dockerfile: Containerfile
volumes:
- ~/v:/v:ro
- .:/app:exec
ports:
- "5000:5000"
command: bash -c 'python py/serve.py'
container_name: py1
<<: *defaults
py2:
build:
context: py
dockerfile: Containerfile
volumes:
- .:/app:exec
ports:
- "8000:8000"
command: bash -c 'python py/ipfs.py'
container_name: py2
<<: *defaults

pl:
build:
context: pl
dockerfile: Containerfile
volumes:
- ../../stylehouse:/app:exec
ports:
- "1812:1812"
command: ./serve.pl
container_name: pl1
<<: *defaults

docker underworld

Then there's a haze of commands as I tried to install...

sudo apt install docker-compose

sudo pip3 install docker-compose

sudo apt install docker-desktop-4.30.0-amd64.deb

sudo apt install ./docker-desktop-4.30.0-amd64.deb

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

sudo apt install docker-compose-v2

sudo apt install docker-compose-v2

sudo apt install docker-compose-v2

sudo apt install docker-compose-v2

sudo apt install docker

sudo apt install docker-ce

I think I also tried via pip at one point.
I would get python errors, eg "no such param ... on HTTP...", indicating program-library version mismatch - also known as dependency hell.
Instructions (found on the web) are varied, so I'm not sure what's running.
dpkg -l 'docker-compose*' says
un  docker-compose-v2     <none>                      <none>       (no description available)
snap list says
docker                     24.0.5           2915   latest/stable    canonical✓     -

Weird. The codium installed via... flatpak.

start over

I needed to:

apt install docker-compose-v2 from ubuntu (rather than docker's apt repo),

And:

`snap install codium --classic`
this is less secure, enough to be able to connect to /var/run/docker.sock

And: 

`adduser $USER docker` and relogin, as per this

The "and relogin" thing caused a lot of confusion
    Until the computer crashes every few days..? What the hell.
    There's this *nix concept of your shell|session|environment containing a bunch of variables that hang around
    And your group membership state there can go stale, so you need to restart reality.

Now how to "have" the docker-compose cluster in codium...

Is via its right click menu in the file exporer:


I don't get the impression it can present me with the errors coming from my development, if it involves multiple containers.
Whereas I'd hoped for finding source file locations mentioned in error messages.

I assumed we had made more developer experience progress than this by now.


weeks later

the py container never starts with the others...
So I must `docker compose up`, which provides errors.
    This window I leave a tiny slat of visible beneath the code editor, as having it in the code editor console eats too much screen.

The many-little-slats approach to visual structure...


Now back to auto-git the user's world for them...