add ruby provider (#122)

This commit is contained in:
Jared Lunde
2025-03-26 09:07:21 -07:00
committed by GitHub
parent 428ae5c483
commit b2e5c3205c
172 changed files with 6995 additions and 5 deletions
@@ -0,0 +1,161 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app"
],
"step": "build"
}
],
"startCommand": "ruby app.rb",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.3.7"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,161 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app"
],
"step": "build"
}
],
"startCommand": "ruby --enable-yjit app.rb",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y cargo libyaml-dev rustc'",
"customName": "install apt packages: cargo libyaml-dev rustc"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.4.9"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,161 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app"
],
"step": "build"
}
],
"startCommand": "ruby app.rb",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: node, ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.3.7"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,165 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app"
],
"step": "build"
}
],
"startCommand": "bundle exec ruby app.rb",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.3.7"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"dest": "libs/local",
"src": "libs/local"
},
{
"cmd": "bundle install"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,161 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app"
],
"step": "build"
}
],
"startCommand": "ruby app.rb",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y cargo libyaml-dev rustc'",
"customName": "install apt packages: cargo libyaml-dev rustc"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.3.12"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,168 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app",
"lib/"
],
"step": "build"
}
],
"startCommand": "rake db:migrate \u0026\u0026 bundle exec bin/rails server -b 0.0.0.0 -p ${PORT:-3000}",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.4.2"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"cmd": "bundle exec bootsnap precompile --gemfile"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
},
{
"cmd": "bundle exec bootsnap precompile app/ lib/"
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,171 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app",
"lib/"
],
"step": "build"
}
],
"startCommand": "rake db:migrate \u0026\u0026 bundle exec bin/rails server -b 0.0.0.0 -p ${PORT:-3000}",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y cargo libyaml-dev rustc'",
"customName": "install apt packages: cargo libyaml-dev rustc"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.4.9"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"cmd": "bundle exec bootsnap precompile --gemfile"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
},
{
"cmd": "bundle exec rake assets:precompile"
},
{
"cmd": "bundle exec bootsnap precompile app/ lib/"
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y default-libmysqlclient-dev libicu-dev libmagickwand-dev libpq-dev libvips-dev libxml2-dev libxslt-dev libyaml-dev'",
"customName": "install apt packages: default-libmysqlclient-dev libicu-dev libmagickwand-dev libpq-dev libvips-dev libxml2-dev libxslt-dev libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,161 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app"
],
"step": "build"
}
],
"startCommand": "RACK_ENV=production bundle exec puma",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.3.7"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,161 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app"
],
"step": "build"
}
],
"startCommand": "ruby app.rb",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.3.7"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
@@ -0,0 +1,269 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
},
"node-modules": {
"directory": "/app/node_modules/.cache",
"type": "shared"
},
"npm-install": {
"directory": "/root/.npm",
"type": "shared"
}
},
"deploy": {
"inputs": [
{
"step": "packages:runtime"
},
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/usr/local/bundle"
],
"step": "install"
},
{
"include": [
"/app"
],
"step": "build"
},
{
"exclude": [
"node_modules",
".yarn"
],
"include": [
"."
],
"step": "build:node"
},
{
"include": [
"/app/node_modules"
],
"step": "prune:node"
}
],
"startCommand": "ruby app.rb",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
},
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "sh -c 'mise trust -a \u0026\u0026 mise install'",
"customName": "install mise packages: node, ruby"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_SHIMS_DIR": "/mise/shims"
}
},
{
"commands": [
{
"cmd": "gem install -N bundler:2.3.7"
},
{
"dest": "Gemfile",
"src": "Gemfile"
},
{
"dest": "Gemfile.lock",
"src": "Gemfile.lock"
},
{
"cmd": "bundle install"
},
{
"path": "/usr/local/bundle"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"npm-install"
],
"commands": [
{
"path": "/app/node_modules/.bin"
},
{
"dest": "package.json",
"src": "package.json"
},
{
"dest": "package-lock.json",
"src": "package-lock.json"
},
{
"cmd": "npm ci"
}
],
"inputs": [
{
"step": "packages:mise"
}
],
"name": "install:node",
"variables": {
"CI": "true",
"NODE_ENV": "production",
"NPM_CONFIG_FUND": "false",
"NPM_CONFIG_PRODUCTION": "false",
"NPM_CONFIG_UPDATE_NOTIFIER": "false"
}
},
{
"caches": [
"npm-install"
],
"commands": [
{
"cmd": "npm prune --omit=dev"
}
],
"inputs": [
{
"step": "install:node"
}
],
"name": "prune:node",
"variables": {
"NPM_CONFIG_PRODUCTION": "true"
}
},
{
"caches": [
"node-modules"
],
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
},
{
"include": [
".",
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "install:node"
}
],
"name": "build:node",
"secrets": [
"*"
]
},
{
"commands": [
{
"dest": ".",
"src": "."
}
],
"inputs": [
{
"step": "install"
}
],
"name": "build",
"variables": {
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/bundle",
"GEM_PATH": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2"
}
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libyaml-dev'",
"customName": "install apt packages: libyaml-dev"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:runtime"
}
]
}
+7 -5
View File
@@ -256,7 +256,7 @@ func (p *NodeProvider) InstallMisePackages(ctx *generate.GenerateContext, miseSt
miseStep.Version(node, envVersion, varName)
}
if p.packageJson.Engines != nil && p.packageJson.Engines["node"] != "" {
if p.packageJson != nil && p.packageJson.Engines != nil && p.packageJson.Engines["node"] != "" {
miseStep.Version(node, p.packageJson.Engines["node"], "package.json > engines > node")
}
@@ -318,7 +318,7 @@ func (p *NodeProvider) hasDependency(dependency string) bool {
}
func (p *NodeProvider) usesCorepack() bool {
return p.packageJson.PackageManager != nil && p.packageManager != PackageManagerBun
return p.packageJson != nil && p.packageJson.PackageManager != nil && p.packageManager != PackageManagerBun
}
func (p *NodeProvider) usesPuppeteer() bool {
@@ -434,9 +434,11 @@ func (p *NodeProvider) requiresBun(ctx *generate.GenerateContext) bool {
return true
}
for _, script := range p.packageJson.Scripts {
if strings.Contains(script, "bun") {
return true
if p.packageJson != nil {
for _, script := range p.packageJson.Scripts {
if strings.Contains(script, "bun") {
return true
}
}
}
+2
View File
@@ -8,6 +8,7 @@ import (
"github.com/railwayapp/railpack/core/providers/node"
"github.com/railwayapp/railpack/core/providers/php"
"github.com/railwayapp/railpack/core/providers/python"
"github.com/railwayapp/railpack/core/providers/ruby"
"github.com/railwayapp/railpack/core/providers/shell"
"github.com/railwayapp/railpack/core/providers/staticfile"
)
@@ -27,6 +28,7 @@ func GetLanguageProviders() []Provider {
&golang.GoProvider{},
&java.JavaProvider{},
&python.PythonProvider{},
&ruby.RubyProvider{},
&deno.DenoProvider{},
&node.NodeProvider{},
&staticfile.StaticfileProvider{},
+392
View File
@@ -0,0 +1,392 @@
package ruby
import (
"bufio"
"fmt"
"maps"
"regexp"
"strings"
"github.com/railwayapp/railpack/core/generate"
"github.com/railwayapp/railpack/core/plan"
"github.com/railwayapp/railpack/core/providers/node"
"github.com/railwayapp/railpack/internal/utils"
)
const (
DEFAULT_RUBY_VERSION = "3.4.2"
)
type RubyProvider struct{}
func (p *RubyProvider) Name() string {
return "ruby"
}
func (p *RubyProvider) Initialize(ctx *generate.GenerateContext) error {
return nil
}
func (p *RubyProvider) Detect(ctx *generate.GenerateContext) (bool, error) {
hasRuby := ctx.App.HasMatch("Gemfile")
return hasRuby, nil
}
func (p *RubyProvider) Plan(ctx *generate.GenerateContext) error {
miseStep := ctx.GetMiseStepBuilder()
p.InstallMisePackages(ctx, miseStep)
install := ctx.NewCommandStep("install")
install.AddInput(plan.NewStepInput(miseStep.Name()))
installOutputs := p.Install(ctx, install)
p.addMetadata(ctx)
nodeProvider := &node.NodeProvider{}
nodeDetected, err := nodeProvider.Detect(ctx)
if err != nil {
return err
}
if nodeDetected || p.usesDep(ctx, "execjs") {
nodeProvider.InstallMisePackages(ctx, miseStep)
}
var (
buildNode *generate.CommandStepBuilder
pruneNode *generate.CommandStepBuilder
)
if nodeDetected {
err := nodeProvider.Initialize(ctx)
if err != nil {
return err
}
nodeProvider.InstallMisePackages(ctx, miseStep)
installNode := ctx.NewCommandStep("install:node")
installNode.AddInput(plan.NewStepInput(miseStep.Name()))
nodeProvider.InstallNodeDeps(ctx, installNode)
pruneNode = ctx.NewCommandStep("prune:node")
pruneNode.AddInput(plan.NewStepInput(installNode.Name()))
nodeProvider.PruneNodeDeps(ctx, pruneNode)
buildNode = ctx.NewCommandStep("build:node")
buildNode.Inputs = []plan.Input{
plan.NewStepInput(install.Name()),
plan.NewStepInput(installNode.Name(), plan.InputOptions{
Include: append([]string{"."}, miseStep.GetOutputPaths()...),
}),
}
nodeProvider.Build(ctx, buildNode)
}
build := ctx.NewCommandStep("build")
build.AddInput(plan.NewStepInput(install.Name()))
buildOutputs := p.Build(ctx, build)
ctx.Deploy.StartCmd = p.GetStartCommand(ctx)
maps.Copy(ctx.Deploy.Variables, p.GetRubyEnvVars(ctx))
ctx.Deploy.Inputs = []plan.Input{
p.GetImageWithRuntimeDeps(ctx),
plan.NewStepInput(miseStep.Name(), plan.InputOptions{
Include: miseStep.GetOutputPaths(),
}),
plan.NewStepInput(install.Name(), plan.InputOptions{
Include: installOutputs,
}),
plan.NewStepInput(build.Name(), plan.InputOptions{
Include: buildOutputs,
}),
}
if buildNode != nil && pruneNode != nil {
ctx.Deploy.Inputs = append(ctx.Deploy.Inputs,
plan.NewStepInput(buildNode.Name(), plan.InputOptions{
Include: []string{"."},
Exclude: []string{"node_modules", ".yarn"},
}),
plan.NewStepInput(pruneNode.Name(), plan.InputOptions{
Include: []string{"/app/node_modules"},
}),
)
}
return nil
}
func (p *RubyProvider) GetStartCommand(ctx *generate.GenerateContext) string {
startCommand := ""
app := ctx.App
if p.usesRails(ctx) {
if app.HasMatch("rails") {
return "bundle exec rails server -b 0.0.0.0 -p ${PORT:-3000}"
} else {
return "bundle exec bin/rails server -b 0.0.0.0 -p ${PORT:-3000} -e $RAILS_ENV"
}
} else if app.HasMatch("config/environment.rb") && app.HasMatch("script") {
return "bundle exec ruby script/server -p ${PORT:-3000}"
} else if app.HasMatch("config.ru") {
return "bundle exec rackup config.ru -p ${PORT:-3000}"
} else if app.HasMatch("Rakefile") {
return "bundle exec rake"
}
return startCommand
}
func (p *RubyProvider) StartCommandHelp() string {
return "To start your Ruby application, Railpack will automatically:\n\n" +
"1. Start the Rails server if a Rails application is detected\n" +
"2. Start the Ruby server if a config/environment.rb and script/server file is found\n" +
"3. Start the Rack server if a config.ru file is found\n" +
"4. Run the Rakefile if a Rakefile is found\n\n" +
"Otherwise, it will not start any server by default."
}
func (p *RubyProvider) Install(ctx *generate.GenerateContext, install *generate.CommandStepBuilder) []string {
install.Secrets = []string{}
install.UseSecretsWithPrefixes([]string{"RUBY", "GEM", "BUNDLE"})
envVars := p.GetRubyEnvVars(ctx)
install.AddEnvVars(envVars)
bundlerVersion := parseBundlerVersionFromGemfile(ctx)
commands := []plan.Command{
plan.NewExecCommand(fmt.Sprintf("gem install -N %s", bundlerVersion)),
plan.NewCopyCommand("Gemfile"),
plan.NewCopyCommand("Gemfile.lock"),
}
for _, path := range parseLocalPathsFromGemfile(ctx) {
commands = append(commands, plan.NewCopyCommand(path))
}
commands = append(commands, plan.NewExecCommand("bundle install"))
if p.usesDep(ctx, "bootsnap") {
commands = append(commands, plan.NewExecCommand("bundle exec bootsnap precompile --gemfile"))
}
install.AddCommands(commands)
install.AddPaths([]string{envVars["GEM_PATH"]})
return []string{envVars["GEM_HOME"]}
}
func (p *RubyProvider) Build(ctx *generate.GenerateContext, build *generate.CommandStepBuilder) []string {
build.Secrets = []string{}
build.UseSecretsWithPrefixes([]string{"RAILS", "BUNDLE", "BOOTSNAP", "SPROCKETS", "WEBPACKER", "ASSET", "DISABLE_SPRING"})
build.AddEnvVars(p.GetRubyEnvVars(ctx))
build.AddCommand(plan.NewCopyCommand("."))
outputs := []string{"/app"}
// Only compile assets if a Rails app have an asset pipeline gem
// installed (e.g. sprockets, propshaft). Rails API-only apps [0]
// do not come with the asset pipelines because they have no assets.
// [0] https://guides.rubyonrails.org/api_app.html
if p.usesRails(ctx) && p.usesAssetPipeline(ctx) {
build.AddCommand(plan.NewExecCommand("bundle exec rake assets:precompile"))
}
if p.usesRails(ctx) && p.usesDep(ctx, "bootsnap") {
build.AddCommand(plan.NewExecCommand("bundle exec bootsnap precompile app/ lib/"))
outputs = append(outputs, "lib/")
}
return outputs
}
func (p *RubyProvider) GetImageWithRuntimeDeps(ctx *generate.GenerateContext) plan.Input {
packages := []string{"libyaml-dev"}
if p.usesPostgres(ctx) {
packages = append(packages, "libpq-dev")
}
if p.usesMysql(ctx) {
packages = append(packages, "default-libmysqlclient-dev")
}
if p.usesDep(ctx, "magick") {
packages = append(packages, "libmagickwand-dev")
}
if p.usesDep(ctx, "vips") {
packages = append(packages, "libvips-dev")
}
if p.usesDep(ctx, "charlock_holmes") {
packages = append(packages, "libicu-dev", "libxml2-dev", "libxslt-dev")
}
return ctx.DefaultRuntimeInputWithPackages(packages)
}
func (p *RubyProvider) GetBuilderDeps(ctx *generate.GenerateContext) *generate.MiseStepBuilder {
miseStep := ctx.GetMiseStepBuilder()
miseStep.SupportingAptPackages = append(miseStep.SupportingAptPackages, "procps")
if p.usesPostgres(ctx) {
miseStep.SupportingAptPackages = append(miseStep.SupportingAptPackages, "libpq-dev")
}
if p.usesMysql(ctx) {
miseStep.SupportingAptPackages = append(miseStep.SupportingAptPackages, "default-libmysqlclient-dev")
}
return miseStep
}
func (p *RubyProvider) InstallMisePackages(ctx *generate.GenerateContext, miseStep *generate.MiseStepBuilder) {
ruby := miseStep.Default("ruby", DEFAULT_RUBY_VERSION)
if envVersion, varName := ctx.Env.GetConfigVariable("RUBY_VERSION"); envVersion != "" {
miseStep.Version(ruby, envVersion, varName)
}
if versionFile, err := ctx.App.ReadFile(".ruby-version"); err == nil {
miseStep.Version(ruby, utils.ExtractSemverVersion(string(versionFile)), ".ruby-version")
}
if gemfileVersion := parseVersionFromGemfile(ctx); gemfileVersion != "" {
miseStep.Version(ruby, gemfileVersion, "Gemfile")
}
miseStep.AddSupportingAptPackage("libyaml-dev")
version := p.getRubyVersion(ctx)
version = utils.ExtractSemverVersion(version)
semver, err := utils.ParseSemver(version)
// YJIT in Ruby 3.1+ requires rustc to install
if err == nil && semver != nil && semver.Major >= 3 && semver.Minor > 1 {
miseStep.AddSupportingAptPackage("rustc")
miseStep.AddSupportingAptPackage("cargo")
}
}
func (p *RubyProvider) getRubyVersion(ctx *generate.GenerateContext) string {
miseStepBuilder := ctx.GetMiseStepBuilder()
pkg := miseStepBuilder.Resolver.Get("ruby")
if pkg != nil && pkg.Version != "" {
return pkg.Version
}
return DEFAULT_RUBY_VERSION
}
func (p *RubyProvider) GetRubyEnvVars(ctx *generate.GenerateContext) map[string]string {
return map[string]string{
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_PATH": "/usr/local/bundle",
"GEM_HOME": "/usr/local/bundle",
"MALLOC_ARENA_MAX": "2",
}
}
func (p *RubyProvider) usesPostgres(ctx *generate.GenerateContext) bool {
return p.usesDep(ctx, "pg")
}
func (p *RubyProvider) usesMysql(ctx *generate.GenerateContext) bool {
return p.usesDep(ctx, "mysql")
}
func (p *RubyProvider) usesRails(ctx *generate.GenerateContext) bool {
contents, err := ctx.App.ReadFile("config/application.rb")
if err != nil {
return false
}
return strings.Contains(contents, "Rails::Application")
}
func (p *RubyProvider) usesAssetPipeline(ctx *generate.GenerateContext) bool {
return p.usesDep(ctx, "sprockets") || p.usesDep(ctx, "propshaft")
}
func (p *RubyProvider) usesDep(ctx *generate.GenerateContext, dep string) bool {
for _, file := range []string{"Gemfile", "Gemfile.lock"} {
if contents, err := ctx.App.ReadFile(file); err == nil {
if strings.Contains(string(contents), dep) {
return true
}
}
}
return false
}
func (p *RubyProvider) addMetadata(ctx *generate.GenerateContext) {
ctx.Metadata.SetBool("rubyRails", p.usesRails(ctx))
ctx.Metadata.SetBool("rubyAssetPipeline", p.usesAssetPipeline(ctx))
ctx.Metadata.SetBool("rubyBootsnap", p.usesDep(ctx, "bootsnap"))
}
var (
gemfileVersionRegex = regexp.MustCompile(`ruby (?:'|")(.*)(?:'|")[^>]"`)
gemfileLockVersionRegex = regexp.MustCompile(`ruby ((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))[^>]`)
)
func parseVersionFromGemfile(ctx *generate.GenerateContext) string {
gemfile, err := ctx.App.ReadFile("Gemfile")
if err != nil {
return ""
}
matches := gemfileVersionRegex.FindStringSubmatch(string(gemfile))
if len(matches) > 2 {
return matches[2]
}
gemfileLock, err := ctx.App.ReadFile("Gemfile.lock")
if err != nil {
return ""
}
matches = gemfileLockVersionRegex.FindStringSubmatch(string(gemfileLock))
if len(matches) > 1 {
return matches[1]
}
return ""
}
func parseBundlerVersionFromGemfile(ctx *generate.GenerateContext) string {
gemfileLock, err := ctx.App.ReadFile("Gemfile.lock")
if err != nil {
return "bundler"
}
scanner := bufio.NewScanner(strings.NewReader(gemfileLock))
foundBundledWith := false
for scanner.Scan() {
line := scanner.Text()
if foundBundledWith {
return fmt.Sprintf("bundler:%s", strings.TrimSpace(line))
}
if strings.Contains(line, "BUNDLED WITH") {
foundBundledWith = true
}
}
// note: we don't need to worry about the scanner error because we are just returning "bundler" in that case anyway
return "bundler"
}
func parseLocalPathsFromGemfile(ctx *generate.GenerateContext) []string {
gemfile, err := ctx.App.ReadFile("Gemfile")
if err != nil {
return []string{}
}
scanner := bufio.NewScanner(strings.NewReader(string(gemfile)))
paths := []string{}
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, "path:") {
p := strings.TrimSpace(strings.Split(line, "path:")[1])
paths = append(paths, strings.Trim(p, "\""))
}
}
return paths
}
+38
View File
@@ -0,0 +1,38 @@
package ruby
import (
"testing"
"github.com/stretchr/testify/require"
testingUtils "github.com/railwayapp/railpack/core/testing"
)
func TestDetect(t *testing.T) {
tests := []struct {
name string
path string
want bool
}{
{
name: "ruby",
path: "../../../examples/ruby-vanilla",
want: true,
},
{
name: "no ruby",
path: "../../../examples/go-mod",
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := testingUtils.CreateGenerateContext(t, tt.path)
provider := RubyProvider{}
got, err := provider.Detect(ctx)
require.NoError(t, err)
require.Equal(t, tt.want, got)
})
}
}
+75
View File
@@ -0,0 +1,75 @@
---
title: Ruby
description: Building Ruby applications with Railpack
---
Railpack builds and deploys Ruby applications with support for several
language-specific tools and frameworks.
## Detection
Your project will be detected as a Ruby application if any of these conditions are met:
- A `Gemfile` file is present
## Versions
The Ruby version is determined in the following order:
- Set via the `RAILPACK_RUBY_VERSION` environment variable
- Read from the `.ruby-version` file
- Read from the `Gemfile` file
- Defaults to `3.4.2`
## Runtime Variables
These variables are available at runtime:
```sh
BUNDLE_GEMFILE="/app/Gemfile"
GEM_PATH="/usr/local/bundle"
GEM_HOME= "/usr/local/bundle"
MALLOC_ARENA_MAX="2"
```
## Configuration
Railpack builds your Ruby application based on your project structure. The build process:
- Installs Ruby and required system dependencies
- Installs project dependencies
- Configures the Ruby environment for production
The start command is determined by:
1. Framework-specific start command (see below)
2. `config/environment.rb` file
3. `config.ru` file
4. `Rakefile` file
### Config Variables
| Variable | Description | Example |
| -------------------------- | --------------------------- | ------------ |
| `RAILPACK_RUBY_VERSION` | Override the Ruby version | `3.4.2` |
## Framework Support
Railpack detects and configures caches and commands for popular frameworks:
### Rails
Railpack detects Rails projects by:
- Presence of `config/application.rb`
### Databases
Railpack automatically installs system dependencies for common databases:
- **PostgreSQL**: Installs `libpq-dev`
- **MySQL**: Installs `default-libmysqlclient-dev`
- **Magick**: Installs `imagemagick`
- **Vips**: Installs `libvips-dev`
- **Charlock Holmes**: Installs `libicu-dev`
+1
View File
@@ -0,0 +1 @@
2.6.6
+2
View File
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
+11
View File
@@ -0,0 +1,11 @@
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
arm64-darwin-21
DEPENDENCIES
BUNDLED WITH
2.3.7
+1
View File
@@ -0,0 +1 @@
web: ruby app.rb
+1
View File
@@ -0,0 +1 @@
puts "Hello from Ruby 2"
+5
View File
@@ -0,0 +1,5 @@
[
{
"expectedOutput": "Hello from Ruby 2"
}
]
+1
View File
@@ -0,0 +1 @@
3.2.1
+1
View File
@@ -0,0 +1 @@
source 'https://rubygems.org'
+12
View File
@@ -0,0 +1,12 @@
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
arm64-darwin-21
x86_64-linux
DEPENDENCIES
BUNDLED WITH
2.4.9
+1
View File
@@ -0,0 +1 @@
web: ruby --enable-yjit app.rb
+6
View File
@@ -0,0 +1,6 @@
if RubyVM::YJIT.enabled?
yjit = "enabled"
else
yjit = "not enabled"
end
puts "Hello from Ruby 3! YJIT is #{yjit}."
+5
View File
@@ -0,0 +1,5 @@
[
{
"expectedOutput": "Hello from Ruby 3! YJIT is enabled."
}
]
+4
View File
@@ -0,0 +1,4 @@
source 'https://rubygems.org'
gem 'execjs', '~> 2.8.1'
+14
View File
@@ -0,0 +1,14 @@
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
arm64-darwin-21
DEPENDENCIES
RUBY VERSION
ruby 3.1.2p20
BUNDLED WITH
2.3.7
+1
View File
@@ -0,0 +1 @@
web: ruby app.rb
+4
View File
@@ -0,0 +1,4 @@
require "execjs"
value = ExecJS.eval "'hello from execjs'.toUpperCase()"
puts value
+5
View File
@@ -0,0 +1,5 @@
[
{
"expectedOutput": "HELLO FROM EXECJS"
}
]
+3
View File
@@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem "local", path: "libs/local"
+20
View File
@@ -0,0 +1,20 @@
PATH
remote: libs/local
specs:
local (0.1.0)
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
arm64-darwin-21
DEPENDENCIES
local!
RUBY VERSION
ruby 3.1.2p20
BUNDLED WITH
2.3.7
+1
View File
@@ -0,0 +1 @@
web: bundle exec ruby app.rb
+4
View File
@@ -0,0 +1,4 @@
require "local"
puts "Hello from local"
Local.hi
@@ -0,0 +1,4 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gemspec
@@ -0,0 +1,5 @@
class Local
def self.hi
puts "Hello world from Local lib"
end
end
@@ -0,0 +1,11 @@
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "local"
s.version = "0.1.0"
s.authors = ["Nixpacks"]
s.homepage = ""
s.summary = ""
s.description = ""
s.license = "MIT"
s.files = ["lib/local.rb"]
end
+5
View File
@@ -0,0 +1,5 @@
[
{
"expectedOutput": "Hello world from Local lib"
}
]
+5
View File
@@ -0,0 +1,5 @@
source 'https://rubygems.org'
gem 'sinatra'
gem "puma", "~> 5.6"
+28
View File
@@ -0,0 +1,28 @@
GEM
remote: https://rubygems.org/
specs:
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
nio4r (2.5.8)
puma (5.6.4)
nio4r (~> 2.0)
rack (2.2.3.1)
rack-protection (2.2.0)
rack
ruby2_keywords (0.0.5)
sinatra (2.2.0)
mustermann (~> 1.0)
rack (~> 2.2)
rack-protection (= 2.2.0)
tilt (~> 2.0)
tilt (2.0.10)
PLATFORMS
x86_64-linux
DEPENDENCIES
puma (~> 5.6)
sinatra
BUNDLED WITH
2.3.12
+1
View File
@@ -0,0 +1 @@
web: ruby app.rb
+5
View File
@@ -0,0 +1,5 @@
require 'sinatra'
puts "Hello from Sinatra"
get '/' do
'Choo Choo! Welcome to your Sinatra server 🚅'
end
+3
View File
@@ -0,0 +1,3 @@
require './app'
run Sinatra::Application
@@ -0,0 +1,7 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
# Mark the database schema as having been generated.
db/schema.rb linguist-generated
# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
+33
View File
@@ -0,0 +1,33 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-*
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep
# Ignore master key for decrypting credentials and more.
/config/master.key
@@ -0,0 +1 @@
3.1.2
+43
View File
@@ -0,0 +1,43 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.2"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4", ">= 7.0.4.3"
# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
# gem "jbuilder"
# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem "rack-cors"
group :development do
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end
+162
View File
@@ -0,0 +1,162 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.4.3)
actionpack (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.4.3)
actionview (= 7.0.4.3)
activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.4.3)
actionpack (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.4.3)
activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.3.6)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activestorage (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activesupport (= 7.0.4.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
bootsnap (1.16.0)
msgpack (~> 1.2)
builder (3.2.4)
concurrent-ruby (1.2.2)
crass (1.0.6)
date (3.3.3)
erubi (1.12.0)
globalid (1.1.0)
activesupport (>= 5.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
loofah (2.19.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
minitest (5.18.0)
msgpack (1.6.1)
net-imap (0.3.4)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.14.2-arm64-darwin)
racc (~> 1.4)
puma (5.6.5)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.4)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.4.3)
actioncable (= 7.0.4.3)
actionmailbox (= 7.0.4.3)
actionmailer (= 7.0.4.3)
actionpack (= 7.0.4.3)
actiontext (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activemodel (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
bundler (>= 1.15.0)
railties (= 7.0.4.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
railties (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6)
sqlite3 (1.6.1-arm64-darwin)
thor (1.2.1)
timeout (0.3.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.7)
PLATFORMS
arm64-darwin-21
DEPENDENCIES
bootsnap
puma (~> 5.0)
rails (~> 7.0.4, >= 7.0.4.3)
sqlite3 (~> 1.4)
tzinfo-data
RUBY VERSION
ruby 3.1.2
BUNDLED WITH
2.4.2
+1
View File
@@ -0,0 +1 @@
web: rake db:migrate && bundle exec bin/rails server -b 0.0.0.0 -p ${PORT:-3000}
+24
View File
@@ -0,0 +1,24 @@
# README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
+6
View File
@@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative "config/application"
Rails.application.load_tasks
@@ -0,0 +1,4 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
@@ -0,0 +1,4 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
@@ -0,0 +1,2 @@
class ApplicationController < ActionController::API
end
@@ -0,0 +1,6 @@
class WelcomeController < ApplicationController
def index
message = "Hello from Rails"
render plain: message, content_type: "text/plain"
end
end
@@ -0,0 +1,7 @@
class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
@@ -0,0 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: "[email protected]"
layout "mailer"
end
@@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
</body>
</html>
@@ -0,0 +1 @@
<%= yield %>
+6
View File
@@ -0,0 +1,6 @@
# This file is used by Rack-based servers to start the application.
require_relative "config/environment"
run Rails.application
Rails.application.load_server
@@ -0,0 +1,27 @@
require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module RubyRailsApiApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
# Only loads a smaller set of middleware suitable for API only apps.
# Middleware like session, flash, cookies can be added back manually.
# Skip views, helpers and assets when generating a new resource.
config.api_only = true
end
end
@@ -0,0 +1,4 @@
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
@@ -0,0 +1,10 @@
development:
adapter: async
test:
adapter: test
production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: RubyRailsApiApp_production
@@ -0,0 +1 @@
m9sZ/Vtf3IYImgDhC3q4J14k+2EYvwOHkMeDiqaU41uZll8478RQPCzqf3ioRC6fXmCsHambTOg29L38QO+hkCR1r1MIcCP05CbMHXJwkllzabXgo/XnMUdwI4JIx6y05DJuV/teCqT9NdqW87ch3WcNddQDsdF+q4cMVPPcI1hF8gns+k9ny866W1PCwo0RfcIqsGZxNPp8PcLDKKYDWaY5bVK6DHRb5L/7uhcpKTafI0EXWj2pgWnKz8Tn5y5cbiOpyCkLeZVMBZIZk3L7ah5HJ3nQT8WGDagQCha0KbpUAb28KsxrrKhT4A/vZY2CL1xwAi/wf/Z3HLMl6zwcWoE+tfPoBJ07098n0Nqbt9Rfj2yefBKfoYog7ulC9k5jUS5UiG0UdqaOxj1XZ3eb57Bq5FXXlChpRnzy--b5io7kYvRimQBR4F--HPhHrDSWlQwB2DWEwde2Eg==
@@ -0,0 +1,25 @@
# SQLite. Versions 3.8.0 and up are supported.
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem "sqlite3"
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
@@ -0,0 +1,5 @@
# Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
@@ -0,0 +1,65 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable server timing
config.server_timing = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp/caching-dev.txt").exist?
config.cache_store = :memory_store
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
end
@@ -0,0 +1,86 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = "wss://example.com/cable"
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "RubyRailsApiApp_production"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Don't log any deprecations.
config.active_support.report_deprecations = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
@@ -0,0 +1,60 @@
require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Turn false under Spring and add config.action_view.cache_template_loading = true.
config.cache_classes = true
# Eager loading loads your whole application. When running a single test locally,
# this probably isn't necessary. It's a good idea to do in a continuous integration
# system, or in some way before deploying your code.
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
end
@@ -0,0 +1,4 @@
Rails.application.config.after_initialize do
Rails.logger.info "hello from rails"
puts "Hello from Rails" # This will show in the console/terminal
end
@@ -0,0 +1,16 @@
# Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
# allow do
# origins "example.com"
#
# resource "*",
# headers: :any,
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
# end
# end
@@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]
@@ -0,0 +1,16 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, "\\1en"
# inflect.singular /^(ox)en/i, "\\1"
# inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym "RESTful"
# end
@@ -0,0 +1,33 @@
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t "hello"
#
# In views, this is aliased to just `t`:
#
# <%= t("hello") %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# "true": "foo"
#
# To learn more, please read the Rails Internationalization guide
# available at https://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
@@ -0,0 +1,43 @@
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!
# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
@@ -0,0 +1,3 @@
Rails.application.routes.draw do
root "welcome#index"
end
@@ -0,0 +1,34 @@
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket-<%= Rails.env %>
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket-<%= Rails.env %>
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name-<%= Rails.env %>
# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]
+7
View File
@@ -0,0 +1,7 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
# Character.create(name: "Luke", movie: movies.first)
@@ -0,0 +1 @@
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
+5
View File
@@ -0,0 +1,5 @@
[
{
"justBuild": true
}
]
View File
@@ -0,0 +1,7 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
# Mark the database schema as having been generated.
db/schema.rb linguist-generated
# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
+31
View File
@@ -0,0 +1,31 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep
/public/assets
# Ignore master key for decrypting credentials and more.
/config/master.key
@@ -0,0 +1 @@
3.2.1
+77
View File
@@ -0,0 +1,77 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.2.1"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.3", ">= 7.0.3.1"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
# Use Redis adapter to run Action Cable in production
gem "redis", "~> 4.0"
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
# Use Sass to process CSS
# gem "sassc-rails"
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
gem "image_processing", "~> 1.2"
# Ensure the native dependencies for these install properly
gem "mysql2"
gem "charlock_holmes"
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
# Pinned to 1.7.0 to workaround https://github.com/ruby/debug/issues/898
gem "debug", "1.7.0", platforms: %i[ mri mingw x64_mingw ]
end
group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
# gem "rack-mini-profiler"
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end
group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
gem "webdrivers"
end
+249
View File
@@ -0,0 +1,249 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.4.3)
actionpack (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.4.3)
actionview (= 7.0.4.3)
activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.4.3)
actionpack (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.4.3)
activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.3.6)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activestorage (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activesupport (= 7.0.4.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
builder (3.2.4)
capybara (3.38.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
charlock_holmes (0.7.7)
concurrent-ruby (1.2.2)
crass (1.0.6)
date (3.3.3)
debug (1.7.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
erubi (1.12.0)
ffi (1.15.5)
globalid (1.1.0)
activesupport (>= 5.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
importmap-rails (1.1.5)
actionpack (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.6.0)
irb (1.6.3)
reline (>= 0.3.0)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
loofah (2.19.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
mini_magick (4.12.0)
mini_mime (1.1.2)
minitest (5.18.0)
msgpack (1.6.1)
mysql2 (0.5.5)
net-imap (0.3.4)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.14.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.2-x86_64-linux)
racc (~> 1.4)
pg (1.4.6)
public_suffix (5.0.1)
puma (5.6.5)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.4)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.4.3)
actioncable (= 7.0.4.3)
actionmailbox (= 7.0.4.3)
actionmailer (= 7.0.4.3)
actionpack (= 7.0.4.3)
actiontext (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activemodel (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
bundler (>= 1.15.0)
railties (= 7.0.4.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
railties (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6)
redis (4.8.1)
regexp_parser (2.7.0)
reline (0.3.2)
io-console (~> 0.5)
rexml (3.2.5)
ruby-vips (2.1.4)
ffi (~> 1.12)
rubyzip (2.3.2)
selenium-webdriver (4.8.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stimulus-rails (1.2.1)
railties (>= 6.0.0)
thor (1.2.1)
timeout (0.3.2)
turbo-rails (1.4.0)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
web-console (4.2.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (5.2.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
websocket (1.2.9)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.7)
PLATFORMS
arm64-darwin-21
x86_64-linux
DEPENDENCIES
bootsnap
capybara
charlock_holmes
debug (= 1.7.0)
image_processing (~> 1.2)
importmap-rails
jbuilder
mysql2
pg (~> 1.1)
puma (~> 5.0)
rails (~> 7.0.3, >= 7.0.3.1)
redis (~> 4.0)
selenium-webdriver
sprockets-rails
stimulus-rails
turbo-rails
tzinfo-data
web-console
webdrivers
RUBY VERSION
ruby 3.2.1p31
BUNDLED WITH
2.4.9
+1
View File
@@ -0,0 +1 @@
web: rake db:migrate && bundle exec bin/rails server -b 0.0.0.0 -p ${PORT:-3000}
+34
View File
@@ -0,0 +1,34 @@
---
title: Rails Starter
description: A Rails starter app using a PostgreSQL database
tags:
- ruby
- rails
- postgresql
---
# Rails Starter Example
This is a [Ruby on Rails](https://rubyonrails.org/) starter app that connects to a Railway Postgres database and supports [Action Cable](https://guides.rubyonrails.org/action_cable_overview.html).
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/sibk1f)
## ✨ Features
- Ruby
- Rails
- Postgres
- Redis
## 💁‍♀️ How to use
- [Create a Railway project with the Postgres plugin](https://railway.app/project?plugins=postgresql)
- Connect to your Railway project with `railway link`
- Install Ruby requirements `bundle install`
- Migrate the database `railway run rake db:migrate`
- Run Rails `railway run bin/rails server`
## 📝 Notes
This app was generated with the `rails new` command. Read more about Rails on
their [official website](https://rubyonrails.org/)
+6
View File
@@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative "config/application"
Rails.application.load_tasks
@@ -0,0 +1,4 @@
//= link_tree ../images
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
@@ -0,0 +1,15 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/

Some files were not shown because too many files have changed in this diff Show More