diff --git a/rails-template.rb b/rails-template.rb index abf8d94..4e77a85 100644 --- a/rails-template.rb +++ b/rails-template.rb @@ -5,7 +5,7 @@ ruby File.read(".ruby-version").strip # Core - gem "rails", "7.0.3" + gem "rails", "7.1.2" gem "puma" # Database @@ -61,7 +61,6 @@ gem "rb-fsevent" gem "letter_opener" gem "debug" - gem "pry-rails" gem "guard" gem "guard-rspec" gem "solargraph-standardrb" diff --git a/readme.md b/readme.md index 765ccf9..2f854da 100644 --- a/readme.md +++ b/readme.md @@ -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. docker compose up -d @@ -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 @@ -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. @@ -54,6 +62,10 @@ Then you will need to run this to install the ruby dependencies. bundle install +Or for short just + + bundle + ### MySQL Troubleshooting During the bundle install you may face an error with mysql, in that case just follow the instructions on the error. @@ -89,12 +101,6 @@ If `bundle install` fails for the GEM `pg`, install `postgresql`: brew install postgresql -## 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`. @@ -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 @@ -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. @@ -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