Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decidim Awesome : V0.8.x vs V0.9x issue with the Dockerfile and publish process/components #219

Open
sylvie-mcn opened this issue Apr 18, 2023 · 10 comments

Comments

@sylvie-mcn
Copy link

sylvie-mcn commented Apr 18, 2023

Hello !
We work with Decidim V27.2 and we try to install Awesome.

We were able to adapt the Dockerfile, so that it can receive the precompile assets command, except that we have a problem when adding the bin/rails assets:precompile command in the install-2.sh file.

Even adding the precompilation command in install-2.sh or Dockerfile.
build stops, and returns error messages ERROR in ..... Can't resolve '@rails/activestorage' ..... plus assets (js, css, etc) it can't find not.
image

Also, we cannot release processes or features without having an error.

Will you publish a V0.9 release for decidim V26 and V27 soon?

Thank you !

To Reproduce
Decidim V0.27.2
Install Awesom V0.9 for Decidim V0.27
1.create un process
2.create a component
Publish all

I have this error for the process and this is the same for the component
image

Desktop (please complete the following information):

  • OS: windows
  • Browser : chrome
  • Version [e.g. 27.2]
@microstudi
Copy link
Contributor

I don't think you can do a GET request agains that route (publish a component). Please share your Dockerfile and your application, I'm pretty sure this has nothing to do with this plugin.

@esdrasitq
Copy link

esdrasitq commented Apr 18, 2023

Hi @microstudi,

@sylvie-mcn and I are working together in the same team. Just to be clear. The build was succesfully done, the Dockerfile is OK.
So when I pass the command bin/rails assets:precompile RAILS_ENV=Development in the rails console, this is the error I have.

image

And then, if @sylvie-mcn try to publish a process on the website, we have the routing error displayed above. Also, in the log of the developper tools we can see the rails active storage is missing.

image

Even if I try to run this command in development mode RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave, we still have the same problem.

I hope, this will help you understand better our issue. Any help will be appreciate. Thanks in advance.

@microstudi
Copy link
Contributor

It seems that node packages aren't properly installed. Try to remove the node_modules folder and run yarn install or npm ci.
If you show your repositori I'd might be able to know more.

@esdrasitq
Copy link

esdrasitq commented Apr 18, 2023

@microstudi
Thank you so much.
After some analysis, I have identified the reason.
In the decidim-module-decidim_awesome gemfile.lock, activestorage version is (= 6.1.7.2). However in decidim-core module v27.2 in the package.json file, we can see that "@rails/activestorage": "^6.0.4". I just replace this latter by ^6.1.7 also, I replace it in other package.json im my decidim folder.

Now everything works fine. :):)
image

@microstudi
Copy link
Contributor

good to know, maybe we will have to change this. thanks for the explanation

@sylvie-mcn
Copy link
Author

@microstudi
Thanks for your help !

@lawrencemcn
Copy link

lawrencemcn commented Apr 28, 2023

Hi @microstudi
actually just changing the active version to ^6.1.7 is not fixing the compiling assets issue of decidim_awesome in and out the Docker file.

Here is the trace I have for the execution of the bundle exec rails decidim_decidim_awesome:webpacker:install in the Dockerfile:

Warning_awesome_install

Is it possible that all the errors are due to the npm and node versions not being fully compatible ?

After the container is up, here is the trace for the execution of bin/rails asset:precompile --trace in the container:
There are some warnings/errors but the assets are compiled

Warning_asset_precompile_container

Is there an example of a Dockerfile that runs Decidim with awesome after executing the commands bundle exec rails decidim_decidim_awesome:webpacker:install and bin/rails asset:precompile ?

Thank you.

@microstudi
Copy link
Contributor

I think you need first make sure you are using the proper versions for npm and node (I think are 8 and 16)

@joserwan
Copy link

Hi, it looks like Decidim.webpacker.compile refers to something like Webpacker::Compiler.new(Webpacker.instance)

This seems to work:

--- a/decidim/lib/tasks/decidim_tasks.rake
+++ b/decidim/lib/tasks/decidim_tasks.rake
@@ -21,7 +21,7 @@ namespace :decidim do
     task compile: [:npm_install, :environment] do
       Webpacker.with_node_env("production") do
         ensure_log_goes_to_stdout do
-          if Decidim.webpacker.commands.compile
+          if Webpacker::Compiler.new(Webpacker.instance).compile
             # Successful compilation!
             puts "SUCCESS"
             Dir.chdir(File.join(__dir__, "../..")) do

Can you confirm that this is equivalent ? If so, where is defined Decidim.webpacker ?

@joserwan
Copy link

I think you need first make sure you are using the proper versions for npm and node (I think are 8 and 16)

Same issue with the expected Node / NPM versions:

root@7bbadbb443af:/home/decidim/decidim-app# node -v
v16.18.1
root@7bbadbb443af:/home/decidim/decidim-app# npm -v
8.19.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants