改线上了,这两天出公告。
无头浏览器指没有图形界面,直接执行脚本代码。electron 不属于这类。
electron 作用是利用本地系统通知和获得访问文件权限,这两个现在浏览器也有 API 了。剩下的就是习惯问题,像 https://vscode.dev/ 已经在浏览器内实现了完整功能,看能不能习惯完全在浏览器内写代码。
去掉 do
就行了。
从错误信息看从解包就出异常了,很可能是下载下来的包是坏文件。
有可能网络问题。
http://nginx.org/en/docs/http/server_names.html
通过 server_name 指定不同域名对应不同应用。
$ bin/rails -T | grep db
rails db:create # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to creating the development and test databases, except when DATABASE_URL is present
rails db:drop # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to dropping the development and test databases, except when DATABASE_URL is present
rails db:environment:set # Set the environment value for the database
rails db:fixtures:load # Loads fixtures into the current environment's database
rails db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rails db:migrate:down # Runs the "down" for a given migration VERSION
rails db:migrate:redo # Rolls back the database one migration and re-migrates up (options: STEP=x, VERSION=x)
rails db:migrate:status # Display status of migrations
rails db:migrate:up # Runs the "up" for a given migration VERSION
rails db:prepare # Runs setup if database does not exist, or runs migrations if it does
rails db:reset # Drops and recreates the database from db/schema.rb for the current environment and loads the seeds
rails db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rails db:schema:cache:clear # Clears a db/schema_cache.yml file
rails db:schema:cache:dump # Creates a db/schema_cache.yml file
rails db:schema:dump # Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`)
rails db:schema:load # Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`) into the database
rails db:seed # Loads the seed data from db/seeds.rb
rails db:seed:replant # Truncates tables of each database for current environment and loads the seeds
rails db:setup # Creates the database, loads the schema, and initializes with the seed data (use db:reset to also drop the database first)
rails db:structure:dump # Dumps the database structure to db/structure.sql
rails db:structure:load # Recreates the databases from the structure.sql file
rails db:version # Retrieves the current schema version number
rails test:db # Run tests quickly, but also reset db
如果是推广产品就好好做个介绍,不是留个链接让大家猜你想表达什么。
跟随 Rails 版本升级,就不用太担心框架层面的漏洞。业务代码的漏洞强烈推荐 https://github.com/presidentbeef/brakeman 这个 gem,把它加到 CI 流程。
rack-attack 可以防比较简单的脚本攻击,例如不停的发贴。真遇到 ddos 攻击需要云服务的防火墙服务。
现在想学个语言能够自由去根据自己业务做定制开发
按这个需求 Rails 好。跟着 Rails 全栈是最省心的。
docker
卡池有没有 DHH 型的?
超出预算。
用框架没必要把源码都看懂吧,也就出 bug 的时候会看一下是框架问题还是自己问题。
Web 应用相当一部分在调外部接口,例如支付接口、错误收集、日志系统,如果用小众语言发现没有相应的 client 就要自己写了,很麻烦。(Ruby 在 Web 领域不是小众)
如果喜欢轻量级框架,应该试试 Sinatra,起码有 Stripe 在用,证明了生产环境可靠性。
(主楼没必要把文档贴上来,太长影响回复)
那实际超出了没?
不用,我用 ubuntu 镜像然后装源里面的 ruby。如果需要特定 ruby 版本就用 ruby 的镜像。
现在开发环境已经需要四个进程,Rails,sidekiq,scss,esbuild,另开终端已经显得麻烦了。
Rails css/js-buundling 默认用 foreman 启动开发进程,因为 foreman 是 Ruby gem。
对我来说 docker 是更好的选择,开发环境用 docker compose,生产环境用 docekr swarm。
foreman 是开发环境用的,作者曾经在 heroku 工作,所以 Profile 和 heroku 的格式一样。
生产环境应该 export 到系统的管理配置,例如 upstart,stystemd http://ddollar.github.io/foreman/#EXPORT-FORMATS
foreman 诞生的时候 systemd 还没成为主流。
清华源也是 lets encrypt 的,就新了 20 天,是不是有什么不同?
信息不充足,把项目 push 到 GitHub 让看看源码。
另外 webpacker 已经预定在下个版本移除,没必要现在学。如果要用 webpack 和 react 独立配置即可,不需要 webpakcer。 https://ruby-china.org/topics/41699
我是用官方源的,而且 Ruby 和系统都是比较新的应该不会遇到这个问题。
let's encrypt 的旧根证书过期,需要更新客户端 https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/
尝试更新 rubygem,Ruby 版本或系统的 ca bundle。
param = 200
给 param 赋予了一个新的 object,所以没有改变 count 的值。
Integer 类型不能改变自身,要用一些可以改变自身的类型,例如 Hash 或者自己创建一个类:
data = { count: 500 }
proc = Proc.new { |params|
params[:count] = 200
}
proc.call(data)
puts data[:count]
#=> 200
这是不正常的,先搞清楚目前在用什么机制,importmap 吗?
app server 的多线程是为了提高并发,不然前一个请求完成之前,后面来的请求都要阻塞。
用 docker 就不用管 buildpack 支不支持了