Skip to content

Commit

Permalink
Adjust commands in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mocdaniel committed Jan 2, 2023
1 parent 276e3d5 commit 6f93820
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ and embedding the pre-built, static frontend files.
The frontend can be built by navigating to `./app/frontend` within the project's repository folder and issuing the following command:

```
~ npm run build
npm run build
> guestbook-demo@1.0.0 build
> run-p type-check build-only
Expand Down Expand Up @@ -83,7 +83,7 @@ As mentioned in the [Architecture](https://github.com/mocdaniel/guestbook-demo#a
to differentiate between development environment and production behaviour. Therefore, building the Go binary looks like this:

```
~ go build -o guestbook -tags prod ./app
go build -o guestbook -tags prod ./app
```

The output directory/name of the Go binary can be set by passing the `-o` flag, the `-tags prod` part is **mandatory**.
Expand All @@ -97,7 +97,7 @@ The application exposes multiple settings which can be set using either **comman
A list of all available command line arguments and their respective defaults can be displayed by passing the `--help`/`-h` flag:

```
~ ./guestbook --help
./guestbook --help
Usage of ./guestbook:
--db-host string PostgreSQL server address (default "localhost")
--db-max-idle-conns int PostgreSQL max idle connections (default 25)
Expand Down Expand Up @@ -140,7 +140,7 @@ Building the whole application into a single Go binary makes it easily deployabl
As mentioned in [Running the Application](https://github.com/mocdaniel/guestbook-demo#running-the-application) the application can be run on most OSes by executing the binary either manually:

```
~ ./guestbook --db-host postgres.example.com --redis-host redis.example.com --db-user daniel --db-password supersecure
./guestbook --db-host postgres.example.com --redis-host redis.example.com --db-user daniel --db-password supersecure
```

This will run the application in the foreground and log to stdout/stderr. In case you want to run it in the background,
Expand All @@ -155,30 +155,30 @@ using very slim and secure [images provided by Chainguard](https://www.chainguar
For deploying via Docker, you first have to build the image:

```
~ docker build -t someuser/somename:someversion .
docker build -t someuser/somename:someversion .
```

Then you can go on and run the application via Docker, either in the foreground or background (by providing the `-d` flag).
CLI parameters can be provided as **environment variables** or **cmd**, following the image specification:

```
# configure using environment variables
~ docker run -d -p 8080:8080 --name guestbook-demo \
docker run -d -p 8080:8080 --name guestbook-demo \
-e GUESTBOOK_DB_HOST=postgres.example.com \
-e GUESTBOOK_REDIS_HOST=redis.example.com \
someuser/somename:someversion
# configure using CLI parameters
~ docker run -d -p 8080:8080 --name guestbook-demo someuser/somename:someversion \
docker run -d -p 8080:8080 --name guestbook-demo someuser/somename:someversion \
--db-host=postgres.example.com \
--redis-host=redis.example.com
```

In case you need/want to delete the running container again, issue

```
~ docker stop guestbook-demo
~ docker rm guestbook-demo
docker stop guestbook-demo
docker rm guestbook-demo
```

### Running the Docker Compose Stack
Expand All @@ -189,13 +189,13 @@ environment for the guestbook-demo including **PostgreSQL** and **Redis** out of
To deploy the whole stack either in fore- or background (again, provide the flag `-d`), just run the following command from the repository's root directory:

```
~ docker compose up -d
docker compose up -d
```

This will build the application's Docker image as defined in the [Dockerfile](Dockerfile) and spin up three containers for the application, PostgreSQL, and Redis. If you need/want to delete the stack again, issue

```
~ docker compose down
docker compose down
```

from the repository's root directory.
Expand Down

0 comments on commit 6f93820

Please sign in to comment.