-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup for docker-compose, update bundles for security reason * Update bundles * Update bundles: rack --------- Co-authored-by: Yaroslav Yenkala <[email protected]>
- Loading branch information
1 parent
5f2d399
commit 459dd3e
Showing
6 changed files
with
156 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POSTGRES_HOST=localhost | ||
POSTGRES_PORT=5432 | ||
DB_USERNAME=postgres | ||
DB_PASSWORD=postgres | ||
REDIS_PORT=6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ POSTGRES_HOST=localhost | |
POSTGRES_PORT=5432 | ||
DB_USERNAME=postgres | ||
DB_PASSWORD=postgres | ||
REDIS_PORT=6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,33 +9,67 @@ | |
|
||
```zsh | ||
[email protected]:yaroslavrick/car_advertisements_web.git | ||
cd car_advertisements_web | ||
``` | ||
|
||
#### 2. Copy the .env.example file. | ||
#### 2. Move into the project directory: | ||
|
||
```zsh | ||
cp .env.example .env | ||
```bash | ||
cd car_advertisements_web | ||
``` | ||
|
||
#### 3. Install dependencies | ||
|
||
```zsh | ||
bundle | ||
bundle install | ||
``` | ||
|
||
#### 4. Create and setup the database | ||
#### 4. Copy the .env.example file. | ||
|
||
```zsh | ||
rails db:create && rails db:migrate && rails db:seed | ||
cp .env.example .env.development | ||
``` | ||
|
||
#### 5. Start the app | ||
#### 5. Setup Docker services (PostgreSQL and Redis): | ||
|
||
```zsh | ||
rails s | ||
docker-compose up | ||
``` | ||
|
||
Ensure that the ports configured in `.env` do not conflict with your running services. | ||
|
||
|
||
#### 6. Create the database: | ||
|
||
```bash | ||
bundle exec rails db:create | ||
``` | ||
|
||
#### 7. Run database migrations: | ||
|
||
```bash | ||
bundle exec rails db:migrate | ||
``` | ||
|
||
#### 8. (Optional) Run seed data to create some sample data: | ||
|
||
```bash | ||
bundle exec rails db:seed | ||
``` | ||
|
||
## Usage | ||
|
||
To start the app, run the following command: | ||
|
||
```bash | ||
bundle exec rails server | ||
``` | ||
|
||
Visit the app at localhost: http://localhost:3000 | ||
Once the server is running, open your web browser and go to http://localhost:3000 to access the app. | ||
|
||
## Testing | ||
|
||
To run the test suite, use the following command: | ||
|
||
Visit the app at web: https://caradvertisementsweb-production.up.railway.app/ | ||
```bash | ||
bundle exec rspec | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: '3.9' | ||
|
||
services: | ||
db: | ||
image: postgres:15-alpine | ||
environment: | ||
- POSTGRES_USER=${DB_USERNAME} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
ports: | ||
- "${POSTGRES_PORT}:5432" | ||
volumes: | ||
- "dbdata:/var/lib/postgresql/data" | ||
healthcheck: | ||
test: ["CMD", "pg_isready -U ${DB_USERNAME}"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
redis: | ||
image: redis:7-alpine | ||
ports: | ||
- "${REDIS_PORT}:6379" | ||
volumes: | ||
- redis_data:/data | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
volumes: | ||
dbdata: | ||
redis_data: |