Skip to content

Commit

Permalink
dynamic access token saving
Browse files Browse the repository at this point in the history
  • Loading branch information
developedsoftware authored Jan 8, 2024
1 parent 3c47831 commit 2822864
Show file tree
Hide file tree
Showing 10 changed files with 1,685 additions and 2,676 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ jobs:

strategy:
matrix:
node-version: [14.6]
node-version: [20.10.0]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run clean
- run: npm run build
- run: npm run build-container-snapshot
- run: npm run build-container-timelapse
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ RUN npm install
# build
RUN npm run build

FROM node:current-alpine
FROM node:20.10-alpine

# add ffmpeg
RUN apk add --no-cache ffmpeg

ARG command=snapshot

ENV command=$command
ENV token=$token

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Luke English
Copyright (c) 2024 Luke English

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@ In order to run the Docker container you need a ring refresh token.
To generate the token use the following command:

``` bash
docker run -i --rm docker.io/developedsoftware/ring-timelapse:token
docker run -i --rm -v "/my/host/folder:/app/dist/target" docker.io/developedsoftware/ring-timelapse:token
```

> **NOTE**: Please keep this token safe and never share it with anybody
> **NOTE**: Your token will be saved to "/my/host/folder/.token" and updated whenever a new token is received
## Creating Snapshots

To take a snapshot of every camera run

``` bash
docker run --rm -e token="<insert token here>" -v "/my/folder:/app/dist/target" docker.io/developedsoftware/ring-timelapse:snapshot
docker run --rm -v "/my/host/folder:/app/dist/target" docker.io/developedsoftware/ring-timelapse:snapshot
```

> Replace `token="<insert token here>"` with the ring token you generated during installation
> Replace `/my/target/folder` with the directory on your host where you want the snapshots saved
> Replace `/my/host/folder` with the directory on your host where you want the snapshots saved
Upon completion the container stops and removes itself, allowing you to run it when and however you wish

Expand All @@ -40,26 +38,21 @@ Upon completion the container stops and removes itself, allowing you to run it w
To create a timelapse run

``` bash
docker run --rm -v "/my/target/folder:/app/dist/target" docker.io/developedsoftware/ring-timelapse:timelapse
docker run --rm -v "/my/host/folder:/app/dist/target" docker.io/developedsoftware/ring-timelapse:timelapse
```

> Replace `/my/target/folder` with the directory on your host where you want the snapshots saved
> Replace `/my/host/folder` with the directory on your host where you want the snapshots saved
> **NOTE** Once the video file is generated the snapshot files will be deleted. To keep these map the archive folder to a directory on your host by using `-v "/my/archive/folder:/app/dist/archive"`
> **NOTE** Once the video file is generated the snapshot files will be deleted. To keep these map the archive folder to a directory on your host by using `-v "/my/host/archive/folder:/app/dist/archive"`
Upon completion the container stops and removes itself, allowing you to run it when and however you wish

## Environment Variables

The following variables are required:

`token` - your generated Ring token

## Crontab

An example crontab file can be found below which captures a snapshot every 5 minutes and creates a timelapse once a month

```
*/5 * * * * docker run --rm -e token="<insert token here>" -v "/my/folder:/app/dist/target" docker.io/developedsoftware/ring-timelapse:snapshot
0 0 1 * * docker run --rm -v "/my/target/folder:/app/dist/target" -v "/my/archive/folder:/app/dist/archive" docker.io/developedsoftware/ring-timelapse:timelapse
* * * * * docker run --rm -v "/my/host/folder:/app/dist/target" docker.io/developedsoftware/ring-timelapse:snapshot
0 0 1 * * docker run --rm -v "/my/host/folder:/app/dist/target" docker.io/developedsoftware/ring-timelapse:timelapse
0 0 1 * * docker run --rm -v "/my/host/folder:/app/dist/target" -v "/my/host/archive/folder:/app/dist/archive" docker.io/developedsoftware/ring-timelapse:timelapse
```
2 changes: 1 addition & 1 deletion nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css
auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options=
auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false
auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css
auxiliary.org-netbeans-modules-javascript-nodejs.enabled=false
auxiliary.org-netbeans-modules-javascript-nodejs.enabled=true
auxiliary.org-netbeans-modules-javascript-nodejs.node_2e_default=true
auxiliary.org-netbeans-modules-javascript-nodejs.run_2e_enabled=false
auxiliary.org-netbeans-modules-javascript-nodejs.sync_2e_enabled=true
Expand Down
Loading

0 comments on commit 2822864

Please sign in to comment.