Skip to content

Instantly share code, notes, and snippets.

View alazycoder101's full-sized avatar

Lazy coder alazycoder101

View GitHub Profile
  1. activate_control_app will enable the Control/Status server in puma. It can also be enabled via the command line:
puma --control-url tcp://127.0.0.1:9293 --control-token foo

is equivalent to.

#config/puma.rb activate_control_app "tcp://127.0.0.1:9293", { auth_token: "foo" } 
 => ERROR [7/7] RUN bundle exec rake assets:precompile                                                                                             1.1s
------
 > [7/7] RUN bundle exec rake assets:precompile:
#0 1.033 rake aborted!
#0 1.037 LoadError: cannot load such file -- nokogiri/nokogiri
#0 1.037 /usr/local/bundle/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
#0 1.037 /usr/local/bundle/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
#0 1.037 /usr/local/bundle/gems/nokogiri-1.13.8-aarch64-linux/lib/nokogiri/extension.rb:30:in `rescue in <main>'
#0 1.037 /usr/local/bundle/gems/nokogiri-1.13.8-aarch64-linux/lib/nokogiri/extension.rb:4:in `<main>'
➜ ssh -o 'ControlMaster=no' -T git@github.com
Hi user! You've successfully authenticated, but GitHub does not provide shell access.

➜ ssh -o 'ControlPath=no' -T git@github.com
Hi user! You've successfully authenticated, but GitHub does not provide shell access.
load_module modules/ngx_http_lua_module-debug.so;
...
upstream app {
    server 127.0.0.1:1234;
    server 127.0.0.1:2345;
}
server {
    listen 1234;
 location / {
bash-5.1# /usr/bin/chromedriver --version
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
bash-5.1# arch
aarch64
> create database test;
> create user
> GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';
> ALTER USER 'wordpress'@'%' IDENTIFIED BY 'new-password';
> use db;
> show tables;
> desc table
> select * from mysql.user;

multipass

❯ brew install multipass

❯ multipass version
multipass   1.10.1+mac
multipassd  1.10.1+mac

❯ multipass find

Buildpack vs Dockerfile

brew install buildpacks/tap/pack

or with docker image

Ruby library error

begin nil > 0; rescue => e; puts e; end
undefined method `>' for nil:NilClass

> begin 1/0; rescue => e; puts e.inspect; end
#<ZeroDivisionError: divided by 0>

nginx

proxy_set_header X-Request-Start "t=${msec}";

A good indicator of capacity therefore is the queue time metric, e.g. the amount of time between when the outer webserver accepted the request and Ruby handles the request. A long queue time for a longer period of time indicates that you'll need to scale up the amount of Ruby processes/threads to handle requests, or scale more webservers.

https://github.com/adamlogic/rails_autoscale_agent