Skip to content

Commit 0fd3ac7

Browse files
committed
add mcp example
0 parents  commit 0fd3ac7

File tree

102 files changed

+3515
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3515
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
2+
ARG RUBY_VERSION=3.4.6
3+
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION

.devcontainer/compose.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "playground"
2+
3+
services:
4+
rails-app:
5+
build:
6+
context: ..
7+
dockerfile: .devcontainer/Dockerfile
8+
9+
volumes:
10+
- ../..:/workspaces:cached
11+
12+
# Overrides default command so things don't shut down after the process ends.
13+
command: sleep infinity
14+
15+
ports:
16+
- 3000:3000
17+
- 12345:12345
18+
19+
# Uncomment the next line to use a non-root user for all processes.
20+
# user: vscode
21+
22+
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
23+
# (Adding the "ports" property to this file will not forward from a Codespace.)
24+
depends_on:
25+
- postgres
26+
27+
postgres:
28+
image: postgres:16.1
29+
restart: unless-stopped
30+
networks:
31+
- default
32+
volumes:
33+
- postgres-data:/var/lib/postgresql/data
34+
environment:
35+
POSTGRES_USER: postgres
36+
POSTGRES_PASSWORD: postgres
37+
38+
volumes:
39+
postgres-data:

.devcontainer/devcontainer.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// For format details, see https://containers.dev/implementors/json_reference/.
2+
// For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3+
{
4+
"name": "playground",
5+
"dockerComposeFile": "compose.yaml",
6+
"service": "rails-app",
7+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
8+
9+
// Features to add to the dev container. More info: https://containers.dev/features.
10+
"features": {
11+
"ghcr.io/devcontainers/features/github-cli:1": {},
12+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
13+
"ghcr.io/rails/devcontainer/features/postgres-client": {}
14+
},
15+
16+
"containerEnv": {
17+
"KAMAL_REGISTRY_PASSWORD": "$KAMAL_REGISTRY_PASSWORD",
18+
"DB_HOST": "postgres"
19+
},
20+
21+
// Configure tool-specific properties.
22+
"customizations": {
23+
"vscode": {
24+
"extensions": [
25+
"Shopify.ruby-lsp",
26+
"shardulm94.trailing-spaces",
27+
"eamodio.gitlens",
28+
"KoichiSasada.vscode-rdbg"
29+
],
30+
"settings": {
31+
"[ruby]": {
32+
"editor.defaultFormatter": "Shopify.ruby-lsp",
33+
"editor.formatOnSave": false
34+
},
35+
"terminal.integrated.defaultProfile.linux": "bash",
36+
"remote.autoForwardPorts": false
37+
}
38+
}
39+
},
40+
41+
// Use 'postCreateCommand' to run commands after the container is created.
42+
"postCreateCommand": "bin/setup --skip-server"
43+
}

.dockerignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2+
3+
# Ignore git directory.
4+
/.git/
5+
/.gitignore
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all environment files.
11+
/.env*
12+
13+
# Ignore all default key files.
14+
/config/master.key
15+
/config/credentials/*.key
16+
17+
# Ignore all logfiles and tempfiles.
18+
/log/*
19+
/tmp/*
20+
!/log/.keep
21+
!/tmp/.keep
22+
23+
# Ignore pidfiles, but keep the directory.
24+
/tmp/pids/*
25+
!/tmp/pids/.keep
26+
27+
# Ignore storage (uploaded files in development and any SQLite databases).
28+
/storage/*
29+
!/storage/.keep
30+
/tmp/storage/*
31+
!/tmp/storage/.keep
32+
33+
# Ignore CI service files.
34+
/.github
35+
36+
# Ignore Kamal files.
37+
/config/deploy*.yml
38+
/.kamal
39+
40+
# Ignore development files
41+
/.devcontainer
42+
43+
# Ignore Docker-related files
44+
/.dockerignore
45+
/Dockerfile*

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2+
3+
# Mark the database schema as having been generated.
4+
db/schema.rb linguist-generated
5+
6+
# Mark any vendored files as having been vendored.
7+
vendor/* linguist-vendored
8+
config/credentials/*.yml.enc diff=rails_credentials
9+
config/credentials.yml.enc diff=rails_credentials

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: bundler
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: github-actions
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 10

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
scan_ruby:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v5
15+
16+
- name: Set up Ruby
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: .ruby-version
20+
bundler-cache: true
21+
22+
- name: Scan for common Rails security vulnerabilities using static analysis
23+
run: bin/brakeman --no-pager
24+
25+
lint:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v5
30+
31+
- name: Set up Ruby
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
ruby-version: .ruby-version
35+
bundler-cache: true
36+
37+
- name: Lint code for consistent style
38+
run: bin/rubocop -f github
39+
40+
test:
41+
runs-on: ubuntu-latest
42+
43+
services:
44+
postgres:
45+
image: postgres
46+
env:
47+
POSTGRES_USER: postgres
48+
POSTGRES_PASSWORD: postgres
49+
ports:
50+
- 5432:5432
51+
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
52+
53+
# redis:
54+
# image: redis
55+
# ports:
56+
# - 6379:6379
57+
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
58+
59+
steps:
60+
- name: Install packages
61+
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git libpq-dev libyaml-dev pkg-config
62+
63+
- name: Checkout code
64+
uses: actions/checkout@v5
65+
66+
- name: Set up Ruby
67+
uses: ruby/setup-ruby@v1
68+
with:
69+
ruby-version: .ruby-version
70+
bundler-cache: true
71+
72+
- name: Run tests
73+
env:
74+
RAILS_ENV: test
75+
DATABASE_URL: postgres://postgres:postgres@localhost:5432
76+
# REDIS_URL: redis://localhost:6379/0
77+
run: bin/rails db:test:prepare test

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# Temporary files generated by your text editor or operating system
4+
# belong in git's global ignore instead:
5+
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all environment files.
11+
/.env*
12+
13+
# Ignore all logfiles and tempfiles.
14+
/log/*
15+
/tmp/*
16+
!/log/.keep
17+
!/tmp/.keep
18+
19+
# Ignore pidfiles, but keep the directory.
20+
/tmp/pids/*
21+
!/tmp/pids/
22+
!/tmp/pids/.keep
23+
24+
# Ignore storage (uploaded files in development and any SQLite databases).
25+
/storage/*
26+
!/storage/.keep
27+
/tmp/storage/*
28+
!/tmp/storage/
29+
!/tmp/storage/.keep
30+
31+
# Ignore master key for decrypting credentials and more.
32+
/config/master.key

.kamal/hooks/docker-setup.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
echo "Docker set up on $KAMAL_HOSTS..."

.kamal/hooks/post-app-boot.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
echo "Booted app version $KAMAL_VERSION on $KAMAL_HOSTS..."

0 commit comments

Comments
 (0)