Skip to content

Commit

Permalink
docs: update docker-compose information
Browse files Browse the repository at this point in the history
  • Loading branch information
jef committed Dec 11, 2020
1 parent c74ea28 commit da78362
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 46 deletions.
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: '3.0'
services:
streetmerchant:
image: ghcr.io/jef/streetmerchant:latest
build:
context: .
dockerfile: Dockerfile
container_name: streetmerchant
env_file: .env
# ports:
# - 7997:7997
env_file:
- dotenv
25 changes: 0 additions & 25 deletions docs/docker.md
Original file line number Diff line number Diff line change
@@ -1,25 +0,0 @@
# Docker

You will need:
* `docker` (tested on Docker version 19.03.13-ce, build 4484c46d9d)
* `make` (not a strict requirement, but helps out with stages)
* `docker-compose` (tested on docker-compose version 1.27.4,)

## What
It is assumed you know what docker is.
You can build and run this project inside docker, headless. All the depencies will be downloaded in to the docker image.

## Why
There is no need to install node, or anything else (apart from above) on your machine to run this.

## How

1. Copy pasta the `.env-example` in to `.env`.
2. Edit `.env` in your favourite editor, pick stores, options what ever you want.
3. If you have make, simply run `make` in your terminal to get started. You should see a docker build, and container start automatically.
4. If you want a webserver running, so you can edit the options via web interface, uncomment lines 13-14 in `docker-compose.yml` to open up ports `7997`. Update `.env` file `WEB_PORT="7997"` this is so the service listens on `7997` and we expose the same ports on docker.
5. If you do not have make, because windows, run these commands in order:
```
docker-compose build streetmerchant-shop-bot
docker-compose up
```
75 changes: 57 additions & 18 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ You do not need any computer skills, smarts, or anything of that nature. You are
## Prerequisites

- [git](https://git-scm.com/)
- Either [Node.js 14](https://nodejs.org/en/) or [Docker](https://docs.docker.com/get-docker/) (advanced users)
- Either [Node.js 14](https://nodejs.org/en/) or [Docker (1.13.0+)](https://docs.docker.com/get-docker/) (advanced users)

## Using Node.js

Expand All @@ -14,14 +14,14 @@ You do not need any computer skills, smarts, or anything of that nature. You are
| tag | Example, `v1.0.0`; stable |
| `main` | Latest HEAD; not tagged, could be unstable |

- [Node.js 14](https://nodejs.org/en/)
- Clone this project `git clone https://github.com/jef/streetmerchant.git`.
- To checkout a particular reference, use `git checkout <ref name>` after cloning.
- Navigate to this project by entering `cd streetmerchant`.
- Run `npm install`.
- Make a copy of `dotenv-example` and name it `dotenv`.
- Edit the `dotenv` file to your liking using a text editor (like [vscode](https://code.visualstudio.com/)).
- Run `npm run start` to start.
1. Download [Node.js 14](https://nodejs.org/en/)
1. Clone this project `git clone https://github.com/jef/streetmerchant.git`.
1. To checkout a particular reference, use `git checkout <ref name>` after cloning.
1. Navigate to this project by entering `cd streetmerchant`.
1. Run `npm install`.
1. Make a copy of `dotenv-example` and name it `dotenv`.
1. Edit the `dotenv` file to your liking using a text editor (like [vscode](https://code.visualstudio.com/)).
1. Run `npm run start` to start.

At any point you want the program to stop, use ++ctrl+c++.

Expand All @@ -39,28 +39,67 @@ Available via GitHub Container Registry.

```sh
# to run docker nightly
docker run --cap-add=SYS_ADMIN \
-it --rm --env-file ./dotenv \
docker run -it --rm \
--env-file ./dotenv \
ghcr.io/jef/streetmerchant:nightly

# to test notifications
docker run --cap-add=SYS_ADMIN \
-it --rm --env-file ./dotenv \
docker run -it --rm \
--env-file ./dotenv \
ghcr.io/jef/streetmerchant:nightly test:notification:production
```

See [Developing in docker](#developing-in-docker) for more information

## Customization

To customize streetmerchant, make a copy of `dotenv-example` as `dotenv` and make any changes to your liking. View [Reference](reference/application.md) for more information on variables and their usage.


## Building docker

[Docker-Docs](docs/docker.md)

???+ tip
All environment variables are optional.

## For developers

### Developing in Node.js

The command `npm run start:dev` can be used instead of `npm run start` to automatically restart the project when filesystem changes are detected in the `src/` folder or `dotenv` file.

Use `npm run lint` to see any linting uses and `npm run lint:fix` to automatically fix the issues it can.

### Developing in Docker

#### Prerequisites

- [Docker (1.13.0+)](https://docs.docker.com/get-docker/)
- [GNU Make](https://www.gnu.org/software/make/)
- Optional, but increases quality of life
- [Docker Compose](https://docs.docker.com/compose/install/)
- Depending on your system, you may already have this. Check before installing.

#### How

1. Make a copy of `dotenv-example` and name it `dotenv`.
1. Edit the `dotenv` file to your liking using a text editor (like [vscode](https://code.visualstudio.com/)).
1. If you're using `make`, you can run `make run` to start and `make stop` to stop.
1. There are more options in the `Makefile`, feel free to explore.
1. If you do not have `make`, you can run `docker-compose` directly:

```shell
# To start
# Use `-d` if you want to run in detached mode
# Use `--build` if you want to build the image before running (default image is latest in GitHub Container Registry).
docker-compose up

# To break down
docker-compose down
```

???+ note
If you are using `WEB_PORT`, then you will need to add the following to docker-compose:

```
ports:
- "<WEB_PORT>:<WEB_PORT>"
```

Replace `<WEB_PORT>` with the value you gave in your `dotenv`.

0 comments on commit da78362

Please sign in to comment.