https://github.com/andrijzyn/rubyor_postgresql_test
đģ Working clean RoR project
https://github.com/andrijzyn/rubyor_postgresql_test
postgresql rails ruby
Last synced: 2 months ago
JSON representation
đģ Working clean RoR project
- Host: GitHub
- URL: https://github.com/andrijzyn/rubyor_postgresql_test
- Owner: andrijzyn
- Created: 2024-11-15T00:30:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-06T16:00:43.000Z (over 1 year ago)
- Last Synced: 2025-03-03T00:24:54.828Z (over 1 year ago)
- Topics: postgresql, rails, ruby
- Language: HTML
- Homepage:
- Size: 111 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Setup and Configuration
### â ī¸ Important:
- **Do not install packages as `root`** - this may cause permissions problems in the IDE.
- **It is recommended to run `rails` from `~/bin`** to avoid possible conflicts.
---
### âšī¸ Notes:
- If you encounter the same problem when initialising the base project, please create **Issue**. I may have forgotten to specify some details.
- Separation of tasks by console:
- đŠ-**System console** (for example, a terminal outside the project).
- đĨ-**Project console** (terminal opened in the project root).
- đĒ-**Postgre console** (terminal opened by sudo -u postgres psql).
---
### đŠ đ Install dependencies:
1. Make sure you have **Node.js** and **npm** installed.
2. To install dependencies, run the command:
```bash
pnpm install @hotwired/turbo-rails @hotwired/stimulus
```
3. Install Ruby:
Install [rbenv](https://github.com/rbenv/rbenv)
Install [ruby-build](https://github.com/rbenv/ruby-build)
```bash
rbenv init
rbenv install 3.3.6
rbenv global 3.3.6
```
4. Install [Ruby on Rails](https://github.com/rails/rails)
---
### đŠ đ§ PostgreSQL Setup:
1. **Install PostgreSQL**:
For **Arch**:
```bash
sudo pacman -S postgresql
```
For **Debian**:
```bash
sudo apt install postgresql postgresql-contrib
```
For **macOS** using Homebrew:
```bash
brew install postgresql
```
2. Start the PostgreSQL service:
For **Debian**:
```bash
sudo systemctl enable postgresql
sudo service postgresql start
```
For **macOS** using Homebrew:
```bash
brew services start postgresql
```
---
### đą Database Setup
To set up the PostgreSQL database for the project, follow the steps below:
1. Create the Database
- đĨ Create a database using the command:
```bash
rails db:create
rails db:migrate
```
- đŠ Open the postgres console:
```bash
sudo -u postgres psql
```
- đĒ Create a new PostgreSQL user (if necessary):
It is better for {username} to use the vlast name on the system
```bash
CREATE ROLE {username} WITH LOGIN PASSWORD '{password}';
```
- đĒ Grant permissions to connect and use the database :
```bash
GRANT CONNECT ON DATABASE {database_name} TO {username};
GRANT USAGE ON SCHEMA public TO {username};
```
- đĒ Grant permissions to create and modify tables in the schema :
```bash
GRANT CREATE ON SCHEMA public TO {username};
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO {username};
```