小编Ral*_*mos的帖子

rails 4 不在资产文件名中使用摘要,而仅在生产中使用

我有一个 Rails 4 应用程序,它最近进行了大量升级(在 gem 版本和其他一些东西方面)。部署工作正常,但是一旦我们清除了我们的 tmp 目录,我们就会注意到资产在生产中停止工作。发生的事情是出于某种原因在生产模式下,助手没有在任何资产文件名中使用摘要(例如,/javascripts/application.js而不是/javascripts/application-some-digest.js)。这会导致这些资产变为 404,因为它们确实存在于public目录中,并带有其正确的摘要名称,并且 Google App Engine 被设置为独立为公共目录提供静态文件(这一直工作正常)。然而,真正奇怪的是,在暂存模式下,应用程序一切正常,因此我们的生产环境中有一些东西使助手不使用摘要。

然而,更奇怪的是,如果我去RAILS_ENV=production rails consolehelper.asset_path 'application.js'我会得到正确的文件名和摘要。这到底是怎么回事?

是的,我们RAILS_ENV=production rake:assets:precompile在部署之前正在做。

以下是来自的相关部分config/environments/production.rb

  config.eager_load = true
  config.assets.cache_store = :dalli_store
  # Don't force SSL because we need non-ssl cookies.
  config.force_ssl = false
  config.stripe_livemode = true
  config.assets.digest = true
  config.assets.compile = false
Run Code Online (Sandbox Code Playgroud)

以下是来自的相关部分config/environments/shared.rb

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_files = false …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails sprockets ruby-on-rails-4

6
推荐指数
0
解决办法
213
查看次数

如何在 flutter 和 firestore 中使用WhereIn?

在电子商务 flutter 应用程序项目中,我使用shortInfo项目集合的字段作为每个产品的唯一 ID。当按下“添加到购物车”时,它会将其保存到在我的集合中shortInfo调用的数组字段,我正在使用WhereIn来查询该数组,但是当我有超过10个产品时,我的应用程序崩溃了。我在这里做错了什么?userCartListusers

这是我的 Firestore 结构:

用户收藏

物品收集

这是我正在执行的查询的片段:

StreamBuilder<QuerySnapshot>( 
    stream: EcommerceApp.firestore
                        .collection("items")
                        .where("shortInfo", whereIn: EcommerceApp.sharedPreferences.getStringList(EcommerceApp.userCartList))
                        .snapshots()
)
Run Code Online (Sandbox Code Playgroud)

firebase flutter google-cloud-firestore

6
推荐指数
1
解决办法
8593
查看次数

错误:无法删除非 root 用户的权限:容器在 Google Cloud Compute Engine 上不断重新启动

我已经搜索过,但似乎找不到此错误的答案。创建新虚拟机时出现“错误:无法删除非 root 用户的权限”。

容器不断重新启动。它在我本地的 MacOS 机器上运行得很好。

我正在尝试在具有容器优化操作系统的 Google Compute Engine VM 上运行该映像。我正在使用 nginx、php-fpm 和 alpine。

Supervisord.conf 文件如下所示:

[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
pidfile=/run/supervisord.pid
user=root

[program:php-fpm]
command=php-fpm8 -F
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autostart=true
autorestart=true
priority=5
stdout_events_enabled=true
stderr_events_enabled=true

[program:nginx]
command=nginx -g 'daemon off;'
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0
Run Code Online (Sandbox Code Playgroud)

有人也遇到过这个错误吗?

php nginx google-compute-engine docker alpine-linux

5
推荐指数
1
解决办法
5857
查看次数