Skip to content

Commit 9d8b155

Browse files
committed
remove version numbers
0 parents  commit 9d8b155

File tree

128 files changed

+2804
-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.

128 files changed

+2804
-0
lines changed

.github/workflows/deploy.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout Repo
17+
uses: actions/checkout@v4
18+
19+
- name: Deploy
20+
uses: DefangLabs/[email protected]

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Ruby on Rails
2+
3+
This template is a member list project developed using Ruby on Rails, offering a starting point to help you quickly build your team management system. We have prepared all the essential files for deployment. By spending less than 10 minutes setting up the environment, as detailed in the prerequisites, and executing the commands in our step-by-step guide, your website will be ready to go live to the world!
4+
5+
## NOTE
6+
7+
This sample showcases how you could deploy a full-stack application with Defang in Ruby on Rails. However, it uses a SQLite database, which isn't production-ready and will be reset with every deployment. For production use cases you should use a managed database like RDS, Aiven, or others. If you stick to Rail's default SQLite database, your stored data will be lost on every deployment, and in some other cases. In the future, Defang will help you provision and connect to managed databases.
8+
9+
## Essential Setup Files
10+
11+
1. A [Dockerfile](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) to describe the basic image of your applications.
12+
2. A [docker-compose file](https://docs.defang.io/docs/concepts/compose) to define and run multi-container Docker applications.
13+
3. A [.dockerignore](https://docs.docker.com/build/building/context/#dockerignore-files) file to comply with the size limit (10MB).
14+
15+
## Prerequisite
16+
17+
1. Download [Defang CLI](https://github.com/DefangLabs/defang)
18+
2. If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc), make sure you have properly [authenticated your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
19+
3. Plus, make sure that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
20+
21+
## Deployment
22+
23+
1. Open the terminal and type `defang login`
24+
2. Type `defang compose up` in the CLI
25+
3. Now your application will be launched
26+
27+
---
28+
29+
Title: Ruby on Rails
30+
31+
Short Description: A basic member list project developed using Ruby on Rails.
32+
33+
Tags: Ruby, Rails
34+
35+
Languages: Ruby

app/.dockerignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2+
3+
# Ignore git directory.
4+
/.git/
5+
6+
# Ignore bundler config.
7+
/.bundle
8+
9+
# Ignore all environment files (except templates).
10+
/.env*
11+
!/.env*.erb
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 assets.
34+
/node_modules/
35+
/app/assets/builds/*
36+
!/app/assets/builds/.keep
37+
/public/assets

app/.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

app/.gitignore

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

app/.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-3.0.0

app/Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4+
ARG RUBY_VERSION=3.3.0
5+
FROM ruby:$RUBY_VERSION-slim as base
6+
7+
# Rails app lives here
8+
WORKDIR /rails
9+
10+
# Set production environment
11+
ENV RAILS_ENV="production" \
12+
BUNDLE_DEPLOYMENT="1" \
13+
BUNDLE_PATH="/usr/local/bundle" \
14+
BUNDLE_WITHOUT="development"
15+
16+
# Throw-away build stage to reduce size of final image
17+
FROM base as build
18+
19+
# Install packages needed to build gems
20+
RUN apt-get update -qq && \
21+
apt-get install --no-install-recommends -y build-essential git libvips pkg-config
22+
23+
# Set bundler config to force ruby platform
24+
RUN bundle config set force_ruby_platform true
25+
26+
# Install application gems
27+
COPY Gemfile Gemfile.lock ./
28+
RUN bundle install && \
29+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
30+
bundle exec bootsnap precompile --gemfile
31+
32+
# Copy application code
33+
COPY . .
34+
35+
# Precompile bootsnap code for faster boot times
36+
RUN bundle exec bootsnap precompile app/ lib/
37+
38+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
39+
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
40+
41+
42+
# Final stage for app image
43+
FROM base
44+
45+
# Install packages needed for deployment
46+
RUN apt-get update -qq && \
47+
apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
48+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
49+
50+
# Copy built artifacts: gems, application
51+
COPY --from=build /usr/local/bundle /usr/local/bundle
52+
COPY --from=build /rails /rails
53+
54+
# Run and own only the runtime files as a non-root user for security
55+
RUN useradd rails --create-home --shell /bin/bash && \
56+
chown -R rails:rails db log storage tmp
57+
USER rails:rails
58+
59+
# Entrypoint prepares the database.
60+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
61+
62+
# Start the server by default, this can be overwritten at runtime
63+
EXPOSE 3000
64+
CMD ["./bin/rails", "server"]

app/Gemfile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
source "https://rubygems.org"
2+
3+
ruby "3.3.0"
4+
5+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
6+
gem "rails", "~> 7.1.3", ">= 7.1.3.2"
7+
8+
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
9+
gem "sprockets-rails"
10+
11+
# Use sqlite3 as the database for Active Record
12+
gem "sqlite3", "~> 1.4"
13+
14+
# Use the Puma web server [https://github.com/puma/puma]
15+
gem "puma", ">= 5.0"
16+
17+
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
18+
gem "importmap-rails"
19+
20+
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
21+
gem "turbo-rails"
22+
23+
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
24+
gem "stimulus-rails"
25+
26+
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
27+
gem "jbuilder"
28+
29+
# Use Redis adapter to run Action Cable in production
30+
# gem "redis", ">= 4.0.1"
31+
32+
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
33+
# gem "kredis"
34+
35+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
36+
# gem "bcrypt", "~> 3.1.7"
37+
38+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
39+
gem "tzinfo-data", platforms: %i[ mswin mswin64 mingw x64_mingw jruby ]
40+
41+
# Reduces boot times through caching; required in config/boot.rb
42+
gem "bootsnap", require: false
43+
44+
gem 'devise', '~> 4.9', '>= 4.9.4'
45+
46+
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
47+
# gem "image_processing", "~> 1.2"
48+
49+
group :development, :test do
50+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
51+
gem "debug", platforms: %i[ mri mswin mswin64 mingw x64_mingw ]
52+
end
53+
54+
group :development do
55+
# Use console on exceptions pages [https://github.com/rails/web-console]
56+
gem "web-console"
57+
58+
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
59+
# gem "rack-mini-profiler"
60+
61+
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
62+
# gem "spring"
63+
end
64+
65+
group :test do
66+
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
67+
gem "capybara"
68+
gem "selenium-webdriver"
69+
end

0 commit comments

Comments
 (0)