-
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.
chore: docker compose databases (#96)
- Loading branch information
Showing
7 changed files
with
63 additions
and
15 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 |
---|---|---|
|
@@ -41,5 +41,7 @@ coverage | |
/spec/examples.txt | ||
|
||
.env | ||
.env.test | ||
.env.development | ||
.env.* | ||
.compose.env | ||
.postgres.env | ||
|
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 |
---|---|---|
@@ -1,24 +1,38 @@ | ||
# README | ||
# Waterflow | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
## Requirements | ||
|
||
Things you may want to cover: | ||
- ruby 3.1.x | ||
- node 14.x | ||
- redis 6.x | ||
- postgresql 11 | ||
- Docker ~> 24 | ||
- Docker compose ~> 1.29 | ||
|
||
* Ruby version | ||
## Setup project environment variables | ||
|
||
* System dependencies | ||
1. Copy `env.development.example` to `env.development.local` and `.env.test.example` to `.env.test.local` | ||
|
||
* Configuration | ||
```bash | ||
cp env.development.examplet .env.development.local && cp env.test.example .env.test.local | ||
``` | ||
|
||
* Database creation | ||
2. Change the values for appropiate ones. | ||
|
||
* Database initialization | ||
## Setup database | ||
|
||
* How to run the test suite | ||
### With docker-compose | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
1. Copy `compose.example` and `.postgres.env` to `.compose.env` and `.postgres.env`. | ||
|
||
* Deployment instructions | ||
```bash | ||
cp compose.example .compose.env && cp postgres.example .postgres.env | ||
``` | ||
|
||
* ... | ||
2. Change the values of the variables for appropiate ones. For example choose a more secure password for postgres and choose and port that make no conflict with local setup | ||
|
||
3. Start the containers | ||
|
||
```bash | ||
sudo docker-compose --env-file .compose.env up | ||
``` |
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,3 @@ | ||
# Choose a port that makes no conflicts with your local setup | ||
POSTGRES_PORT=6432 | ||
SIDEKIQ_REDIS_PORT=7379 |
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,21 @@ | ||
services: | ||
postgres: | ||
image: postgres:11 | ||
restart: unless-stopped | ||
ports: | ||
- ${POSTGRES_PORT}:5432 | ||
env_file: | ||
- .postgres.env | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
sidekiq_redis: | ||
image: redis:6.2 | ||
restart: unless-stopped | ||
ports: | ||
- ${SIDEKIQ_REDIS_PORT}:6379 | ||
volumes: | ||
- sidekiq_redis_data:/data | ||
|
||
volumes: | ||
postgres_data: | ||
sidekiq_redis_data: |
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,3 @@ | ||
DATABASE_URL=postgres://user:password@Hhost:port/database | ||
REDIS_PROVIDER=redis://host:port | ||
MAPBOX_TOKEN=example_token |
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,3 @@ | ||
DATABASE_URL=postgres://user:password@Hhost:port/database | ||
# optional | ||
# REDIS_PROVIDER=redis://host:port |
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,2 @@ | ||
# Choose a more secure password | ||
POSTGRES_PASSWORD=postgres |