title: rails precompiled assets in public/packs not being served in production on ec2 instance
body: <p>I'm deploying a rails 6 application with webpacker on AWS ec2 instance with Nginx, using Capistrano. The first time i deployed the app in production i did so without precompiling assets locally and took too long and finally worked. But as my application becomes larger with many css, js and other assets to compile i went on precompiling locally using <code>RAILS_ENV=production bundle exec rails assets:precompile</code>. Then i  deployed to production with <code>SKIP_ASSETS=1 cap production deploy</code> where SKIP_ASSETS is a rake task in capistrano/task folder. I was able to deploy the app faster without assets being compiled on production server. When i refresh the brower, i can see my app but the assets precompiled in the folder public/packs are not being served (the hash of the .css and .js file do not match that in public/packs.</p>
  
  <p>I get the following error when i look at the browser console</p>
  
  <pre><code>GET https://somedomain.net/packs/css/application-e1eaaa01.css net::ERR_ABORTED 404 (Not Found)
  GET https://somedomain.net/packs/js/application-a89fd481878017456cf7.js net::ERR_ABORTED 404 (Not Found)
  </code></pre>
  
  <p>this is what i see in production in public/packs/css/ </p>
  
  <pre><code>application-91e4cb67.css  application-91e4cb67.css.br  application-91e4cb67.css.gz
  </code></pre>
  
  <p>Looking at the log in production i found this</p>
  
  <pre><code>FATAL -- : [2c61c3a9-0133-4eda-b37b-4fefe8948ec0]   
  [2c61c3a9-0133-4eda-b37b-4fefe8948ec0] ActionController::RoutingError (No route matches [GET] "/packs/js/application-a89fd481878017456cf7.js"):
  </code></pre>
  
  <p>Looking at nginx.conf i have this line</p>
  
  <pre><code>root /home/deploy/myapp/current/public
  </code></pre>
  
  <p>I also tried setting this in <code>production.rb</code> but it did'nt solve the problem</p>
  
  <pre><code>config.public_file_server.enabled=true
  </code></pre>
  
  <p>public/packs/manifest.json looks like this:</p>
  
  <pre><code>{
    "admin.js": "/packs/js/admin-3adbcf597c3892508a80.js",
    "admin.js.map": "/packs/js/admin-3adbcf597c3892508a80.js.map",
    "app.js": "/packs/js/app-aedc421c2c4342e69b23.js",
    "app.js.map": "/packs/js/app-aedc421c2c4342e69b23.js.map",
    "application.css": "/packs/css/application-e1eaaa01.css",
    "application.css.map": "/packs/css/application-e1eaaa01.css.map",
    "application.js": "/packs/js/application-a89fd481878017456cf7.js",
    "application.js.map": "/packs/js/application-a89fd481878017456cf7.js.map",
    "curriculum.js": "/packs/js/curriculum-90932b11d8e738537011.js",
    "curriculum.js.map": "/packs/js/curriculum-90932b11d8e738537011.js.map",
    "entrypoints": {
      "admin": {
        "js": [
          "/packs/js/admin-3adbcf597c3892508a80.js"
        ],
        "js.map": [
          "/packs/js/admin-3adbcf597c3892508a80.js.map"
        ]
      },
      "app": {
        "js": [
          "/packs/js/app-aedc421c2c4342e69b23.js"
        ],
        "js.map": [
          "/packs/js/app-aedc421c2c4342e69b23.js.map"
        ]
      },
      "application": {
        "css": [
          "/packs/css/application-e1eaaa01.css"
        ],
        "js": [
          "/packs/js/application-a89fd481878017456cf7.js"
        ],
        "css.map": [
          "/packs/css/application-e1eaaa01.css.map"
        ],
        "js.map": [
          "/packs/js/application-a89fd481878017456cf7.js.map"
        ]
      },
      "curriculum": {
        "js": [
          "/packs/js/curriculum-90932b11d8e738537011.js"
        ],
        "js.map": [
          "/packs/js/curriculum-90932b11d8e738537011.js.map"
        ]
      },
      "jquery-ui": {
        "js": [
          "/packs/js/jquery-ui-3e39ba39480cd149114d.js"
        ],
        "js.map": [
          "/packs/js/jquery-ui-3e39ba39480cd149114d.js.map"
        ]
      },
      "jquery": {
        "js": [
          "/packs/js/jquery-9e6aaa895e0224ac507d.js"
        ],
        "js.map": [
          "/packs/js/jquery-9e6aaa895e0224ac507d.js.map"
        ]
      },
      "quill_editor": {
        "js": [
          "/packs/js/quill_editor-9b402f092ddc5d16a887.js"
        ],
        "js.map": [
          "/packs/js/quill_editor-9b402f092ddc5d16a887.js.map"
        ]
      },
      "shared_javascript": {
        "js": [
          "/packs/js/shared_javascript-f0cae6e551b8cfc573c9.js"
        ],
        "js.map": [
          "/packs/js/shared_javascript-f0cae6e551b8cfc573c9.js.map"
        ]
      },
      "video_player": {
        "js": [
          "/packs/js/video_player-8b5df237b6fc7da9efea.js"
        ],
        "js.map": [
          "/packs/js/video_player-8b5df237b6fc7da9efea.js.map"
        ]
      }
    },
    "jquery-ui.js": "/packs/js/jquery-ui-3e39ba39480cd149114d.js",
    "jquery-ui.js.map": "/packs/js/jquery-ui-3e39ba39480cd149114d.js.map",
    "jquery.js": "/packs/js/jquery-9e6aaa895e0224ac507d.js",
    "jquery.js.map": "/packs/js/jquery-9e6aaa895e0224ac507d.js.map",
    "quill_editor.js": "/packs/js/quill_editor-9b402f092ddc5d16a887.js",
    "quill_editor.js.map": "/packs/js/quill_editor-9b402f092ddc5d16a887.js.map",
    "shared_javascript.js": "/packs/js/shared_javascript-f0cae6e551b8cfc573c9.js",
    "shared_javascript.js.map": "/packs/js/shared_javascript-f0cae6e551b8cfc573c9.js.map",
    "video_player.js": "/packs/js/video_player-8b5df237b6fc7da9efea.js",
    "video_player.js.map": "/packs/js/video_player-8b5df237b6fc7da9efea.js.map"
  }
  </code></pre>
  
  <p>I have the feeling the manifest in not being updated with the new precompiled .css et .js assets hashes.</p>
  
  <p>Any idea how i can solve this issue in production ? do i need to run a specific webpacker command on production to solve this issue. Thanks</p>