Skip to content

Suggested maintenance of readme and template #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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: 1 addition & 2 deletions rails-template.rb
Copy link
Contributor

Choose a reason for hiding this comment

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

postgres post should also be 54313

Copy link
Contributor

Choose a reason for hiding this comment

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

This line should also be removed config.assets.paths << Rails.root.join("node_modules")

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use solar graph anymore...

  plugins:
    - solargraph-standardrb
  reporters:
    - standardrb
YML```

Copy link
Contributor

Choose a reason for hiding this comment

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

file ".env", <<~ENV
REDIS_URL=redis://127.0.0.1:6379

ease development with this puma settings

WEB_CONCURRENCY=0
PUMA_WORKER_TIMEOUT=6000
RAILS_MAX_THREADS=20
ENV

we don't user .env files for projects.

Copy link
Contributor

Choose a reason for hiding this comment

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

file ".prettierrc", <<~JS
{
"singleQuote": true,
"trailingComma": "es5"
}
JS

this should be updated to use the default prettier which is double quotes. (remove the single quote)

Copy link
Contributor

Choose a reason for hiding this comment

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

file "Procfile.dev", <<~PROC
web: bundle exec rails s -p ${PORT:-3000} -b 0.0.0.0
worker: DB_POOL=3 bundle exec sidekiq
js: yarn build --watch
livereload: yarn live
PROC

live reload doesn't work on our projects. It should be removed. (add the configuration for vite at a later point.

Copy link
Contributor

Choose a reason for hiding this comment

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

file "package.json", <<~JS
{
"scripts": {
"format": "prettier --write \"src//*.{tsx,ts,scss,json}\"",
"lint": "yarn lint:types && yarn lint:style && yarn lint:format",
"lint:types": "tsc --noEmit",
"lint:style": "eslint app/javascript/
/.ts --max-warnings 0",
"lint:format": "prettier --list-different \"app/**/
.{ts,scss,json}\"",
"build": "esbuild app/javascript/. --bundle --sourcemap --outdir=app/assets/builds",
"bundle-size": "npx source-map-explorer app/assets/builds/application.js app/assets/builds/application.js.map --no-border-checks",
"start": "yarn build --watch",
"live": "yarn livereload -e scss app/assets"
},
"license": "MIT"
}
JS

remove livereload as it doesnt' work.

Copy link
Contributor

Choose a reason for hiding this comment

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

All the javascript files should use double quotes

Copy link
Contributor

Choose a reason for hiding this comment

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

file ".github/workflows/ci.yml", <<~YML
name: CI
on: [push]
jobs:
ruby:
runs-on: ubuntu-20.04

  Update this to 22.04

Copy link
Contributor

Choose a reason for hiding this comment

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

file "spec/support/system/cuprite_setup.rb", <<~RUBY

frozen_string_literal: true

require "capybara/cuprite"

Then, we need to register our driver to be able to use it later

with #driven_by method.

Capybara.register_driver(:cuprite) do |app|
Capybara::Cuprite::Driver.new(
app,
**{
window_size: [1200, 1400],
# See additional options for Dockerized environment in the respective section of this article
browser_options: {},
# Increase Chrome startup wait time (required for stable CI builds)
process_timeout: 10,
# Enable debugging capabilities
inspector: true,
# Allow running Chrome in a headful mode by setting HEADLESS env
# var to a falsey value
headless: Config.headless?
}
)
end

Config.headless?(default: true)

Copy link
Contributor

Choose a reason for hiding this comment

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

run "yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-prettier eslint-plugin-prettier prettier livereload"

remove live reload

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ruby File.read(".ruby-version").strip

# Core
gem "rails", "7.0.3"
gem "rails", "7.1.2"
gem "puma"

# Database
Expand Down Expand Up @@ -61,7 +61,6 @@
gem "rb-fsevent"
gem "letter_opener"
gem "debug"
gem "pry-rails"
gem "guard"
gem "guard-rspec"
gem "solargraph-standardrb"
Copy link
Contributor

Choose a reason for hiding this comment

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

we also dropped solar graph.

Expand Down
70 changes: 53 additions & 17 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This project contains all dependencies and services required by other nerdgescho

### Auto-Start Mode

To have the environment start automatically when _Docker_ start, execute the following command once.
To have the environment start automatically when _Docker_ starts, execute the following command once.
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't use docker-compose on most projects at the moment.

Copy link
Author

Choose a reason for hiding this comment

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

that is why I removed it in lines 92-97. As of Docker Compose V2 it uses the syntax below in line 11

Copy link

@danieldiekmeier danieldiekmeier Nov 28, 2023

Choose a reason for hiding this comment

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

We don't use Docker Compose directly in the projects, but (at least for me) the development environment (Postgres, MySQL, Redis, Elasticsearch, etc) is running via Docker Compose the whole time. I assumed that's what these lines are referencing.


docker compose up -d

Expand All @@ -22,9 +22,13 @@ Here we will go over how to setup rails for the first time on your machine.

We will mostly follow Rails [Getting Started Guide](https://guides.rubyonrails.org/getting_started.html) with some changes.

## rbenv
## Manage versions of languages and runtime environment

First thing we need is a version manager for Ruby. We use rbenv at nerdgeschoss.
You can use `asdf` to manage multiple tools. Check out the [guide](https://asdf-vm.com/guide/getting-started.html) for more, or use distinct managers as described below.

### rbenv

`rbenv` is a version manager for Ruby.

brew install rbenv

Expand All @@ -34,6 +38,10 @@ You can check your ruby version by typing this in your project folder:

If a version is not installed, you can add it by `rbenv install x.x.x`.

### node

Make sure you have node installed. Use volta as your version manager, follow the steps as decribed in the [docs](https://docs.volta.sh/guide/).

## Rails

Now let’s install Rails.
Expand All @@ -54,6 +62,10 @@ Then you will need to run this to install the ruby dependencies.

bundle install

Or for short just
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to include the short hand in our docs. 🤔

Copy link
Author

Choose a reason for hiding this comment

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

I can remove it. I felt it does not hurt to go a bit into detail though.


bundle

### MySQL Troubleshooting

During the bundle install you may face an error with mysql, in that case just follow the instructions on the error.
Expand Down Expand Up @@ -89,12 +101,6 @@ If `bundle install` fails for the GEM `pg`, install `postgresql`:

brew install postgresql
Copy link
Contributor

Choose a reason for hiding this comment

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

this will not work on the projects that need postgres 15.

Copy link
Author

Choose a reason for hiding this comment

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

that line has not changed. What change would you suggest?


## docker-compose

Now to setup we development environment we use `docker-compose`.

docker-compose up

## yarn

Now to install the Javascript dependencies we use `yarn`.
Expand All @@ -111,6 +117,12 @@ To resolve dependencies of a project:

Now let’s setup up the database.

For most projects there should be a setup script available.

bin/setup

If that does not work, follow these steps:

First we create the database.

rails db:create
Expand All @@ -125,14 +137,44 @@ Then we will seed our database with fake data for testing.

If you are interested in finding out what is going on behind the scenes (because it’s doing a lot and you will feel like the process just hanged) you can use `tail log/development.log` to hook into and view the log file.

## Rails Server
## Start the application

Now that we have everything setup, we can start by running

bin/dev

This sets up everything you need such as a rails server, a background worker and a second server for the frontend if needed.
You can connect to the a session in a new terminal tab with

Now that we have everything setup we can finally start the server.
overmind c web

for the server, and

overmind c worker

for the background worker.

In the background there are these processes running:

### Rails Server

This is how to manually start the server.

rails s

The default app port is `3000`, so if you navigate to [localhost:3000](https://localhost:3000) you should see a page (depending on the project).

### Sidekiq

We use sidekiq for background jobs. If you start the server manually use a new terminal tab to run:

sidekiq

### frontend

Please refer to the readme of the specific project for information.
In most cases the default port for the frontend will be `8080` ([localhost:8080](https://localhost:8080)).

## guard

With the above setup we will see our code changes when we refresh the page, but to make our development life easier we will also do the following.
Expand All @@ -141,12 +183,6 @@ Run `guard` to watch for changed files, reload our website on change and re-run

guard

Run a `webpack` dev server to make our javascript updates faster.

bin/webpack-dev-server

With that in place you can start developing.

# Feature Specific Installations:

## imagemagick
Expand Down