Skip to content

Commit

Permalink
✨ Add redis
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanprince committed Sep 21, 2024
1 parent 32f327b commit c697e4d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ npx create-docker-db # or bunx create-docker-db
- [x] Display copy-pastable connection URLs for the created databases
- [ ] Modify existing Docker Compose files instead of overwriting them
- [ ] Add support for more databases (see below)
- [ ] Allow Redis to be selected with other DBs (like selecting Postgres + Redis)
- [ ] Add support for more configurations (like custom container names based on project name)

### Support Additional Databases

- [ ] Add support for MongoDB
- [ ] Add support for Redis
- [x] Add support for Redis
- [ ] Add support for SQLite (with LibSQL HTTP for Turso)
- [ ] Add support for HTTP based DB services (like PlanetScale, Turso, etc.)
16 changes: 0 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,9 @@ program
options: [
{ value: "postgres", label: "PostgreSQL" },
{ value: "mysql", label: "MySQL" },
{
value: "sqlite",
label: "SQLite",
hint: "Not supported yet, coming soon!",
},
{
value: "libsql",
label: "LibSQL (Turso)",
hint: "Not supported yet, coming soon!",
},
{
value: "mongodb",
label: "MongoDB",
hint: "Not supported yet, coming soon!",
},
{
value: "redis",
label: "Redis",
hint: "Not supported yet, coming soon!",
},
],
initialValue: "postgres",
Expand Down
26 changes: 26 additions & 0 deletions src/templates/redis.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "3.9"

name: ${selectedProjectName}-redis

services:
# This is your local Redis database instance
redis-db:
image: redis
restart: always
volumes:
- ${selectedProjectName}-data:/data
ports:
- "6969:6379" # Access the Redis DB at port 6969

# Use RedisInsight to view and manage Redis at localhost:8069
redisinsight:
image: redis/redisinsight:latest
restart: always
ports:
- "8069:8001"
environment:
- REDIS_URL=redis://redis-db:6379

volumes:
${selectedProjectName}-data:
driver: local
2 changes: 2 additions & 0 deletions src/utils/get-connection-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export function getConnectionUrl(
return `postgresql://dev:dev@localhost:6969/${selectedProjectName}`;
case "mysql":
return `mysql://dev:dev@localhost:6969/${selectedProjectName}`;
case "redis":
return `redis://localhost:6969`;
default:
throw new Error("Database not supported");
}
Expand Down

0 comments on commit c697e4d

Please sign in to comment.