Skip to content

Commit

Permalink
Better dx (Berkeley-CS61B#29)
Browse files Browse the repository at this point in the history
Use Docker for local DB
  • Loading branch information
laksith19 authored Nov 3, 2022
1 parent 8970bc2 commit 8f1bf71
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is an example of what the .env should look like

# Database
DATABASE_URL='<DB_URL>'
# Database - Replace for production
DATABASE_URL='mysql://root:prisma@localhost:3306/sohq'

NEXT_PUBLIC_HOSTNAME='http://localhost:3000'

Expand All @@ -13,4 +13,4 @@ NEXTAUTH_URL='http://localhost:3000'

# Ably
ABLY_SERVER_API_KEY='<ABLY_SERVER_API_KEY>'
NEXT_PUBLIC_ABLY_CLIENT_API_KEY='<ABLY_CLIENT_API_KEY>'
NEXT_PUBLIC_ABLY_CLIENT_API_KEY='<ABLY_CLIENT_API_KEY>'
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,22 @@ Google OAuth is used for authentication.
<details>
<summary>Database</summary>

SOHQ uses MySQL as its database, mainly because the free tier of <a href="https://planetscale.com">Planetscale</a> is very nice. For local development, I am currently looking into possibly using Docker to have a local MySQL instance.
#### Local Development
For local development we run a docker container serving a mySQL database.

1. Install [Docker](https://docs.docker.com/get-docker/) on your machine.

2. Start the container by running:
```
docker compose up
```


#### Production



For the production environment, the free tier of <a href="https://planetscale.com">Planetscale</a> is very nice.

1. Create a new database on <a target="_blank" href="https://planetscale.com">Planetscale</a>.

Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'
services:
mysql-db:
image: mysql:5.7
restart: always
ports:
- '3306:3306'
ulimits:
nofile:
soft: 65536
hard: 65536
environment:
MYSQL_ROOT_PASSWORD: prisma
volumes:
- mysql:/var/lib/mysql
volumes:
mysql: ~

0 comments on commit 8f1bf71

Please sign in to comment.