Skip to content

Commit

Permalink
Deploy on heroku (#521)
Browse files Browse the repository at this point in the history
* switch to ruby 2.7.0

* deploy on heroku
  • Loading branch information
gaev-art authored Jan 24, 2022
1 parent 41a3ae8 commit aa8e393
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.6.6
ruby-2.7.0
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.6'
ruby '2.7.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1'
Expand Down Expand Up @@ -50,6 +50,7 @@ gem 'omniauth-github'

gem 'strong_migrations', '~> 0.7.8'

gem 'rake'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'rubocop', '~> 1.6.1', require: false
Expand Down
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ DEPENDENCIES
rails-assets-bulma!
rails-controller-testing
rails-erd
rake
react-rails
redis (~> 4.2)
rspec-rails (~> 4.0.1)
Expand All @@ -517,7 +518,7 @@ DEPENDENCIES
webpacker (~> 5)

RUBY VERSION
ruby 2.6.6p146
ruby 2.7.0p0

BUNDLED WITH
2.2.25
2.3.5
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
backend: bin/rails server
frontend: bin/webpack-dev-server
web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-production}
worker: bundle exec sidekiq
2 changes: 2 additions & 0 deletions Procfile.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
backend: bin/rails server
frontend: bin/webpack-dev-server
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Ruby](https://img.shields.io/badge/Ruby-2.7.0-brightgreen.svg?style=flat-square)](https://www.ruby-lang.org/)
[![React](https://img.shields.io/badge/React-16.12.0-blue.svg?style=flat-square)](https://reactjs.org/)

# Retrospective

## Development instructions
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class ApplicationController < ActionController::Base
before_action :set_raven_context
# before_action :developer, unless: :user_signed_in?
before_action :store_user_location!, if: :storable_location?
before_action :authenticate_user!, except: %i[sign_in sign_up]
authorize :user, through: :current_or_guest_user
Expand All @@ -11,6 +12,11 @@ class ApplicationController < ActionController::Base
redirect_to root_path, alert: ex.result.message
end

# def developer
# @user = User.first
# sign_in_and_redirect @user, event: :authentication
# end

private

def set_raven_context
Expand Down
1 change: 0 additions & 1 deletion app/javascript/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {UserMenu} from './user-menu/user-menu';

export const App = () => {
const history = useNavigate();

return (
<div>
<div className={style.header}>
Expand Down
14 changes: 8 additions & 6 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ import {render} from 'react-dom';
import {App} from '../components/app';
import {BrowserRouter} from 'react-router-dom';

render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.querySelector('#root')
);
document.addEventListener('DOMContentLoaded', () => {
render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.querySelector('#root')
);
});
11 changes: 5 additions & 6 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@

<% if user_signed_in? %>
<%- if user_signed_in? %>
<p> <%= link_to 'Logout', destroy_user_session_path, method: :delete %></p>
<div id='root'></div>
<% else %>
<% if ENV.fetch('SKIP_ALFRED', false) == 'true' %>
<%- else %>
<%- if ENV.fetch('SKIP_ALFRED', false) == 'true' %>
<%= link_to 'Sign in as Developer', user_developer_omniauth_callback_path %>
<%= '|' if providers.any? %>
<% end %>

<% providers.each do |provider| %>
<%- providers.each do |provider| %>
<%= link_to "Sign in with #{provider.capitalize}", send("user_#{provider}_omniauth_authorize_path") %>
<%= '|' unless provider == providers.last %>
<% end %>
<% end %>

<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application' %>
17 changes: 14 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,33 @@
<%= csp_meta_tag %>
<%= action_cable_meta_tag %>
<%= stylesheet_pack_tag 'application' %>
<%= javascript_pack_tag 'application' if user_signed_in? %>
<%= javascript_include_tag 'application' %>
<%= javascript_include_tag('https://use.fontawesome.com/releases/v5.3.1/js/all.js') %>
<%= yield :scripts %>
</head>

<body>
<div class="columns">

<div class="column is-9">
<p id="notice"><%= notice %></p>
<p id="alert"><%= alert %></p>
<% if user_signed_in? %>
<p> <%= link_to 'Logout', destroy_user_session_path, method: :delete %></p>
<div id='root'></div>
<% else %>
<% if ENV.fetch('SKIP_ALFRED', false) == 'true' %>
<%= link_to 'Sign in as Developer', user_developer_omniauth_callback_path %>
<%= '|' if providers.any? %>
<% end %>

<%= yield %>
<% providers.each do |provider| %>
<%= link_to "Sign in with #{provider.capitalize}", send("user_#{provider}_omniauth_authorize_path") %>
<%= '|' unless provider == providers.last %>
<% end %>
<% end %>
</div>
</div>

</body>
</html>

Expand Down
24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
version: '3.7'
version: "3.7"

services:
app: &app
build:
context: .
dockerfile: ./.dockerdev/Dockerfile
args:
RUBY_VERSION: '2.6.6'
PG_MAJOR: '11'
NODE_MAJOR: '12'
YARN_VERSION: '1.19.1'
BUNDLER_VERSION: '2.2.25'
RUBY_VERSION: "2.7.0"
PG_MAJOR: "11"
NODE_MAJOR: "12"
YARN_VERSION: "1.19.1"
BUNDLER_VERSION: "2.2.25"
image: example-dev:1.0.0
tmpfs:
- /tmp
Expand Down Expand Up @@ -46,14 +46,14 @@ services:
<<: *backend
command: /bin/bash
ports:
- '3000:3000'
- '3002:3002'
- "3000:3000"
- "3002:3002"

rails:
<<: *backend
command: bundle exec rails server -b 0.0.0.0
ports:
- '3000:3000'
- "3000:3000"

postgres:
image: postgres:11.1
Expand All @@ -64,20 +64,20 @@ services:
environment:
- PSQL_HISTFILE=/root/log/.psql_history
ports:
- '5432:5432'
- "5432:5432"

redis:
image: redis:3.2-alpine
volumes:
- redis:/data
ports:
- '6379:6379'
- "6379:6379"

webpacker:
<<: *app
command: ./bin/webpack-dev-server
ports:
- '3035:3035'
- "3035:3035"
volumes:
- .:/app:cached
- ./node_modules:/app/node_modules
Expand Down

0 comments on commit aa8e393

Please sign in to comment.