This commit is contained in:
Reinaldy Rafli 2021-02-24 14:39:07 +07:00
commit ee840220b3
4 changed files with 136 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
volume/

47
README.md Normal file
View File

@ -0,0 +1,47 @@
# My Databases
Scroll down for some Q&A.
## Why through docker? Why not installing it independently?
1. I'm on Windows. There's no way I'm able to install Redis and Couchdb
2. I can't install PostgreSQL on my Windows, I don't know why.
3. There are light alpine-linux version, so why not?
## Can I use it too?
Sure. That's why it's a public repository.
## Great! What's the user-password and ports?
Glad you asked. I'm too lazy to set up different user-password combination, so here it is.
Database | User | Password | Port
--- | --- | --- | ---
PostgreSQL | postgres | password | 5432
MySQL | root | password | 3306
Redis | - | - | 6379
MongoDB | root | password | 27017
CouchDB | root | password | 5984
## How about some kind of admin panel?
Sure, I did setup some of that, too. But, I haven't found a good one for CouchDB. Might update it in the future.
Service | Database | Port
--- | --- | ---
Adminer | MySQL, PostgreSQL | 2086
Redis Commander | Redis | 2084
Mongo Express | MongoDB | 2083
## Can I access them through my localhost?
Yes.
## Wait, my CouchDB got an error?
Yeah.. about that.. You'll need to run `couch.prod.sh` first.
## Will you consider adding more databases?
For now.. No. But you can for your project, if you want to.

6
couch.prod.sh Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
sleep 10
curl -X PUT http://root:password@localhost:5984/_users
curl -X PUT http://root:password@localhost:5984/_replicator
curl -X PUT http://root:password@localhost:5984/_global_changes

82
docker-compose.yml Normal file
View File

@ -0,0 +1,82 @@
services:
postgres:
image: postgres:13.1-alpine
restart: always
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
volumes:
- ./volume/postgres:/var/lib/postgresql/data
mysql:
image: mysql:8.0.23
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: password
volumes:
- ./volume/mysql:/var/lib/mysql
cap_add:
- SYS_NICE
redis:
image: redis:6.2.0-alpine
restart: always
ports:
- 6379:6379
volumes:
- ./volume/redis/etc:/usr/local/etc/redis
- ./volume/redis/data:/data
mongo:
image: mongo:4.4.3-bionic
restart: always
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
volumes:
- ./volume/mongo:/data/db
couch:
image: couchdb:3.1.1
restart: always
ports:
- 5984:5984
environment:
COUCHDB_USER: root
COUCHDB_PASSWORD: password
# I found these secret and flags on some Github repo, so I thought I'd use it and it worked.
COUCHDB_SECRET: 0ef656e4-afa6-11ea-b3de-0242ac130004
ERL_FLAGS: "-setcookie 556d8dd-e921-4e84-8f4c-011a69969724"
volumes:
- "./volume/couch/data:/opt/couchdb/data"
- "./volume/couch/cfg:/opt/couchdb/etc/local.d"
mongo-express:
image: mongo-express:latest
restart: always
ports:
- 2083:8081
depends_on:
- mongo
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: password
redis-commander:
image: rediscommander/redis-commander:latest
restart: always
environment:
REDIS_PORT: 6379
REDIS_HOST: redis
ports:
- 2084:8081
depends_on:
- redis
adminer:
image: adminer:latest
restart: always
ports:
- 2086:8081
depends_on:
- mysql
- postgres