docs: update docker-compose information

This commit is contained in:
Jef LeCompte
2020-12-11 12:37:33 -05:00
parent c74ea28014
commit da78362045
3 changed files with 60 additions and 46 deletions
+3 -3
View File
@@ -1,10 +1,10 @@
version: '3.0' version: '3.0'
services: services:
streetmerchant: streetmerchant:
image: ghcr.io/jef/streetmerchant:latest
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: streetmerchant container_name: streetmerchant
env_file: .env env_file:
# ports: - dotenv
# - 7997:7997
-25
View File
@@ -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
```
+57 -18
View File
@@ -5,7 +5,7 @@ You do not need any computer skills, smarts, or anything of that nature. You are
## Prerequisites ## Prerequisites
- [git](https://git-scm.com/) - [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 ## Using Node.js
@@ -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 | | tag | Example, `v1.0.0`; stable |
| `main` | Latest HEAD; not tagged, could be unstable | | `main` | Latest HEAD; not tagged, could be unstable |
- [Node.js 14](https://nodejs.org/en/) 1. Download [Node.js 14](https://nodejs.org/en/)
- Clone this project `git clone https://github.com/jef/streetmerchant.git`. 1. Clone this project `git clone https://github.com/jef/streetmerchant.git`.
- To checkout a particular reference, use `git checkout <ref name>` after cloning. 1. To checkout a particular reference, use `git checkout <ref name>` after cloning.
- Navigate to this project by entering `cd streetmerchant`. 1. Navigate to this project by entering `cd streetmerchant`.
- Run `npm install`. 1. Run `npm install`.
- Make a copy of `dotenv-example` and name it `dotenv`. 1. 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/)). 1. Edit the `dotenv` file to your liking using a text editor (like [vscode](https://code.visualstudio.com/)).
- Run `npm run start` to start. 1. Run `npm run start` to start.
At any point you want the program to stop, use ++ctrl+c++. At any point you want the program to stop, use ++ctrl+c++.
@@ -39,28 +39,67 @@ Available via GitHub Container Registry.
```sh ```sh
# to run docker nightly # to run docker nightly
docker run --cap-add=SYS_ADMIN \ docker run -it --rm \
-it --rm --env-file ./dotenv \ --env-file ./dotenv \
ghcr.io/jef/streetmerchant:nightly ghcr.io/jef/streetmerchant:nightly
# to test notifications # to test notifications
docker run --cap-add=SYS_ADMIN \ docker run -it --rm \
-it --rm --env-file ./dotenv \ --env-file ./dotenv \
ghcr.io/jef/streetmerchant:nightly test:notification:production ghcr.io/jef/streetmerchant:nightly test:notification:production
``` ```
See [Developing in docker](#developing-in-docker) for more information
## Customization ## 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. 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 ???+ tip
All environment variables are optional. All environment variables are optional.
## For developers ## 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. 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`.