Open SalocinHB opened 1 year ago
the problem is the argon2 version install version 0.30.x and compile it
solution is
npm i argon2@^0.30.1
npx node-pre-gyp rebuild -C ./node_modules/argon2
rm -rf ./node_modules/direcus/node_modules/argon2
Oh sorry the error is in the isolated-vm :( i search for a solution
Just a small hint The isolated-vm, which breaks the guide, was introduced in 10.6.0 https://github.com/directus/directus/releases/tag/v10.6.0 So the latest version which works is 10.5.3 But there is also a change in the structure The directus node_modules folder is now @directus/api/node_modules So you have to delete the directus argon2 module from there rm -rf ./node_modules/@directus/api/node_modules/argon2/
I stumbled upon this and tried the posted suggestions but couldn't get Directus 10.6.3 working on Uberspace so far. Any more hints how to get this working?
@hermanndettmann which errors occur at which point?
Hey @SalocinHB , thanks for the quick reply! When I run npx directus bootstrap
I get this error:
Error: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by MY_UBERSPACE_DIRECTORY/directus/node_modules/isolated-vm/out/isolated_vm.node)
at Module._extensions..node (node:internal/modules/cjs/loader:1473:18)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (MY_UBERSPACE_DIRECTORY/directus/node_modules/isolated-vm/isolated-vm.js:1:18)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12) {
code: 'ERR_DLOPEN_FAILED'
}
I use node 20.10.0
and npm 10.2.5
.
I got directus 10.10.7 running on uberspace!
My process was to build from source on CentOS7 and to copy the libraries from the libvips-devel dependency (needed by sharp) onto uberspace and include it into the library search path with LD_LIBRARY_PATH
. Apart from libvips-devel, a recent c++ compiler and node >= 18 are also needed on the build machine.
In the CentOS 7 build setup, I ran: npm_config_build_from_source=true yarn install && cp -r /usr/lib64 .
and copied the result to uberspace. The corresponding supervisord ini then looks like this:
[program:backend-12f746d]
command=/home/REDACTED/deployments/backend-12f746d/node_modules/.bin/directus start
environment=KEY="REDACTED",SECRET="REDACTED",ADMIN_EMAIL="REDACTED",ADMIN_PASSWORD="REDACTED",LD_LIBRARY_PATH="/home/REDACTED/deployments/backend-12f746d/lib64:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/opt/rh/devtoolset-9/root/usr/lib64/dyninst:/opt/rh/devtoolset-9/root/usr/lib/dyninst:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib",PORT="53559",DB_CLIENT="sqlite3",WEBSOCKETS_ENABLED="true",DB_FILENAME="/home/REDACTED/deployments/backend-12f746d/database/data.db",PUBLIC_URL="http://0.0.0.0:53559/"
I think it should also work to do the build from source directly on uberspace instead of on a build machine (at least if libvips-devel is provided manually or by uberspace), though when I tried that my process was killed. I'm not sure if I used too much time or memory when I did that, but it's easy-ish to work around that by building locally and then uploading directus pre-installed. Or rather it becomes easy-ish once you have a working CentOS 7 setup for building.
Let me know if I can be of any help with updating the guide, e.g. I could share the Dockerfile I used to get a CentoOS 7 for building, which at least for me was the main challenge with this approach.
As an aside, the approach from the guide to configure the web backend on /
works and is definitely easier to maintain, but I thought I could also share a more fine-grained approach here, in case anyone else wants to deploy directus and HTML under /
using the same domain name:
uberspace web backend set /activity --http --port $(BACKEND_PORT) && \
uberspace web backend set /auth --http --port $(BACKEND_PORT) && \
uberspace web backend set /admin --http --port $(BACKEND_PORT) && \
uberspace web backend set /assets --http --port $(BACKEND_PORT) && \
uberspace web backend set /auth --http --port $(BACKEND_PORT) && \
uberspace web backend set /collections --http --port $(BACKEND_PORT) && \
uberspace web backend set /dashboards --http --port $(BACKEND_PORT) && \
uberspace web backend set /extensions --http --port $(BACKEND_PORT) && \
uberspace web backend set /fields --http --port $(BACKEND_PORT) && \
uberspace web backend set /files --http --port $(BACKEND_PORT) && \
uberspace web backend set /folders --http --port $(BACKEND_PORT) && \
uberspace web backend set /items --http --port $(BACKEND_PORT) && \
uberspace web backend set /notifications --http --port $(BACKEND_PORT) && \
uberspace web backend set /permissions --http --port $(BACKEND_PORT) && \
uberspace web backend set /presets --http --port $(BACKEND_PORT) && \
uberspace web backend set /relations --http --port $(BACKEND_PORT) && \
uberspace web backend set /revisions --http --port $(BACKEND_PORT) && \
uberspace web backend set /roles --http --port $(BACKEND_PORT) && \
uberspace web backend set /server --http --port $(BACKEND_PORT) && \
uberspace web backend set /settings --http --port $(BACKEND_PORT) && \
uberspace web backend set /users --http --port $(BACKEND_PORT) && \
uberspace web backend set /webhooks --http --port $(BACKEND_PORT) && \
uberspace web backend set /docs --http --port $(BACKEND_PORT) && \
uberspace web backend set /shares --http --port $(BACKEND_PORT) && \
uberspace web backend set /versions --http --port $(BACKEND_PORT) && \
uberspace web backend set /translations --http --port $(BACKEND_PORT)
Hi @tapirbug, it would be nice if you could share the Dockerfile you used to get a CentoOS 7 for building directus ✌
Sure thing, I used this Dockerfile:
FROM centos:7
# the node build requires python3 and gcc
RUN yum install -y centos-release-scl-rh && yum install -y python3 make rsync devtoolset-10 devtoolset-10-gcc-c++ git curl
RUN echo 'source /opt/rh/devtoolset-10/enable' >> ~/.bashrc
# install the node version we copied off of uberspace (and python, which it needs to run)
COPY ./opt--nodejs18.tar.gz /opt--nodejs18.tar.gz
COPY ./opt--uberspace--python-venv.tar.gz /opt--uberspace--python-venv.tar.gz
RUN tar -xf /opt--nodejs18.tar.gz --directory / \
&& tar -xf /opt--uberspace--python-venv.tar.gz --directory / \
&& rm /opt--nodejs18.tar.gz /opt--uberspace--python-venv.tar.gz \
&& cd /usr/bin && ln -s /opt/nodejs18/bin/node /opt/nodejs18/bin/npm /opt/nodejs18/bin/npx .
RUN npm install --global yarn && cd /usr/bin && ln -s /root/lib/node_modules/yarn/bin/yarn .
# provide vips-devel which is required to build directus from source
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install -y yum-utils
RUN yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum-config-manager --enable remi
RUN yum install -y vips vips-devel vips-tools
WORKDIR /build
The tar archives used to install node and python are copied from uberspace:
tar czf opt--uberspace--python-venv.tar.gz /opt/uberspace/python-venv-2.7
tar czf opt--nodejs18.tar.gz /opt/nodejs18
The .bashrc
thingy to enable the newer C++ compiler required an interactive bash for me, and I mounted the code in /build
, so the command I use for building looks like this:
docker run -it -v ./$(BACKEND_DIR):/build uberspace-node-build:latest bash -ic 'npm_config_build_from_source=true yarn install && cp -r /usr/lib64 .'
I tried the same approach with building in an uberspace-like centos 7 docker container for the newer directus version 11.1.0, but wasn't sucessful. If anyone is trying this, you will need a newer glib (the one with glib-object, not glibc) and newer libvips to get it to build, and I would expect package management in a centos 7 container to become more tedious over time since it's no longer officially supported. Trying to build directly on Uberspace still leads to the process being killed for me.
If you are really determined to get directus running on uberspace, you can probably still find a way, but you might end up with a bit of a hack (like I did 😅 )
If you want to deploy to Uberspace, and you have the choice to use something else than directus as your CMS, I would suggest you at least consider that other option.
looks like yet another module wants a newer GLIBC than available on CentOS 7.
@j3n57h0m45, since this was originally your guide, maybe you'd like to have a look and try to fix it?