diff --git a/podman_example.sh b/podman_example.sh new file mode 100644 index 0000000..7b8e274 --- /dev/null +++ b/podman_example.sh @@ -0,0 +1,104 @@ +# The rootless daemon needs to be running for rootless operations +# ls $XDG_RUNTIME_DIR/podman/podman.sock +# systemctl --user start podman.socket +# systemctl --user enable podman.socket +# sudo usermod -aG podman $USER +# Can enable low ports with +# sudo sysctl net.ipv4.ip_unprivileged_port_start=0 + +# http://localhost:8081/dashboard#/ +# http://aleaf.local:8080/ + +#podman info +#systemctl --user status podman.socket +#ls /run/user/$(id -u)/podman/ + +# for docker compose stuff +# export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock +# echo 'export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock' >> ~/.bashrc + +# Create a Pod (kinda a service container for containers) +# Expose all the ports of said pod (that will be accessed directly/not by other containers) +podman pod create --name aleaf -p 80:80 -p 8080:8080 +# Don't add the ports if using traefik as entry point, only without +#podman pod create --name aleaf +# podman rootless doesn't allow priviledged ports < 1024 + +# This allows ports <1024 to be used in non root +# sudo sysctl net.ipv4.ip_unprivileged_port_start=0 + +#podman network create traefik + +podman build -t aleaf-nginx ./nginx +podman build -t aleaf-php ./php + +# --pod aleaf # removed --pod from everything atm +podman run -d \ + --pod aleaf \ + --name aleaf-mariadb \ + -e MYSQL_ROOT_PASSWORD=mariadb \ + -e MYSQL_DATABASE=ecomdb \ + -v ./db/mysql:/var/lib/mysql:Z \ + -v ./db/schema.sql:/docker-entrypoint-initdb.d/schema.sql:Z \ + docker.io/library/mariadb:10.7 + +podman run -d \ + --pod aleaf \ + --name aleaf-adminer \ + -e ADMINER_DEFAULT_SERVER=aleaf-mariadb \ + docker.io/library/adminer + #-l 'traefik.enable=true' \ + #-l 'traefik.http.routers.adminer.rule=Host(`adminer.local`)' \ + #-l 'traefik.http.routers.adminer.entrypoints=web' \ + #-l 'traefik.http.services.adminer.loadbalancer.server.port=8080' \ + #-l 'traefik.docker.network=traefik' \ + # docker.network=podman apparently not needed + +podman run -d \ + --pod aleaf \ + --name aleaf-php \ + -v ./php/www:/var/www/html:Z \ + aleaf-php + +# aleaf.local +podman run -d \ + --pod aleaf \ + --name aleaf-nginx \ + -v ./php/www:/var/www/html:Z \ + -v ./nginx/default.conf:/etc/nginx/conf.d/default.conf:Z \ + aleaf-nginx + #-l 'traefik.enable=true' \ + #-l 'traefik.http.routers.aleaf.rule=Host(`aleaf.local`)' \ + #-l 'traefik.http.routers.aleaf.entrypoints=web' \ + #-l 'traefik.http.services.aleaf.loadbalancer.server.port=80' \ + #-l 'traefik.docker.network=traefik' \ + +#podman run -d \ + #--name traefik \ + #-p 8080:80 \ + #-p 8081:8080 \ + #-v /run/user/$(id -u)/podman/podman.sock:/var/run/docker.sock:ro \ + #docker.io/library/traefik:v3.0 \ + #--api.insecure=true \ + #--providers.docker=true \ + #--providers.docker.endpoint=unix:///var/run/docker.sock \ + #--providers.docker.exposedbydefault=false \ + #--entrypoints.web.address=:80 +# -- stuff used to read container labels (nginx this instance) + +# Stop/start the stack/pod +#podman pod start aleaf +#podman pod stop aleaf +#podman pod rm aleaf + +# Autostart (systemd) +#podman generate systemd --name aleaf --files --new +#mkdir -p ~/.config/systemd/user +#mv *.service ~/.config/systemd/user/ +#systemctl --user daemon-reload +#systemctl --user enable pod-aleaf.service +#systemctl --user start pod-aleaf.service + + +# podman exec -it traefik ls -l /var/run/docker.sock +# sudo usermod -aG podman $USER