Closed mielvds closed 2 weeks ago
Hi @mielvds,
I'm assuming that you are using version 2.1.0a2. Note that this is still an alpha release, but let's try to find out what is going wrong here.
It's somehow stuck on the Grunt install process, which recently became part of the pip install -e . process?
Correct. The frontend installs are included via a build hook: build_hook.py. The hook is executed when building a wheel or sdist. When using the cookiebuilders to build a new Atramhasis scaffold application, we can use the built frontend from the wheel or sdist, but when using Atramhasis itself, an (automatic) frontend build is still needed.
Furthermore, you can no longer use python setup.py compile_catalog
. Instead, you can use:
pybabel compile --directory 'atramhasis/locale' --domain atramhasis --statistics true
I will make the documentation clearer about this before I make the final release. The general installation should be pretty accurate, but the admin development section needs a huge update.
The Dockerfile no longer needs:
# install js dependencies for public site using npm
RUN cd atramhasis/static && npm install
# install js dependencies for admin using npm
RUN cd atramhasis/static/admin && npm install
#&& grunt -v build
#&& grunt -v build
# compile the Message Catalog Files
RUN python setup.py compile_catalog
I don't think the error will be fixed just by updating your Dockerfile with the changes above. I suppose the error has something to do with the version of the installers. These are my versions. If you are using a lower version, you might want to upgrade. If you are using a higher version, we probably need to adjust the Atramhasis code.
npm --version
10.2.4
grunt --version
grunt-cli v1.4.3
node --version
v21.6.2
To pinpoint the problem, instead of running pip install -e .
, you can check out the 2.1.0a2 release (or the develop branch) and build the frontend code with these steps:
cd <atramhasis_dir>/atramhasis/static
npm install
cd <atramhasis_dir>/atramhasis/static/admin
npm install
cd <atramhasis_dir>/atramhasis/static/admin
grunt -v build
Does this provide clearer feedback on the error?
Is there actually a reason to clone the Github repo for your Docker file? If you're trying to create your own instance, it would make more sense to use the "create your own instance" cookiecutter (https://atramhasis.readthedocs.io/en/latest/customisation.html#creating-your-own-project). This creates a custom python package you can use to hold your own custom templates and css and when a new Atramhasis is released you generally only need to update the requirements file and possibly update your own overrides. This way the Atramhasis admin environment is built for you already so you don't need to build it yourself (and don't need the build tools). At least that's the way we envisioned it being used when we built the software. If it doesn't work in practice, we'd love to get some feedback on it and see if we can improve it or if we're better of just scrapping this whole way of working.
I would like to add that if you are using the cookiecutters as documented in https://atramhasis.readthedocs.io/en/latest/customisation.html#creating-your-own-project, you will need to specifically install the latest atramhasis alpha version.
pip install -e .
will install all requirements, including atramhasis. But instead of the alpha version the latest stable version (2.0.0) will be installed. Please make sure that before executing pip install -e .
you install the atramhasis alpha version via pip install atramhasis==2.1.0a2
as long as a stable 2.1.0 is not released. This way atramhasis is already present in your virtualenv and the installer will not download the stable version.
Hi @koenedaele @goessebr good point! When I created this docker repo, I wasn't sure whether the cookiecutter was up to speed with atramhasis 2.x. But indeed, this does work! Check out https://github.com/viaacode/atramhasis-docker/blob/main/meemoo_atramhasis/Dockerfile.
Here are some more insights by running the individual commands with the original Dockerfile, where grunt -v build
seems to cause the issue:
0.373 >> dojo build error: Error
0.375 Warning: Task "dojo:dist" failed. Use --force to continue.
0.375
0.375 Aborted due to warnings.
------
Dockerfile:21
--------------------
19 | RUN cd atramhasis/static && npm install
20 | RUN cd atramhasis/static/admin && npm install
21 | >>> RUN cd atramhasis/static/admin && grunt -v build
22 | # create or update database
23 | RUN alembic upgrade head
--------------------
ERROR: failed to solve: process "/bin/sh -c cd atramhasis/static/admin && grunt -v build" did not complete successfully: exit code: 3
Hi @mielvds,
What is your output for grunt --version
?
grunt-cli v1.4.3 grunt v1.6.1
It's of course not easy to tell what's wrong without seeing the actual process output.
But you do get that error in the Task "dojo:dist"
phase when you don't have java
available, which grunt uses internally.
It was indeed the missing Java JDK! The demo site now builds.
It's still a mystery to me why the demosite (Dockerfile) needs Java and the cookiecutter output scaffold (Dockerfile) does not. The latter is either not building the admin site or it's no longer using grunt...
Your demosite docker clones the project from github, and has to then build everything, including frontend. Which is the grunt and java build.
The scaffold downloads atramhasis from pypi. Which will give you a prebuilt wheel file which contains the frontend already built, so no grunt or java runs.
Hello! i'm unable to build the latest atramhasis from source. I'm using a docker build located here: https://github.com/viaacode/atramhasis-docker.
It's hard to tell what's going on. It's somehow stuck on the Grunt install process, which recently became part of the
pip install -e .
process? (I used to install the JS only after the python install; it's still in the dockerfile). Any ideas?