Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ ARG UPSTREAM_JQ
ARG TARBALL_JQ

RUN fetch -qo /latest.json "${UPSTREAM_URL}" && \
echo $(jq -r "${UPSTREAM_JQ}" /latest.json) > /version && \
echo $(jq -r "${UPSTREAM_JQ}" /latest.json | sed 's/v//') > /version && \
echo $(jq -r "${TARBALL_JQ}" /latest.json) > /tarball_url

ARG CACHB=2
# Fetch and extract source tarball
RUN fetch -qo /tmp/opencloud.tar.gz "$(cat /tarball_url)" && \
mkdir -m 0755 /opencloud && \
Expand All @@ -47,8 +46,11 @@ RUN for f in $(find /patches -name "*.patch");do \
done

RUN go install github.com/bwplotka/bingo@latest
RUN EDITION=rolling gmake clean generate
RUN EDITION=rolling gmake -C opencloud build

ARG EDITION=rolling

RUN EDITION="${EDITION}" gmake clean generate VERSION=$(cat /version)
RUN EDITION="${EDITION}" gmake -C opencloud build VERSION=$(cat /version)


FROM ghcr.io/daemonless/base:${BASE_VERSION}
Expand Down Expand Up @@ -92,14 +94,17 @@ LABEL org.opencontainers.image.title="OpenCloud" \
COPY --from=builder --chmod=0755 --chown=bsd:bsd /opencloud/opencloud/bin/opencloud /app/opencloud

# Record version information
RUN su -m bsd -c "/app/opencloud version --skip-services 2>/dev/null" | sed -n 's/^Version: \(.*\)\+.*$/\1/p' > /app/version
RUN su -m bsd -c "/app/opencloud version --skip-services 2>/dev/null" | sed -n 's/^Version: \(.*\)$/\1/p' > /app/version

# Copy root filesystem
COPY root/ /

# Set permissions
RUN chmod +x /etc/services.d/opencloud/run /healthz

ENV OC_CONFIG_DIR=${OC_CONFIG_DIR:-/config/config/}
ENV OC_BASE_DATA_PATH=${OC_BASE_DATA_PATH:-/config/}

# --- Expose (Injected by Generator) ---
EXPOSE 9200

Expand Down
15 changes: 10 additions & 5 deletions Containerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ ARG UPSTREAM_JQ
ARG TARBALL_JQ

RUN fetch -qo /latest.json "${UPSTREAM_URL}" && \
echo $(jq -r "${UPSTREAM_JQ}" /latest.json) > /version && \
echo $(jq -r "${UPSTREAM_JQ}" /latest.json | sed 's/v//') > /version && \
echo $(jq -r "${TARBALL_JQ}" /latest.json) > /tarball_url

ARG CACHB=2
# Fetch and extract source tarball
RUN fetch -qo /tmp/opencloud.tar.gz "$(cat /tarball_url)" && \
mkdir -m 0755 /opencloud && \
Expand All @@ -41,8 +40,11 @@ RUN for f in $(find /patches -name "*.patch");do \
done

RUN go install github.com/bwplotka/bingo@latest
RUN EDITION=rolling gmake clean generate
RUN EDITION=rolling gmake -C opencloud build

ARG EDITION=rolling

RUN EDITION="${EDITION}" gmake clean generate VERSION=$(cat /version)
RUN EDITION="${EDITION}" gmake -C opencloud build VERSION=$(cat /version)


FROM ghcr.io/daemonless/base:${BASE_VERSION}
Expand Down Expand Up @@ -88,14 +90,17 @@ LABEL org.opencontainers.image.title="OpenCloud" \
COPY --from=builder --chmod=0755 --chown=bsd:bsd /opencloud/opencloud/bin/opencloud /app/opencloud

# Record version information
RUN su -m bsd -c "/app/opencloud version --skip-services 2>/dev/null" | sed -n 's/^Version: \(.*\)\+.*$/\1/p' > /app/version
RUN su -m bsd -c "/app/opencloud version --skip-services 2>/dev/null" | sed -n 's/^Version: \(.*\)$/\1/p' > /app/version

# Copy root filesystem
COPY root/ /

# Set permissions
RUN chmod +x /etc/services.d/opencloud/run /healthz

ENV OC_CONFIG_DIR=${OC_CONFIG_DIR:-/config/config/}
ENV OC_BASE_DATA_PATH=${OC_BASE_DATA_PATH:-/config/}

# --- Expose (Injected by Generator) ---
{%- if ports %}
EXPOSE {{ ports | map(attribute='target') | join(' ') }}
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,20 @@ podman run -d --name opencloud \
|------|----------|-------------|
| `9200` | TCP | Web UI |

!!! warning "Work in Progress"
This image is functional but may change significantly in a future release.

## Breaking changes
### untagged -> 0.1.0
- `config` and data directories moved from `/config/.opencloud` to `/config`
Existing data will be moved automatically during container initialization.

## Upgrade from 6.2.0 to 7.0.0
The upgrade requires a change to the configuration of the "sharing" service. Please follow the steps outlined in the [Upgrade Guide](https://docs.opencloud.eu/docs/admin/maintenance/upgrade/upgrade-guide#verify-configuration-changes) to achieve that.

## First run
OpenCloud generates a default config with insecure settings (not TLS validation) on first start
or if the `/config/.opencloud` directory does not exist.
OpenCloud generates a default config with insecure settings (no TLS validation) on first start
or if the file `/config/config/opencloud.yaml` does not exist.

You can define the inital password for the `admin` user by setting the environment variable `IDM_ADMIN_PASSWORD` like this:
```yaml
Expand All @@ -166,7 +174,7 @@ services:
```

If you do not set the password with the variable above, OpenCloud generates a random password for the `admin` user and
you can find it in the logs or in the file `/config/.opencloud/config/opencloud.yaml`.
you can find it in the logs or in the file `/config/config/opencloud.yaml`.

## Remarks
So far I have only tested this image with `bridge` networking.
Expand Down
14 changes: 11 additions & 3 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ x-daemonless:
9200: "Web UI"

notes: |
!!! warning "Work in Progress"
This image is functional but may change significantly in a future release.

## Breaking changes
### untagged -> 0.1.0
- `config` and data directories moved from `/config/.opencloud` to `/config`
Existing data will be moved automatically during container initialization.

## Upgrade from 6.2.0 to 7.0.0
The upgrade requires a change to the configuration of the "sharing" service. Please follow the steps outlined in the [Upgrade Guide](https://docs.opencloud.eu/docs/admin/maintenance/upgrade/upgrade-guide#verify-configuration-changes) to achieve that.

## First run
OpenCloud generates a default config with insecure settings (not TLS validation) on first start
or if the `/config/.opencloud` directory does not exist.
OpenCloud generates a default config with insecure settings (no TLS validation) on first start
or if the file `/config/config/opencloud.yaml` does not exist.

You can define the inital password for the `admin` user by setting the environment variable `IDM_ADMIN_PASSWORD` like this:
```yaml
Expand All @@ -40,7 +48,7 @@ x-daemonless:
```

If you do not set the password with the variable above, OpenCloud generates a random password for the `admin` user and
you can find it in the logs or in the file `/config/.opencloud/config/opencloud.yaml`.
you can find it in the logs or in the file `/config/config/opencloud.yaml`.

## Remarks
So far I have only tested this image with `bridge` networking.
Expand Down
9 changes: 9 additions & 0 deletions patches/patch-.make_protobuf.mk.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@
@cd ../.. && GOPATH="" GOBIN=".bingo" $(BINGO) get -l github.com/go-micro/generator/cmd/protoc-gen-micro
@cd ../.. && GOPATH="" GOBIN=".bingo" $(BINGO) get -l github.com/owncloud/protoc-gen-microweb
@cd ../.. && GOPATH="" GOBIN=".bingo" $(BINGO) get -l github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
@@ -16,7 +16,7 @@
.PHONY: buf-generate
buf-generate: $(SHA1_LOCK_FILE)
@find $(abspath $(CURDIR)/../../protogen/proto/) -type f -print0 | sort -z | xargs -0 sha1sum > buf.sha1.lock.tmp
- @cmp $(SHA1_LOCK_FILE) buf.sha1.lock.tmp --quiet || $(MAKE) -B $(SHA1_LOCK_FILE)
+ @cmp -s $(SHA1_LOCK_FILE) buf.sha1.lock.tmp || $(MAKE) -B $(SHA1_LOCK_FILE)
@rm -f buf.sha1.lock.tmp

$(SHA1_LOCK_FILE): $(BUF) protoc-deps
22 changes: 22 additions & 0 deletions root/etc/cont-init.d/19-move-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
# Move the config and data from the old default location
# directly into /config

# Ensure directories exist and have correct ownership
mkdir -p /config
chown -R bsd:bsd /config

if [ ! -d /config/.opencloud ]; then
# If the old base directory does not exist, we do not do anything
exit 0
fi

# Generate default config if missing
if [ ! -d /config/config ]; then
mv /config/.opencloud/* /config
if [ "$?" -eq 0 ]; then
rm -r /config/.opencloud
fi
echo "[move-config] OpenCloud config and data moved from /config/.opencloud to /config"
fi

2 changes: 1 addition & 1 deletion root/etc/cont-init.d/20-opencloud-init
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mkdir -p /config
chown -R bsd:bsd /config

# Generate default config if missing
if [ ! -d /config/opencloud ]; then
if [ ! -f /config/config/opencloud.yaml ]; then
HOME=/config s6-setuidgid bsd /app/opencloud init --insecure yes || true
fi

8 changes: 0 additions & 8 deletions root/etc/services.d/opencloud/run
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#!/bin/sh
# OpenCloud s6 service

#if [ -z "$TUNNEL_TOKEN" ]; then
# echo "[WARN] TUNNEL_TOKEN is not set. Starting in CIT mock mode."
# # Log version to prove binary is functional
# /usr/local/bin/opencloud --version
# # Listen on port 8080 to satisfy CI port check
# exec /usr/bin/nc -lk 0.0.0.0 8080
#fi

echo "[INFO] Starting opencloud..."

HOME=/config
Expand Down
Loading