Skip to content

Commit

Permalink
remove $ from commands
Browse files Browse the repository at this point in the history
  • Loading branch information
flemay committed Jan 20, 2024
1 parent fc74fb7 commit d2638ac
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 70 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- Copy of docs/guide/contributing.md -->

Contributions are greatly appreciated and here are different ways
Contributions are greatly appreciated and here are different ways:

1. :star: [Star it][linkProjectRepo]!
1. :mega: Share with your friends!
Expand Down
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ Test your code and pipelines locally before your CI/CD tool runs it. Feel confid

<img alt="Animated demo" src="../vhs-demo/demo.gif" width="800px"/>

_The demo was generated with VHS using the 3 Musketeers ([source](demo))_
_The demo was generated with VHS using the 3 Musketeers ([source](demo))._

## Getting started

<!-- Copy of docs/guide/getting-started.md -->

Let's print out `Hello, World!` in the console using the 3 Musketeers. The command `make echo` will be calling Docker to run the command `echo 'Hello, World!'` inside a container.
Let's print out `Hello, World!` in the terminal using the 3 Musketeers. The command `make echo` will be calling Docker to run the command `echo 'Hello, World!'` inside a container.

<!-- Copy of diagrams/getting-started.mmd -->
```mermaid
Expand All @@ -123,7 +123,7 @@ graph LR

### Hello, World!

Create the following two files
Create the following two files:

```yaml
# docker-compose.yml
Expand All @@ -139,10 +139,10 @@ echo:
docker compose run --rm alpine echo 'Hello, World!'
```
Then simply echo "Hello, World!" with the following command:
Then simply run:
```bash
$ make echo
make echo
```

<br>
Expand All @@ -165,35 +165,35 @@ This repository is the [3 Musketeers website][link3Musketeers] website built wit

```bash
# create a .env file
$ make envfile ENVFILE=env.example
make envfile ENVFILE=env.example
# install dependencies
$ make deps
make deps

# start vitepress server for local development
$ make dev
make dev
# wait till the message 'vite v2.5.3 dev server running at' appears
# access the website in your browser at http://localhost:8080/
# \<ctrl-c\> to stop

# build static site
$ make build
make build

# serve static site for local development
$ make serveDev
make serveDev
# access the website in your browser at http://localhost:8080/
# \<ctrl-c\> to stop

# serve static website (headless)
$ make serve
make serve

# test static website
$ make test
make test

# prune
$ make prune
make prune

# contributing? make sure the following command runs successfully
$ make all
make all
```

### Deployment
Expand All @@ -206,13 +206,13 @@ This section creates a new empty Netlify site. Ensure the `.env` file contains t

```bash
# All the following commands will be run inside a container
$ make shell
make shell

# Disable telemetry (optional)
$ yarn run netlify --telemetry-disable
yarn run netlify --telemetry-disable

# Create new Netlify blank site
$ yarn run netlify sites:create --disable-linking
yarn run netlify sites:create --disable-linking
# Answer the questions regarding the team and site name
# Site name can be something like 3musketeers-preview-{random 5 digit numbers}
Site Created
Expand All @@ -222,12 +222,12 @@ URL: https://site-name.netlify.app
Site ID: site-id

# You can always get back that information
$ yarn run netlify sites:list
yarn run netlify sites:list

# Copy the ID to .env

# Exit the container
$ exit
exit
```

#### Deploy
Expand All @@ -236,13 +236,13 @@ This section deploys the website to an existing netlify site. Ensure the `.env`

```bash
# Build the website
$ make build
make build
# Deploy to netlify
$ make deploy
make deploy
# Test the website
$ curl https://site-name.netlify.app
curl https://site-name.netlify.app
# Clean up directory
$ make prune
make prune
```

#### Delete
Expand All @@ -251,13 +251,13 @@ This section deletes a netlify site. Ensure the `.env` file contains the right s

```bash
# All the following commands will be run inside a container
$ make shell
make shell
# Disable telemetry (optional)
$ yarn run netlify --telemetry-disable
yarn run netlify --telemetry-disable
# Delete the site (optional)
$ yarn run netlify sites:delete
yarn run netlify sites:delete
# Exit the container
$ exit
exit
```

### CI/CD
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- Copy of CONTRIBUTING.md -->

Contributions are greatly appreciated and here are different ways
Contributions are greatly appreciated and here are different ways:

1. :star: [Star it][linkProjectRepo]!
1. :mega: Share with your friends!
Expand Down
22 changes: 12 additions & 10 deletions docs/guide/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Docker images are like any other software. You should do your own research befor
* [jwilder/dockerize][linkDockerHubDockerize]: There is often a need to wait for a service to start before interacting with it. For instance, waiting for a database container to be ready before running a migration. The image `jwilder/dockerize` can be used to help with this scenario.

```makefile
# Makefile
dbStart:
docker compose up -d db
docker compose run --rm dockerize -wait tcp://db:3306 -timeout 60s
Expand All @@ -26,7 +27,7 @@ Docker images are like any other software. You should do your own research befor

## Accessing host's localhost from a container

On Windows/Mac, accessing the host localhost is to use the url like `host.docker.internal`. This is handy because if you have an application running on `localhost:3000` locally (through container or not), then you can access it `$ curl host.docker.internal:3000`.
On Windows/Mac, accessing the host localhost is to use the url like `host.docker.internal`. This is handy because if you have an application running on `localhost:3000` locally (through container or not), then you can access it `curl host.docker.internal:3000`.

## Image without Make

Expand All @@ -37,9 +38,9 @@ One of the examples in section [Patterns][linkPatterns] is to call Make from Com
Often image publishers offer different versions of the application/product. For instance [golang][linkGolang] has an image based on `alpine` which does not have `make`. It also has an image based on `stretch` which does.

```bash
$ docker run --rm golang:alpine make
docker run --rm golang:alpine make
# "exec: \"make\": executable file not found
$ docker run --rm golang:stretch make
docker run --rm golang:stretch make
# make: *** No targets specified and no makefile found
```

Expand All @@ -49,17 +50,16 @@ If you only want to call `make` with common shell commands, or want to use `git`

### Install Make on the fly

Whenever a command runs another command it installs `make` and then executes `$ make _target`. Depending on how many times a command is run, this may be inefficient as it needs to download `make` every time.
Whenever a command runs another command it installs `make` and then executes `make _target`. Depending on how many times a command is run, this may be inefficient as it needs to download `make` every time.

```bash
```makefile
# Makefile
MAKEFILE_DIR := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))

hello:
docker run --rm \
-v $(MAKEFILE_DIR)Makefile:/opt/app/Makefile \
-w /opt/app \
alpine sh -c "apk add --update make && make _hello"

_hello:
echo "Hello World"
```
Expand All @@ -68,10 +68,11 @@ _hello:

You may want to build and maintain your own image based on the the image you wanted to use.

```docker
```dockerfile
# Dockerfile
FROM node:alpine
RUN apk add --update make
...
# ...
```

::: tip
Expand All @@ -85,11 +86,12 @@ Mounting volumes with Docker on Mac or Windows can be slow. For instance, develo
On Mac, using the `native_osx` strategy can also help. The Docker Compose file would look like the following:

```yaml
# docker-compose.yml
yourservice:
image: animage
volumes:
- app-sync:/opt/app:nocopy
...
# ...

volumes:
# this volume is created by docker-sync. See docker-sync.yml for the config
Expand Down
19 changes: 11 additions & 8 deletions docs/guide/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Often there are many environment variables and having them in a `.env` file beco

With the following `.env` file:

```
```bash
# .env
# make sure these env vars are not set in the system
ENV_A
ENV_B=
Expand All @@ -18,6 +19,7 @@ ENV_C=env_c
And the `docker-compose.yml` file:

```yaml
# docker-compose.yml
services:
alpine:
image: alpine
Expand All @@ -27,22 +29,23 @@ services:
The expected results are:
```bash
$ docker run --rm --env-file=.env alpine env
ENV_B=
ENV_C=env_c
docker run --rm --env-file=.env alpine env
#ENV_B=
#ENV_C=env_c
# ENV_A is not set and ENV_B is set to empty

$ docker compose run --rm alpine env
ENV_B=
ENV_C=env_c
docker compose run --rm alpine env
#ENV_B=
#ENV_C=env_c
# Same as Docker
```

## Structure envfile

Environment variables can be used at different stages of software development: build, test, deploy, and run time. The following is an example how to keep .envfile structured.

```
```bash
# .env
# All
ENV

Expand Down
8 changes: 4 additions & 4 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- Copy of README.md#getting-started -->

Let's print out `Hello, World!` in the console using the 3 Musketeers. The command `make echo` will be calling Docker to run the command `echo 'Hello, World!'` inside a container.
Let's print out `Hello, World!` in the terminal using the 3 Musketeers. The command `make echo` will be calling Docker to run the command `echo 'Hello, World!'` inside a container.

![getting-started](./assets/getting-started.mmd.svg)

Expand All @@ -14,7 +14,7 @@ Let's print out `Hello, World!` in the console using the 3 Musketeers. The comma

## Hello, World!

Create the following two files
Create the following two files:

```yaml
# docker-compose.yml
Expand All @@ -30,10 +30,10 @@ echo:
docker compose run --rm alpine echo 'Hello, World!'
```
Then simply echo "Hello, World!" with the following command:
Then simply run:
```bash
$ make echo
make echo
```

[linkDocker]: https://docs.docker.com/engine/installation/
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Test your code and pipelines locally before your CI/CD tool runs it. Feel confid
<img alt="Animated demo" src="https://raw.githubusercontent.com/flemay/3musketeers/vhs-demo/demo.gif" width="800px"/>
</div>

_The demo was generated with VHS using the 3 Musketeers ([source](https://github.com/flemay/3musketeers/tree/main/demo))_
_The demo was generated with VHS using the 3 Musketeers ([source](https://github.com/flemay/3musketeers/tree/main/demo))._

---

Expand Down
Loading

0 comments on commit d2638ac

Please sign in to comment.