Skip to content
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

Update README.md #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
105 changes: 98 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,73 @@

1. Install Ruby `3.2.1`.
2. Create `.env` file in root folder of the project.
2. Install [PostgreSQL](https://www.postgresql.org/download/) `>=14.13`.
3. Add corresponded env vars to `.env` file with DB credentials. E.g.:
3. Install [PostgreSQL](https://www.postgresql.org/download/) `>=14.13`.
## For Ubuntu, Linux, and Debian
i. Install PostgreSQL:
'''
sudo apt update
Copy link
Collaborator

Choose a reason for hiding this comment

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

This works only on Debian-based Linux distributions like Ubuntu, Linux Mint, and Debian itself.
I suggest to either add other options (e.g. for Mac/Windows) or just point that this is only for Debian-based distributions.

sudo apt install postgresql-14
'''
ii. Create PostgreSQL user and set password:
'''
sudo -u postgres psql
'''
'''
CREATE USER healthkeeper WITH PASSWORD 'magic';
ALTER USER healthkeeper CREATEDB;
'''
IV. Quit postgres
'''
\q
'''

## For Windows:
i. Install PostgreSQL
'''
brew install postgresql@14
'''
ii. Start PostgreSQL service
'''
brew services start postgresql@14
'''
iii. Open PostgreSQL in terminal
'''
"C:\Program Files\PostgreSQL\14\bin\psql.exe" -U postgres
'''
IV. Create PostgreSQL user and set password:
'''
CREATE USER healthkeeper WITH PASSWORD 'magic';
ALTER USER healthkeeper CREATEDB;
'''
V. Quit postgres
'''
\q
'''

## For Mac:
i. Install PostgreSQL
'''
brew install postgresql@14
'''
ii. Start PostgreSQL service
'''
brew services start postgresql@14
'''
iii. Open PostgreSQL in terminal
'''
psql postgres
'''
IV. Create PostgreSQL user and set password:
'''
CREATE USER healthkeeper WITH PASSWORD 'magic';
ALTER USER healthkeeper CREATEDB;
'''
V. Quit postgres
'''
\q
'''

8. Add corresponded env variables to `.env` file with DB credentials. E.g.:
```
HEALTHKEEPER_DEVELOPMENT_DATABASE = "healthkeeper_development"
HEALTHKEEPER_DEVELOPMENT_DATABASE_USERNAME = "healthkeeper"
Expand All @@ -16,11 +81,37 @@ HEALTHKEEPER_TEST_DATABASE_USERNAME = "healthkeeper"
HEALTHKEEPER_TEST_DATABASE_PASSWORD = "magic"
```
4. Run `./bin/bundle install`
5. Run `rails db:setup`.
6. In order to recreate DB run `rails db:reset`.
7. In order to (re)populate DB with a testing data run `rails db:seed`.
8. To run Rails server use `./bin/dev` instead of `rails s`/`rails server` (see [next chapter](#bootstrap-and-tailwindCSS) if curious why).
6. Run `rails db:setup`.
7. In order to recreate DB run `rails db:reset`.
8. In order to (re)populate DB with a testing data run `rails db:seed`.
9. Run 'rails db:migrate'
10. To run Rails server use `./bin/dev` instead of `rails s`/`rails server` (see [next chapter](#bootstrap-and-tailwindCSS) if curious why).

# Troubleshooting
1. ActiveRecord::DatabaseConnectionError: There is an issue connecting to your database with your username/password, username: healthkeeper. (ActiveRecord::DatabaseConnectionError)
Edit the PostgreSQL authentication configuration:
'''
sudo nano /etc/postgresql/14/main/pg_hba.conf
'''
Make sure all content is all the same:
'''
# PostgreSQL Client Authentication Configuration File
# ===================================================

# TYPE DATABASE USER ADDRESS METHOD

# Database administrative login by Unix domain socket
local all postgres peer

# "local" is for Unix domain socket connections only
local all all md5

# IPv4 local connections:
host all all 127.0.0.1/32 md5

# IPv6 local connections:
host all all ::1/128 md5
'''
### Bootstrap and TailwindCSS
As we have both Bootstrap and TailwindCSS installed inside the project we need to split them somehow.
> Thus, to utilize TailwindCSS make sure that you use the classes with the prefix.
Expand Down Expand Up @@ -50,4 +141,4 @@ TODO
- [x] Authorization.
- [x] Role management.
- [x] Tune role policies.
5. [ ] Wrap an app in Docker.
5. [ ] Wrap an app in Docker.