sleede / fab-manager

Fab-Manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.
http://www.fab-manager.com
Other
227 stars 113 forks source link

Assets precompile failed : error Couldn't find the binary git #236

Closed guidtz closed 3 years ago

guidtz commented 3 years ago

Hello, i'll try to upgrade from 4.2.3 to 4.6.3.

So When I'll try to recompile assets I have those error :

yarn install v1.19.2
[1/4] Resolving packages...
[2/4] Fetching packages...
error Couldn't find the binary git
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

And assets are not recreated.

Thanks for you're help

sylvainbx commented 3 years ago

Hi @guidtz , You can safely ignore the message error Couldn't find the binary git.

However, the assets are now created in /apps/fabmanager/public/packs/ (previously it was in /apps/fabmanager/public/assets). Can you check the content of that folder ? Specifically, can you report here the content of /apps/fabmanager/public/packs/manifest.json ?

guidtz commented 3 years ago

@sylvainbx ok but the home page of fabmanager is empty after migration and when I try to connect I have these error : Unprocessable Entity (perhaps another error).

manifest.json.txt

Thanks for you're help

guidtz commented 3 years ago

@sylvainbx any idea why front page is white and why I could not connect to Fab Manager ?

Thanks

sylvainbx commented 3 years ago

Your manifest.json file seems ok. Can you check your volumes bindings in the docker-compose.yml file?

guidtz commented 3 years ago

Do you see something strange ?

version: '2'
services:
  fabmanager:
    image: sleede/fab-manager
    environment:
      RAILS_ENV: production
      RACK_ENV: production
    env_file:
      - ${PWD}/config/env
    volumes:
      - ${PWD}/public/packs:/usr/src/app/public/packs
      - ${PWD}/public/uploads:/usr/src/app/public/uploads
      - ${PWD}/invoices:/usr/src/app/invoices
      - ${PWD}/exports:/usr/src/app/exports
      - ${PWD}/log:/var/log/supervisor
      - ${PWD}/plugins:/usr/src/app/plugins
      - ${PWD}/accounting:/usr/src/app/accounting
      - ${PWD}/imports:/usr/src/app/imports
    depends_on:
      - postgres
      - redis
      - elasticsearch
    restart: always
    networks:
      - fabmanager
  postgres:
    image: postgres:9.6
    volumes:
      - /home/debian/fabm-bocal/postgresql-9.6:/var/lib/postgresql/data
    restart: always
    networks:
      - fabmanager
  elasticsearch:
    image: elasticsearch:5.6
    ulimits:
      memlock:
        soft: -1
        hard: -1
    environment:
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    volumes:
      - ${PWD}/elasticsearch:/usr/share/elasticsearch/data
    restart: always
    networks:
      - fabmanager
  redis:
    image: redis:6-alpine
    volumes:
      - ${PWD}/redis:/data
    restart: always
    networks:
      - fabmanager
  nginx:
    image: nginx:1.9
    #    ports:
    #  - "80:80"
    #  - "443:443"
    volumes:
      - ${PWD}/config/nginx:/etc/nginx/conf.d
      - ${PWD}/letsencrypt/etc:/etc/letsencrypt
      - ${PWD}/log:/var/log/nginx
    volumes_from:
      - fabmanager:ro
    links:
      - fabmanager:fabmanager
    restart: always
    networks:
      - traefik-proxy
      - fabmanager
    labels:
      traefik.enable: "true"
      traefik.port: "80"
      traefik.docker.network: "traefik-proxy"
      traefik.frontend.entryPoints: "http,https"
      traefik.networks: "traefik-proxy"
      traefik.frontend.rule: "Host:mon.url.com"
networks:
  fabmanager:
  traefik-proxy:
    external: true

NB I use Traefik as proxy

sylvainbx commented 3 years ago

The configuration seems to fit. I don't know Traefik, maybe there's a configuration issue with it... Nevertheless, we must first check that nginx goes with the right assets files. Check the result of the following command:

docker-compose exec nginx cat /usr/src/app/public/packs/manifest.json
guidtz commented 3 years ago

Traefik is just a proxy for http/https connexion and redirect request to nginx.

docker-compose exec nginx cat /usr/src/app/public/packs/manifest.json
{
  "application.css": "/packs/css/application-071e4677.chunk.css",
  "application.js": "/packs/js/application-b0a2189e94bee249ee1a.chunk.js",
  "application.js.map": "/packs/js/application-b0a2189e94bee249ee1a.chunk.js.map",
  "entrypoints": {
    "application": {
      "js": [
        "/packs/js/runtime~application-8e9980e8348782e5eacb.js",
        "/packs/js/vendors~application-8e455bcde358dfaa0c23.chunk.js",
        "/packs/js/application-b0a2189e94bee249ee1a.chunk.js"
      ],
      "js.map": [
        "/packs/js/runtime~application-8e9980e8348782e5eacb.js.map",
        "/packs/js/vendors~application-8e455bcde358dfaa0c23.chunk.js.map",
        "/packs/js/application-b0a2189e94bee249ee1a.chunk.js.map"
      ],
      "css": [
        "/packs/css/vendors~application-6f69d76f.chunk.css",
        "/packs/css/application-071e4677.chunk.css"
      ]
    },
    "plugins": {
      "js": [
        "/packs/js/runtime~plugins-9286b37c3cc1da1c1760.js",
        "/packs/js/plugins-344e93397bdf8ee9771a.chunk.js"
      ],
      "js.map": [
        "/packs/js/runtime~plugins-9286b37c3cc1da1c1760.js.map",
        "/packs/js/plugins-344e93397bdf8ee9771a.chunk.js.map"
      ],
      "css": [
        "/packs/css/plugins-cdb220ae.chunk.css"
      ]
    },
    "printer": {
      "js": [
        "/packs/js/runtime~printer-420a3073fabbb1caea06.js",
        "/packs/js/printer-bc8bdcb1ad6b92648f25.chunk.js"
      ],
      "js.map": [
        "/packs/js/runtime~printer-420a3073fabbb1caea06.js.map",
        "/packs/js/printer-bc8bdcb1ad6b92648f25.chunk.js.map"
      ],
      "css": [
        "/packs/css/printer-439889a8.chunk.css"
      ]
    }
  },
  "media/bootstrap/glyphicons-halflings-regular.eot": "/packs/media/bootstrap/glyphicons-halflings-regular-5be1347c.eot",
  "media/bootstrap/glyphicons-halflings-regular.svg": "/packs/media/bootstrap/glyphicons-halflings-regular-060b2710.svg",
  "media/bootstrap/glyphicons-halflings-regular.ttf": "/packs/media/bootstrap/glyphicons-halflings-regular-4692b9ec.ttf",
  "media/bootstrap/glyphicons-halflings-regular.woff": "/packs/media/bootstrap/glyphicons-halflings-regular-82b1212e.woff",
  "media/bootstrap/glyphicons-halflings-regular.woff2": "/packs/media/bootstrap/glyphicons-halflings-regular-be810be3.woff2",
  "media/font/summernote.eot": "/packs/media/font/summernote-bd0d8be1.eot",
  "media/font/summernote.ttf": "/packs/media/font/summernote-b293d601.ttf",
  "media/font/summernote.woff": "/packs/media/font/summernote-08c343ff.woff",
  "media/font/summernote.woff2": "/packs/media/font/summernote-7c9436ed.woff2",
  "media/images/arrow-left.png": "/packs/media/images/arrow-left-6cfe3d9e2c18a348cde19e3fc775c5d8.png",
  "media/images/fabmanager-logo.png": "/packs/media/images/fabmanager-logo-0dc020701a1d12b85b0371b90f0867b2.png",
  "media/images/mastercard.png": "/packs/media/images/mastercard-a0dda355ba619ab1f12e55be5320eec8.png",
  "media/images/no_avatar.png": "/packs/media/images/no_avatar-5997afd4951fd3ce4e624a2d09d0ca8a.png",
  "media/images/powered_by_stripe.png": "/packs/media/images/powered_by_stripe-a43f123c8b2030f5781f56cdeecc8f5d.png",
  "media/images/social/dailymotion.png": "/packs/media/images/social/dailymotion-a6cfb9ecfa917eaf4a421cae72178aee.png",
  "media/images/social/echosciences.png": "/packs/media/images/social/echosciences-61a0f9c30e48bb1b30ff2f495bf6234e.png",
  "media/images/visa.png": "/packs/media/images/visa-e31b5cb84a808cb0dfd02617680fa931.png",
  "media/jquery-minicolors/jquery.minicolors.png": "/packs/media/jquery-minicolors/jquery.minicolors-0e614115.png",
  "media/webfonts/fa-brands-400.eot": "/packs/media/webfonts/fa-brands-400-bfcc3384.eot",
  "media/webfonts/fa-brands-400.svg": "/packs/media/webfonts/fa-brands-400-63b56623.svg",
  "media/webfonts/fa-brands-400.ttf": "/packs/media/webfonts/fa-brands-400-1776173e.ttf",
  "media/webfonts/fa-brands-400.woff": "/packs/media/webfonts/fa-brands-400-28d8b8fc.woff",
  "media/webfonts/fa-brands-400.woff2": "/packs/media/webfonts/fa-brands-400-37913cdf.woff2",
  "media/webfonts/fa-regular-400.eot": "/packs/media/webfonts/fa-regular-400-0c6f12b9.eot",
  "media/webfonts/fa-regular-400.svg": "/packs/media/webfonts/fa-regular-400-1b536b78.svg",
  "media/webfonts/fa-regular-400.ttf": "/packs/media/webfonts/fa-regular-400-c9c57c0f.ttf",
  "media/webfonts/fa-regular-400.woff": "/packs/media/webfonts/fa-regular-400-fcaa6c13.woff",
  "media/webfonts/fa-regular-400.woff2": "/packs/media/webfonts/fa-regular-400-c3c2ab4f.woff2",
  "media/webfonts/fa-solid-900.eot": "/packs/media/webfonts/fa-solid-900-dfaa060a.eot",
  "media/webfonts/fa-solid-900.svg": "/packs/media/webfonts/fa-solid-900-3e2bc2ff.svg",
  "media/webfonts/fa-solid-900.ttf": "/packs/media/webfonts/fa-solid-900-a480ec97.ttf",
  "media/webfonts/fa-solid-900.woff": "/packs/media/webfonts/fa-solid-900-22aa6d43.woff",
  "media/webfonts/fa-solid-900.woff2": "/packs/media/webfonts/fa-solid-900-4055b057.woff2",
  "plugins.css": "/packs/css/plugins-cdb220ae.chunk.css",
  "plugins.js": "/packs/js/plugins-344e93397bdf8ee9771a.chunk.js",
  "plugins.js.map": "/packs/js/plugins-344e93397bdf8ee9771a.chunk.js.map",
  "printer.css": "/packs/css/printer-439889a8.chunk.css",
  "printer.js": "/packs/js/printer-bc8bdcb1ad6b92648f25.chunk.js",
  "printer.js.map": "/packs/js/printer-bc8bdcb1ad6b92648f25.chunk.js.map",
  "runtime~application.js": "/packs/js/runtime~application-8e9980e8348782e5eacb.js",
  "runtime~application.js.map": "/packs/js/runtime~application-8e9980e8348782e5eacb.js.map",
  "runtime~plugins.js": "/packs/js/runtime~plugins-9286b37c3cc1da1c1760.js",
  "runtime~plugins.js.map": "/packs/js/runtime~plugins-9286b37c3cc1da1c1760.js.map",
  "runtime~printer.js": "/packs/js/runtime~printer-420a3073fabbb1caea06.js",
  "runtime~printer.js.map": "/packs/js/runtime~printer-420a3073fabbb1caea06.js.map",
  "vendors~application.css": "/packs/css/vendors~application-6f69d76f.chunk.css",
  "vendors~application.js": "/packs/js/vendors~application-8e455bcde358dfaa0c23.chunk.js",
  "vendors~application.js.map": "/packs/js/vendors~application-8e455bcde358dfaa0c23.chunk.js.map"
sylvainbx commented 3 years ago

From what I can see, your assets seems to be successfully generated and well served through nginx. The issue must came from somewhere else... Have you checked the browser console?

guidtz commented 3 years ago

Ok first error :

Content Security Policy: Les paramètres de la page ont empêché le chargement d’une ressource à inline (« script-src »). 3 utils.js:35:9

Second error

TypeError: t is undefined
    l home.js:67
    <anonymous> home.js:46
    <anonymous> home.js:312
    Angular 33
    jQuery 13
    <anonymous> vendors~application-8e455bcde358dfaa0c23.chunk.js:2
    Webpack 8
 <section id="content-main" class="scrollable ng-scope" ui-view="main">

And

XHR POSThttps://mon.url.com/users/sign_in.json

An idea ?

gus-abreu commented 3 years ago

Can confirm. I'm trying to create a fresh install using the production script and getting a few errors, like the Yarn one:

\curl -sSL setup.fab-manager.com | bash
Stylesheet Load (0.5ms)  SELECT  "stylesheets".* FROM "stylesheets" WHERE "stylesheets"."name" = $1 LIMIT $2  [["name", "home_page"], ["LIMIT", 1]]
rake aborted!
NameError: uninitialized constant Stylesheet::Sass
yarn install v1.19.2
[1/4] Resolving packages...
[2/4] Fetching packages...
error Couldn't find the binary git
Compiling...
Compilation failed:
Hash: 6d617647fd8d1d46e815
Version: webpack 4.44.1
ERROR in ./app/frontend/packs/plugins.scss.erb
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/rails-erb-loader/index.js):
Error: rails-erb-loader failed with code: 1
ERROR in ./app/frontend/packs/application.js.erb
Module build failed (from ./node_modules/rails-erb-loader/index.js):
Error: rails-erb-loader failed with code: 1

And a few others... The installation script then proceeds but I get the We're sorry, but something went wrong. page when trying to access via browser.

A tail of the logs if it helps:

tail /apps/fabmanager/log/*
==> /apps/fabmanager/log/access.log <==
64.78.149.164 - - [25/Nov/2020:20:13:10 +0000] "GET /.well-known/acme-challenge/7X2WKRaXRv2DwfK7rZGFGSN8JkHtyr9L3iewpQidESE HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" "-"
52.28.236.88 - - [25/Nov/2020:20:13:10 +0000] "GET /.well-known/acme-challenge/7X2WKRaXRv2DwfK7rZGFGSN8JkHtyr9L3iewpQidESE HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" "-"
34.211.6.84 - - [25/Nov/2020:20:13:10 +0000] "GET /.well-known/acme-challenge/7X2WKRaXRv2DwfK7rZGFGSN8JkHtyr9L3iewpQidESE HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" "-"
3.128.26.105 - - [25/Nov/2020:20:13:12 +0000] "GET /.well-known/acme-challenge/7X2WKRaXRv2DwfK7rZGFGSN8JkHtyr9L3iewpQidESE HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" "-"
MYIP - - [25/Nov/2020:20:16:08 +0000] "GET / HTTP/2.0" 502 1477 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Safari/605.1.15" "-"

==> /apps/fabmanager/log/app-stderr.log <==
    from /usr/local/bundle/gems/railties-5.2.4.4/lib/rails/commands.rb:18:in `<main>'
    from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /usr/local/bundle/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:291:in `block in require'
    from /usr/local/bundle/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:257:in `load_dependency'
    from /usr/local/bundle/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:291:in `require'
    from bin/rails:4:in `<main>'

==> /apps/fabmanager/log/app-stdout.log <==
Exiting
=> Booting Puma
=> Rails 5.2.4.4 application starting in production 
=> Run `rails server -h` for more startup options
  AuthProvider Load (0.4ms)  SELECT  "auth_providers".* FROM "auth_providers" WHERE "auth_providers"."status" = $1 LIMIT $2  [["status", "active"], ["LIMIT", 1]]
  AuthProvider Load (0.3ms)  SELECT  "auth_providers".* FROM "auth_providers" WHERE "auth_providers"."status" = $1 LIMIT $2  [["status", "active"], ["LIMIT", 1]]
  AuthProvider Load (0.5ms)  SELECT  "auth_providers".* FROM "auth_providers" WHERE "auth_providers"."status" = $1 LIMIT $2  [["status", "active"], ["LIMIT", 1]]
  AuthProvider Load (0.7ms)  SELECT  "auth_providers".* FROM "auth_providers" WHERE "auth_providers"."status" = $1 LIMIT $2  [["status", "active"], ["LIMIT", 1]]
  AuthProvider Load (0.5ms)  SELECT  "auth_providers".* FROM "auth_providers" WHERE "auth_providers"."status" = $1 LIMIT $2  [["status", "active"], ["LIMIT", 1]]
Exiting

==> /apps/fabmanager/log/error.log <==
2020/11/25 20:16:08 [warn] 20#20: no resolver defined to resolve ocsp.int-x3.letsencrypt.org while requesting certificate status, responder: ocsp.int-x3.letsencrypt.org, certificate: "/etc/letsencrypt/live/DOMAIN/fullchain.pem"
2020/11/25 20:16:08 [error] 20#20: *1 connect() failed (111: Connection refused) while connecting to upstream, client: MYIP, server: DOMAIN, request: "GET / HTTP/2.0", upstream: "http://172.19.0.5:3000/", host: "DOMAIN"

==> /apps/fabmanager/log/supervisord.log <==
2020-11-25 20:27:21,891 INFO success: worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-11-25 20:27:21,913 INFO exited: app (exit status 1; not expected)
2020-11-25 20:27:22,917 INFO spawned: 'app' with pid 710
2020-11-25 20:27:24,877 INFO success: app entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-11-25 20:27:24,877 INFO exited: worker (exit status 1; not expected)
2020-11-25 20:27:25,337 INFO spawned: 'worker' with pid 713
2020-11-25 20:27:26,130 INFO exited: app (exit status 1; not expected)
2020-11-25 20:27:27,134 INFO spawned: 'app' with pid 714
2020-11-25 20:27:27,134 INFO success: worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-11-25 20:27:28,504 INFO success: app entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

==> /apps/fabmanager/log/worker-stderr.log <==
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/usr/local/bundle/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/usr/local/bundle/bin/bundle:23:in `load'
/usr/local/bundle/bin/bundle:23:in `<main>'

==> /apps/fabmanager/log/worker-stdout.log <==
2020-11-25T20:27:27.900Z pid=713 tid=gon61hgwt INFO: Cron Jobs - add job with name: generate_statistic
2020-11-25T20:27:27.905Z pid=713 tid=gon61hgwt INFO: Cron Jobs - add job with name: i_calendar_import
2020-11-25T20:27:27.911Z pid=713 tid=gon61hgwt INFO: Cron Jobs - add job with name: open_api_trace_calls_count
2020-11-25T20:27:27.916Z pid=713 tid=gon61hgwt INFO: Cron Jobs - add job with name: reservation_reminder
2020-11-25T20:27:27.922Z pid=713 tid=gon61hgwt INFO: Cron Jobs - add job with name: close_period_reminder_worker
2020-11-25T20:27:27.927Z pid=713 tid=gon61hgwt INFO: Cron Jobs - add job with name: free_disk_space
2020-11-25T20:27:27.933Z pid=713 tid=gon61hgwt INFO: Cron Jobs - add job with name: version_check
  AuthProvider Load (0.6ms)  SELECT  "auth_providers".* FROM "auth_providers" WHERE "auth_providers"."status" = $1 LIMIT $2  [["status", "active"], ["LIMIT", 1]]
  AuthProvider Load (0.6ms)  SELECT  "auth_providers".* FROM "auth_providers" WHERE "auth_providers"."status" = $1 LIMIT $2  [["status", "active"], ["LIMIT", 1]]
  AuthProvider Load (1.0ms)  SELECT  "auth_providers".* FROM "auth_providers" WHERE "auth_providers"."status" = $1 LIMIT $2  [["status", "active"], ["LIMIT", 1]]
guidtz commented 3 years ago

@sylvainbx vous avez un forfait d'intervention sur des serveurs externes à vos services pour résoudre ce problème et pour mettre à jour une autre installation ?

sylvainbx commented 3 years ago

I don't know anything about the first error, it seems something like an nginx configuration issue...

The second error is more meaningful: the HTML content of the homepage is not defined in the settings (in DB). As you are upgrading from 4.2.3, it means that this setting was probably never set, so maybe there was an error with the upgrade process and the rails db:seed command did not succeed. Try to run it again and tell us what is going on.

The third message only means that you currently logged out.

sylvainbx commented 3 years ago

@guidtz Oui, nous pouvons faire cela. Merci d'envoyer un mail à clara@sleede.com pour obtenir un devis

gus-abreu commented 3 years ago

release 4.6.4 fixed the issue and I was able to install a fresh production server. Thanks!

guidtz commented 3 years ago

@sylvainbx demande de devis faite, objectif remettre en route pour que je reprenne des mises à jour plus régulières à partir de la dernière version