Skip to content

Commit 6b09562

Browse files
authored
docker: add compose file for docker deployment (#194)
The latest tag points to the last release, while `main` can be used for the latest development commits
2 parents c502885 + 625dc3f commit 6b09562

File tree

4 files changed

+65
-30
lines changed

4 files changed

+65
-30
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Thumbs.db
1515
# Project files
1616
/node_modules
1717
/build
18-
/config.json
1918
*.zip
2019
/dev-dist
2120
/public/config.json

DEVELOPMENT.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,60 @@
11
# Meshviewer Development
22

3+
## Building
4+
5+
### Build yourself
6+
7+
- Clone this repository
8+
- Run `npm install`
9+
- Place your config file in `public/config.json`.
10+
You can copy the example config for testing/development: `cp config.example.json public/config.json`.
11+
- Run `npm run build`
12+
- A production build can then be found in [`/build`](./build)
13+
14+
Hint: You can start a development server with `npm run dev`
15+
16+
### Build and run using Docker
17+
18+
You have to copy `config.example.json` to `public/config.json`.
19+
20+
Static local instance:
21+
22+
```bash
23+
docker run -it --rm -u $(id -u):$(id -g) -v "$PWD":/app -w /app node npm install
24+
docker run -it --rm -u $(id -u):$(id -g) -v "$PWD":/app -w /app node npm run build
25+
docker run -it --rm -v "$PWD/build":/usr/share/nginx/html -p 8080:80 --name nginx nginx
26+
```
27+
28+
The map is reachable at [localhost:8080](http://localhost:8080).
29+
Start a development environment with hot-reload:
30+
31+
```bash
32+
docker run -it --rm --name meshviewer-dev \
33+
-u $(id -u):$(id -g) \
34+
-v "$PWD":/app -w /app \
35+
-e NODE_ENV=development \
36+
-p 5173:5173 \
37+
node npm run dev -- --host 0.0.0.0
38+
```
39+
40+
## Workflow
41+
42+
To submit a feature, you should fork this repository and commit your changes on a branch of your fork.
43+
Then you can open a PR against this repository.
44+
45+
To align your changes with the linter of this project run
46+
47+
`npm run lint:fix`
48+
49+
## Conventions
50+
351
Following you can find some wording and used functionality for this project.
452

553
Normally you should use meaningful and self explaining names for variables and functions
654
but sometimes using common conventions might help as well, for example `i` / `j` for index, `e` for exceptions or events etc.
755
but also names based on elements like `p`, `a`, `div`..
856

9-
## Functions
57+
### Functions
1058

1159
`_.t("[translation.selector]")`
1260
: Lookup translation based on dotted path from `public/locale/[language].json`

README.md

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,20 @@ It is recommended to use the latest release:
1414
- Let your webserver serve this build
1515
- Add a config.json to the webdir (based on config.example.json)
1616

17-
### Build yourself
17+
## Docker Deployment
1818

19-
- Clone this repository
20-
- Run `npm install`
21-
- Place your config file in `public/config.json`.
22-
You can copy the example config for testing/development: `cp config.example.json public/config.json`.
23-
- Run `npm run build`
24-
- A production build can then be found in [`/build`](./build)
19+
Using the GitHub Container Registry (GHCR) you can get the latest dockerized release with `docker compose`.
2520

26-
Hint: You can start a development server with `npm run dev`
21+
Put your config.json into the public folder and run the following to deploy a meshviewer:
2722

28-
### Build and run using Docker
29-
30-
Static local test instance:
31-
32-
```bash
33-
docker run -it --rm -u $(id -u):$(id -g) -v "$PWD":/app -w /app node npm install
34-
docker run -it --rm -u $(id -u):$(id -g) -v "$PWD":/app -w /app node npm run build
35-
docker run -it --rm -v "$PWD/build":/usr/share/nginx/html -p 8080:80 --name nginx nginx
23+
```
24+
docker compose pull
25+
docker compose up -d
3626
```
3727

3828
The map is reachable at [localhost:8080](http://localhost:8080).
39-
You have to copy `config.example.json` to `public/config.json`:
4029

41-
Start a development environment:
42-
43-
```bash
44-
docker run -it --rm --name meshviewer-dev \
45-
-u $(id -u):$(id -g) \
46-
-v "$PWD":/app -w /app \
47-
-e NODE_ENV=development \
48-
-p 5173:5173 \
49-
node npm run dev -- --host 0.0.0.0
50-
```
30+
Hint: Instead of the latest release `ghcr.io/freifunk/meshviewer:latest` one can also use version tags for a specific version or `main` for the latest unreleased commits.
5131

5232
## Configuration
5333

@@ -59,9 +39,10 @@ Both the deprecation and the EOL warning can be turned off with `"deprecation_en
5939

6040
You can insert custom HTML into the deprecation and eol warning via `"deprecation_text":""` and `"eol_text":""` respectively.
6141

62-
## Development
42+
## Development & Building
6343

6444
To contribute to the project by developing new features, have a look at our [development documentation](DEVELOPMENT.md).
45+
This also includes instructions on building this project.
6546

6647
## History
6748

compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
meshviewer:
3+
image: ghcr.io/freifunk/meshviewer:latest
4+
volumes:
5+
- ./public/config.json:/usr/share/nginx/html/config.json
6+
ports:
7+
- "8080:80"

0 commit comments

Comments
 (0)