-
Notifications
You must be signed in to change notification settings - Fork 1
Setup dotenv #420
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
base: main
Are you sure you want to change the base?
Setup dotenv #420
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,19 +20,17 @@ rails new [project-name] --database=postgresql --skip-kamal --skip-ci --skip-act | |
| where the `project-name` is exactly the one you chose before. | ||
|
|
||
| > ⚠️ You may want to choose a different database than Postgres, but most of the time this will be your choice.\ | ||
| > If you do not need a DB you may rethink the fact that you may not need Rails at all: Take a look at [Sinatra](http://www.sinatrarb.com/) or [Angular](https://angular.io/)\ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What a shitty suggestion. It is not the fact that you have a database or not that should make consider alternative frameworks. |
||
| > You might also need actionmailbox of course, so always double-check the parameters that you are using. | ||
|
|
||
| > ⭐️ This setup does not include either js-bundling nor css-bundling by default.\ | ||
| > It will start with the simplest possible Rails setup and will use sprockets and importmaps.\ | ||
| > If you need to do fancy stuff, discuss with your team the opportunity of including a js-bundling and css-bundling tool.\ | ||
| > We want to go ["no build"](https://www.youtube.com/watch?v=iqXjGiQ_D-A) whenever possible. | ||
|
|
||
| * Run `bin/setup` | ||
|
|
||
| * Run `bundle exec rails db:migrate` to generate an empty `schema.rb` file. | ||
| * Run `bin/setup` | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we first need to run db:migrate |
||
|
|
||
| * Then check your default Rails setup by running `rails s` and visiting http://localhost:3000. | ||
| * Then check your default Rails setup by running `bin/run` and visiting http://[project-name].localhost:3000. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's check bin/run and subdomain and start from the beginning with a good habit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not add all the commands to the I think now if you create a new Rails application and run |
||
| You should be on Rails now, yay! | ||
| * Finally check if http://localhost:3000/up is green. | ||
|
|
||
|
|
@@ -61,36 +59,6 @@ Some other adjustments must be performed manually. | |
|
|
||
| > ⭐️bin/check, bin/fastcheck and bin/run are standardized tools for more convenience at Renuo. | ||
|
|
||
| ### Manual adjustments | ||
|
|
||
| Please perform these adjustments manually: | ||
|
|
||
| #### ENV variables | ||
|
|
||
| * Add `dotenv-rails` to Gemfile. Check the [gem homepage](https://github.com/bkeepers/dotenv) to see how to install the gem. | ||
| * and create `.env.example` in the root folder of the project where you will specify the only environment variable you need for now: | ||
| `SECRET_KEY_BASE`. | ||
| * Going forward we will only push the `.env.example` file to the repository in order to protect our env variables. | ||
| * Add .env to .gitignore | ||
| * Add the following section to your `bin/setup` script so that the `.env` is created from the `.env` when the project is setup locally: | ||
|
|
||
| ```ruby | ||
| puts "\n== Copying sample files ==" | ||
| unless File.exist?('.env') | ||
| system! 'cp .env.example .env' | ||
| end | ||
| ``` | ||
|
|
||
| * add one more key to .env.example `APP_PORT=3000` | ||
| * To ensure you have all the required keys from the `.env.example` in your `.env`, | ||
| create the initializer for dotenv-rails in `config/initializers/dotenv_rails.rb`: | ||
|
|
||
| ```ruby | ||
| Dotenv.require_keys(Dotenv.parse(".env.example").keys) | ||
| ``` | ||
|
|
||
| * Run `bin/setup` again. | ||
|
|
||
| ### Secrets | ||
|
|
||
| We store the secrets necessary to configure the project locally in a 1password Item. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could be more explicit with this line that the customer opinion / need is not to be disregarded? I know it's implied from the whole paragraph, but I guess it could be interpreted as such