CasaOS icon indicating copy to clipboard operation
CasaOS copied to clipboard

Trying CasaOS on non Debian based distro

Open EthraZa opened this issue 2 years ago • 5 comments

I have installed CasaOS under ChromeOS (FydeOS to be precise) and it's working very well. But, it's a Debian Linux there, so, no surprise. Then I tryed to install it on my Manjaro Linux but, even messing in the installation script, I find out it would not install because gateway has only debian and ubuntu folders and I quit there. Then I took I look at dockerhub and find no images of CasaOS. So I have this question: If CasaOS works only on Debian and is basically a Docker interface, why on earth there is no Docker image for it? For example, Portainer is an advanced interface for Docker and it runs from a docker container itself, so I guess that there is nothing holding CasaOS from running inside a container as well. So, is there any plans to release a official Docker image for CasaOS so it can run anywhere?

EthraZa avatar Sep 10 '22 15:09 EthraZa

I have tried to make a Dockerfile and install CasaOS but get stuck with the need of systemd.

I will let what I did here if some one have some idea on how to make it work:

Dockerfile

FROM debian:sid-slim
LABEL description="CasaOS - Your Home Cloud OS."

EXPOSE 80
ARG DEBIAN_FRONTEND=noninteractive
ENV TERM=xterm-256color

RUN apt -y update && apt -y install --no-install-recommends \
    apt-transport-https \
    ca-certificates \
    curl \
    lsb-release \
    procps

RUN groupadd -g 1000 sailor && \
    groupadd -g 500 core && \
    groupadd -g 233 docker && \
    useradd -m -u 1000 -s /bin/bash -c "Stevedore" -g sailor sailor -G adm,backup,core,disk,docker,mail,nogroup,operator,root,staff,sudo,tape,tty,users,www-data

RUN curl -fsSL https://get.casaos.io > /tmp/casaos.sh; sed -i '637i Check_Docker_Install() { \n Show 0 "Expecting Docker bind mount from Host" \n }' /tmp/casaos.sh; bash /tmp/casaos.sh; rm -f /tmp/casaos.sh

COPY ./entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]

docker-compose.yml

version: '3.8'

services:
  bkops:
    image: ethraza/casaos:latest
    build:
      context: .
      dockerfile: Dockerfile
    container_name: casaos
    hostname: casaos.{{.Node.Hostname}}
    environment:
      BOPS_KEEP_RUNNING: "on"

    deploy:
      mode: replicated
      replicas: 1
      placement:
        preferences:
          - spread: node.labels.storage
      labels:
        - "swarm.cronjob.enable=false"
        - "swarm.cronjob.schedule=10 1 * * *"
        - "swarm.cronjob.skip-running=true"
    ports:
      - target: 80
        protocol: tcp
        mode: ingress
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
    networks:
      - default

EthraZa avatar Sep 11 '22 00:09 EthraZa

could you share your entrypoint.sh ?

rlimaeco avatar Sep 11 '22 06:09 rlimaeco

Sure. It's a my default entrypoint. I guess I would need something to start CasaOS in this, but since I didn't get to that point, I was unable to test it.

entrypoint.sh

#!/bin/bash
set -e

bops_log() {
	local type="$1"; shift
	printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*"
}
bops_note() {
	bops_log Note "$@"
}
bops_warn() {
	bops_log Warn "$@" >&2
}

# usage: docker_process_init_files [file [file [...]]]
#    ie: docker_process_init_files /always-initdb.d/*
# process initializer files, based on file extensions
docker_process_init_files() {
	echo
	local f
	for f; do
		case "$f" in
			*.sh)
				if [ -x "$f" ]; then
					bops_note "$0: running $f"
					"$f"
				else
					bops_note "$0: sourcing $f"
					. "$f"
				fi
				;;
			*.bin)
				if [ -x "$f" ]; then
					bops_note "$0: running $f"
					"$f"
				fi
				;;
                        *.env)
				bops_note "$0: sourcing $f"
				. "$f"
				;;
			*)  bops_warn "$0: ignoring $f" ;;
		esac
		echo
	done
}

if [ ! -z "${SAILOR_PASSWORD}" ]; then
    bops_note "$0: setting sailor password"
    echo "${SAILOR_PASSWORD}" | chpasswd
fi

# For user convenience.
# Bind mount /docker-entrypoint.d directory with you own addon init .sh, .bin or .env files.
if [ -d "/docker-entrypoint.d" ]; then
    docker_process_init_files /docker-entrypoint.d/*
fi

if [ ! -z "${BOPS_KEEP_RUNNING}" ]; then
	tail -f /dev/null
else
	exec "$@"
fi

EthraZa avatar Sep 11 '22 12:09 EthraZa

All right, so the best change is to see what are being used in systemd service of casaos, to try to use the same commands in your entrypoint so, thanks by the way

rlimaeco avatar Sep 11 '22 17:09 rlimaeco

Yep, probably add something like:

command: ["/usr/bin/casaos", "-c", "/etc/casaos/casaos.conf"]

But CasaOS developers seens to really love systemd and the scripts do mention it everywhere, so I don ´t know how necessary is systemd in casaos lifecycle.

EthraZa avatar Sep 11 '22 19:09 EthraZa

Unfortunately CasaOS relies on Docker, Samba, etc. .. a number of systemd services, thus us.

tigerinus avatar Sep 29 '22 01:09 tigerinus