Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

# Ignore bundler config.
/.bundle
/vendor/bundle
/vendor/bundle/*
.env

# Ignore the default SQLite database.
/db/*.sqlite3
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.7.6
ruby-3.0.0
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Make sure it matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.0.0
FROM ruby:$RUBY_VERSION

# Install libvips for Active Storage preview support
RUN apt-get update -qq && \
apt-get install -y build-essential libvips vim && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man

# Rails app lives here
WORKDIR /rails

# Set production environment
ENV RAILS_LOG_TO_STDOUT="1" \
RAILS_SERVE_STATIC_FILES="true" \
RAILS_ENV="production" \
BUNDLE_WITHOUT="development"

# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install

# Copy application code
COPY . .

# Precompile bootsnap code for faster boot times

RUN bundle exec bootsnap precompile --gemfile app/ lib/
RUN bundle config set force_ruby_platform true
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN bundle exec rails assets:precompile

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
source "https://rubygems.org"
#source "https://gems.data.ruby.ci"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "2.7.6"
ruby "3.0.0"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

gem "administrate"

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"

Expand Down
40 changes: 38 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ GEM
tzinfo (~> 2.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
administrate (0.18.0)
actionpack (>= 5.0)
actionview (>= 5.0)
activerecord (>= 5.0)
jquery-rails (>= 4.0)
kaminari (>= 1.0)
sassc-rails (~> 2.1)
selectize-rails (~> 0.6)
bindex (0.8.1)
bootsnap (1.14.0)
msgpack (~> 1.2)
Expand All @@ -90,6 +98,7 @@ GEM
reline (>= 0.3.1)
diff-lcs (1.5.0)
erubi (1.11.0)
ffi (1.15.5)
globalid (1.0.0)
activesupport (>= 5.0)
i18n (1.12.0)
Expand All @@ -103,6 +112,22 @@ GEM
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jquery-rails (4.5.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
kaminari-activerecord (= 1.2.2)
kaminari-core (= 1.2.2)
kaminari-actionview (1.2.2)
actionview
kaminari-core (= 1.2.2)
kaminari-activerecord (1.2.2)
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
loofah (2.19.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
Expand Down Expand Up @@ -186,6 +211,15 @@ GEM
rspec-support (~> 3.11)
rspec-support (3.12.0)
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
selectize-rails (0.12.6)
selenium-webdriver (4.6.1)
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5)
Expand All @@ -208,6 +242,7 @@ GEM
stimulus-rails (1.1.1)
railties (>= 6.0.0)
thor (1.2.1)
tilt (2.0.11)
timeout (0.3.0)
turbo-rails (1.3.2)
actionpack (>= 6.0.0)
Expand Down Expand Up @@ -236,6 +271,7 @@ PLATFORMS
ruby

DEPENDENCIES
administrate
bootsnap
capybara
debug
Expand All @@ -256,7 +292,7 @@ DEPENDENCIES
webdrivers

RUBY VERSION
ruby 2.7.6p219
ruby 3.0.0p0

BUNDLED WITH
2.1.4
2.2.3
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Things you may want to cover:
* Deployment instructions

* ...

7 changes: 7 additions & 0 deletions app/controllers/health_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class HealthController < ApplicationController
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reek IrresponsibleModule has no descriptive comment
see on ruby.ci

rescue_from(Exception) { render head: 503 }

def show
render head: 200
end
end
1 change: 1 addition & 0 deletions app/controllers/items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ItemsController < ApplicationController
# GET /items or /items.json
def index
@items = Item.all
@items = Item.all
end

# GET /items/1 or /items/1.json
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/health_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module HealthHelper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reek IrresponsibleModule has no descriptive comment
see on ruby.ci

end
2 changes: 2 additions & 0 deletions app/views/health/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Health#show</h1>
<p>Find me in app/views/health/show.html.erb</p>
8 changes: 8 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# If running the rails server then create or migrate existing database
if [ "${*}" == "./bin/rails server" ]; then
./bin/rails db:prepare
fi

exec "${@}"
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
qhV4QM5XHhfopSMHPQOnCbd6aOnQOF6+/kNB0arsN9G0B7PLlEwRHJRglfEsKZxvzzv0KEhJLtm2Ei6GYSmdx72hg6aCeNMKI8SrkpBLLQ7kdqj/05kTkSlYw1WeoWuIlxRXiOUywStOrL0QGNla/xRYsSpk1RS/+o6457Rd8yPUdWOC5ORjUhYWm5SgDii3vV7Z2Y9pOhtNsF/CZj5vu8wpfm/SI223gDryZ9ZE6X1DGDfBnJ1uVDsScqQlubz9ZRYmAXmqLySgDpIWE/jU4xBPKHZJ1Gh1ZKrX3icw1brgOLsgquYf9842sw3wP59upXrG7f82xXDhrU37+xvs1zvGkyJExGSi1n9d+lhc1ATQFqipb3CnU3mnH1L4Krr7iEQu/0Au6MTw5UONZ7wlOtRjqjkLHOILLjK5--+U1aMORLTomguj1a--FDN7kbBv3sr911kx6mQFSA==
Sfe68WvrD7utpNrlblSMy5Y3GZIhAlSjliVRMGqRcy5etWRIN5jh15KB2Bj/t+wu7qqdGTbms3ivhWQqE0ssJWpqA7vVAx57DrLLtqCIXYxQnNFd0JADhHZPeDRa2h2Cnj7qcwMzkTe+NdJZH0RHg4Vb76y6CaJmxJ3YXlitpfp0Z3BzdlPfv26dfsoH6ZfKQ68/QD+oRrm4cQnBKO+j+eMDSbqIgq+ib9gaYv2uCqenrEF69yt3DZaBQvjbAkd1JTKiyD5H0Y4t5CpQ92hQ/rTa4zym9GshfExOygHRDYvi68wIZifYc55gkV10R8KG8gvwGZ2MAzlceeRWGD7D9bwALX0QLQhF4ao5a7Qbwn9mTcCbo/JRyXTbk9YgsJoyfWz/kYnduwlK6EGlS5UfJneJRX+monmy7cQb--JwxEUFZ2PggAQa41--1p6beAXEHbxqKhHzu3FxDA==
17 changes: 17 additions & 0 deletions config/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
service: basicapp
image: kolosek/basicapp
servers:
- 5.161.63.224
registry:
username: kolosek
password:
- MRSK_REGISTRY_PASSWORD
env:
secret:
- RAILS_MASTER_KEY
builder:
multiarch: false
traefik:
host_port: 81
labels:
traefik.http.routers.basicapp.rule: Host(\'basic.kolosek.me\'')
3 changes: 2 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
# 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
#config.force_ssl = true
config.assume_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).
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Rails.application.routes.draw do
get 'health/show'
resources :items
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

# Defines the root path route ("/")
# root "articles#index"
get '/up', to: 'health#show'
end