Skip to content

Commit

Permalink
fix: docker network issue for mac
Browse files Browse the repository at this point in the history
  • Loading branch information
vinitparekh17 committed Oct 18, 2024
1 parent 201363c commit c8e8a85
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DICEDB_ADDR=localhost:7379
DICEDB_USERNAME=dice
DICEDB_PASSWORD=
SERVER_PORT=:8080
IS_TEST_ENVIRONMENT=false
REQUEST_LIMIT_PER_MIN=1000
REQUEST_WINDOW_SEC=60
ALLOWED_ORIGINS=http://localhost:3000
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,47 @@ $ sudo su
$ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /bin v1.60.1
```

Steps to clone and run:
### Steps to clone and run:
```sh
$ git clone https://github.com/dicedb/playground-mono
$ cd playground-mono
$ cp .env.sample .env
$ go run main.go
```

### Using Docker
### Running the Project Using Docker

```sh
#### 1. Clone the repository:

```bash
git clone https://github.com/dicedb/playground-mono
```

#### 2. Navigate to the project directory:

```bash
cd playground-mono
```

#### 3. Copy the sample environment file:

```bash
cp .env.sample .env
```
This creates the `.env` file, which stores your environment variables. Make sure to update any necessary values inside this file before running the server.

#### 4. Start the application using Docker Compose:

```bash
docker compose up -d
```
```
This command will pull any necessary Docker images, build the containers, and run them in detached mode (`-d`).

#### 5. Verify the server is running:

Open your browser and go to:

```bash
http://localhost:8000/health
```
This endpoint should return a status indicating that the server is up and running.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
dicedb:
image: dicedb/dicedb:latest
ports:
- "7379"
- "7379:7379"
healthcheck:
test: ["CMD", "PING"]
interval: 10s
Expand All @@ -19,7 +19,7 @@ services:
depends_on:
- dicedb
environment:
- DICEDB_ADDR=dicedb:7379
- DICEDB_ADDR=localhost:7379
- DICEDB_USERNAME=${DICEDB_USERNAME}
- DICEDB_PASSWORD=${DICEDB_PASSWORD}
networks:
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"server/config"
"server/internal/db"
"server/internal/server"

_ "github.com/joho/godotenv/autoload"
)

func main() {
Expand Down

0 comments on commit c8e8a85

Please sign in to comment.