Nevermind, we figured it out, here’s a partial guide of what we did.
Updating the Frontend of Seahub is a fairly involved process that requires some work to fully contemplate.
A separate dev environment is highly recommended in order to understand what’s going on.
Publishing Changes
This guide assumes that you are deploying from a folder with an active git repo.
Take the directory /opt/seafile/seafile-pro-server-10.0.9/seahub
from the dev-container and copy it to your deployment folder.
mkdir opt/seafile/seafile-pro-server-10.0.9
docker compose seafile:/opt/seafile/seafile-pro-server-10.0.9/seahub opt/seafile/seafile-pro-server-10.0.9
Clean out unecessary files from your local repository.
This can be done by removing all of the untracked files.
# Get a list of all of the untracked files and ignored files.
git clean -dfXn
# Once you are comfortable, clean out all of the files. Note that this also
# removes directories node_modules and frontend/build which are used for later builds.
# Don't remove these files if you want a quick deployment cycle.
git clean -dfX
# Remove media/assets. This is copied over from opt/seafile/seafile-pro-server-10.0.9/seahub/Makefile
cd opt/seafile/seafile-pro-server-10.0.9/seahub
rm -rf media/assets
I recommend commit your changes to your git repo at this point, in order to have a clean commit of exactly what has changed.
Now, it’s time to build the assets locally before they can be uploaded to the production container. Install nodejs v16 or use nvm in order to install it.
# Installs nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# Installs node16 and switches to it
nvm use 16
cd frontend
# Build the assets at frontend/static/assets
npm install
npm run build
Upload your changes to your production container by using a custom docker image. Note that this will freeze your environment from future updates.
# seafile.Dockerfile
FROM docker.seadrive.org/seafileltd/seafile-pro-mc@sha256:049ac35d32e5d8892e9cf76ea86603d31f06b9fd31bf1f97a7adfbbeecec1121
COPY opt/seafile /opt/seafile
# seafile.Dockerfile.dockerignore
**/node_modules
**/media/assets
docker compose up seafile -d --build
Once the seafile container is up and ready, then run the following commands within the container.
docker compose exec --user root seafile /bin/sh
cd /opt/seafile/seafile-pro-server-10.0.9
# This is copied over from opt/seafile/seafile-pro-server-10.0.9/seahub/Makefile
./seahub.sh python-env seahub/manage.py collectstatic --noinput -i admin -i termsandconditions
./seahub.sh restart