mirror of
https://github.com/Lissy93/dashy.git
synced 2024-11-30 01:22:52 +03:00
Adds: Keeping Docker container up-to-date, and Docker health-checks
This commit is contained in:
parent
fe69adddca
commit
c08d0c6ff6
5
deployment-templates/azuredeploy.json
Normal file
5
deployment-templates/azuredeploy.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"resources": []
|
||||
}
|
BIN
docs/assets/theme-slideshow.gif
Normal file
BIN
docs/assets/theme-slideshow.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 MiB |
@ -1,5 +1,17 @@
|
||||
## Getting Started
|
||||
# Getting Started
|
||||
|
||||
- [Deployment](#deployment)
|
||||
- [Deploy with Docker](#deploy-with-docker)
|
||||
- [Deploy from Source](#deploy-from-source)
|
||||
- [Usage](#usage)
|
||||
- [Providing Assets](#providing-assets)
|
||||
- [Basic Commands](#basic-commands)
|
||||
- [Updating](#updating)
|
||||
- [Updating Docker Container](#updating-docker-container)
|
||||
- [Automating Docker Updates](#automating-docker-updates)
|
||||
- [Updating from Source](#updating-from-source)
|
||||
|
||||
## Deployment
|
||||
### Deploy with Docker
|
||||
|
||||
The quickest way to get started on any system is with Docker, and Dashy is available though [Docker Hub](https://hub.docker.com/r/lissy93/dashy). You will need [Docker](https://docs.docker.com/get-docker/) installed on your system.
|
||||
@ -36,6 +48,7 @@ If you do not want to use Docker, you can run Dashy directly on your host system
|
||||
4. Build: `yarn build`
|
||||
5. Run: `yarn start`
|
||||
|
||||
## Usage
|
||||
### Providing Assets
|
||||
Although not essential, you will most likely want to provide several assets to Dashy. All web assets can be found in the `/public` directory.
|
||||
|
||||
@ -43,14 +56,51 @@ Although not essential, you will most likely want to provide several assets to D
|
||||
- `./public/item-icons` - If you're using your own icons, you can choose to store them locally for better load time, and this is the directory to put them in. You can also use sub-folders here to keep things organized. You then reference these assets relative this the direcroties path, for example: to use `./public/item-icons/networking/netdata.png` as an icon for one of your links, you would set `icon: networking/netdata.png`
|
||||
- Also within `./public` you'll find standard website assets, including `favicon.ico`, `manifest.json`, `robots.txt`, etc. There's no need to modify these, but you can do so if you wish.
|
||||
|
||||
### Healthchecks
|
||||
|
||||
Healthchecks are configured to periodically check that Dashy is up and running correctly on the specified port. By default, the health script is called every 5 minutes, but this can be modified with the `--health-interval` option. You can check the current container health with: `docker inspect --format "{{json .State.Health }}" [container-id]`. You can also manually request the applications status by running `docker exec -it [container-id] yarn health-check`. You can disable healthchecks altogether by adding the `--no-healthcheck` flag to your Docker run command.
|
||||
|
||||
### Basic Commands
|
||||
|
||||
Now that you've got Dashy running, there are a few commands that you need to know.
|
||||
|
||||
The following commands are defined in the [`package.json`](https://github.com/Lissy93/dashy/blob/master/package.json#L5) file, and are run with `yarn`. If you prefer, you can use NPM, just replace instances of `yarn` with `npm run`. If you are using Docker, then you will need to precede each command with `docker exec -it [container-id]`, where container ID can be found by running `docker ps`. For example `docker exec -it 26c156c467b4 yarn build`
|
||||
|
||||
#### `yarn build`
|
||||
In the interest of speed, the application is pre-compiled, this means that the config file is read during build-time, and therefore the app needs to rebuilt for any new changes to take effect. Luckily this is very straight forward. Just run `yarn build` or `docker exec -it [container-id] yarn build`.
|
||||
- **`yarn build`** - In the interest of speed, the application is pre-compiled, this means that the config file is read during build-time, and therefore the app needs to rebuilt for any new changes to take effect. Luckily this is very straight forward. Just run `yarn build` or `docker exec -it [container-id] yarn build`.
|
||||
- **`yarn validate-config`** - If you have quite a long configuration file, you may wish to check that it's all good to go, before deploying the app. This can be done with `yarn validate-config` or `docker exec -it [container-id] yarn validate-config`. Your config file needs to be in `/public/conf.yml` (or within your Docker container at `/app/public/conf.yml`). This will first check that your YAML is valid, and then validates it against Dashy's [schema](https://github.com/Lissy93/dashy/blob/master/src/utils/ConfigSchema.js).
|
||||
- **`yarn health-check`** - Checks that the application is up and running on it's specified port, and outputs current status and response times. Useful for integrating into your monitoring service, if you need to maintain high system availability
|
||||
|
||||
#### `yarn validate-config`
|
||||
If you have quite a long configuration file, you may wish to check that it's all good to go, before deploying the app. This can be done with `yarn validate-config` or `docker exec -it [container-id] yarn validate-config`. Your config file needs to be in `/public/conf.yml` (or within your Docker container at `/app/public/conf.yml`). This will first check that your YAML is valid, and then validates it against Dashy's [schema](https://github.com/Lissy93/dashy/blob/master/src/utils/ConfigSchema.js).
|
||||
## Updating
|
||||
|
||||
Dashy is under active development, so to take advantage of the latest features, you may need to update your instance every now and again.
|
||||
|
||||
### Updating Docker Container
|
||||
1. Pull latest image: `docker pull lissy93/dashy:latest`
|
||||
2. Kill off existing container
|
||||
- Find container ID: `docker ps`
|
||||
- Stop container: `docker stop [container_id]`
|
||||
- Remove container: `docker rm [container_id]`
|
||||
3. Spin up new container: `docker run [params] lissy93/dashy`
|
||||
|
||||
### Automatic Docker Updates
|
||||
|
||||
You can automate the above process using [Watchtower](https://github.com/containrrr/watchtower).
|
||||
Watchtower will watch for new versions of a given image on Docker Hub, pull down your new image, gracefully shut down your existing container and restart it with the same options that were used when it was deployed initially.
|
||||
|
||||
To get started, spin up the watchtower container:
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
--name watchtower \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
containrrr/watchtower
|
||||
```
|
||||
|
||||
For more information, see the [Watchtower Docs](https://containrrr.dev/watchtower/)
|
||||
|
||||
### Updating Dashy from Source
|
||||
1. Navigate into directory: `cd ./dashy`
|
||||
2. Stop your current instance
|
||||
3. Pull latest code: `git pull origin master`
|
||||
4. Re-build: `yarn build`
|
||||
5. Start: `yarn start`
|
||||
|
Loading…
Reference in New Issue
Block a user