Skip to content

Commit b6c5657

Browse files
authored
Add Docker workflow (#12)
1 parent b23b09e commit b6c5657

File tree

3 files changed

+52
-53
lines changed

3 files changed

+52
-53
lines changed

.github/workflows/docker.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Docker
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
docker:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set up QEMU
14+
uses: docker/setup-qemu-action@v1
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v1
18+
19+
- name: Login to GitHub Container Registry
20+
uses: docker/login-action@v1
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.repository_owner }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Build linux/amd64
27+
id: docker_build
28+
uses: docker/build-push-action@v2
29+
with:
30+
context: .
31+
file: ./Dockerfile
32+
platforms: linux/amd64
33+
34+
- name: Build linux/arm64
35+
id: docker_build_arm64
36+
uses: docker/build-push-action@v2
37+
with:
38+
context: .
39+
file: ./Dockerfile
40+
platforms: linux/arm64
41+
42+
- name: Push images
43+
id: docker_push
44+
uses: docker/build-push-action@v2
45+
with:
46+
platforms: linux/amd64,linux/arm64
47+
push: true
48+
tags: ghcr.io/redisgrafana/pop-up-store:latest
49+
50+
- name: Image digest
51+
run: echo ${{ steps.docker_build.outputs.digest }}

README.md

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,11 @@ The Pop-up store is using [Redis Streams](https://redis.io/topics/streams-intro)
1313

1414
- Node.js script adds random data to Customers and Orders streams
1515
- RedisGears is using `StreamReader` to watch all `queue:` keys and adding Time-Series samples
16-
17-
```
18-
# Add Time-Series
19-
def tsAdd(x):
20-
xlen = execute('XLEN', x['key'])
21-
execute('TS.ADD', 'ts:len:'+x['key'], '*', xlen)
22-
execute('TS.ADD', 'ts:enqueue:' + x['key'], '*', x['value'])
23-
24-
25-
# Stream Reader for any Queue
26-
gb = GearsBuilder('StreamReader')
27-
gb.countby(lambda x: x['key']).map(tsAdd)
28-
gb.register(prefix='queue:*', duration=5000, batch=10000, trimStream=False)
29-
```
30-
3116
- Another RedisGears script completes orders
3217
- adding data to `queue:complete` stream
3318
- deleting client's ordering
3419
- decreasing product amount
3520
- trimming Orders queue
36-
37-
```
38-
# Complete order
39-
def complete(x):
40-
execute('XADD', 'queue:complete', '*', 'order', x['id'],
41-
'customer', x['value']['customer'])
42-
execute('XDEL', 'queue:customers', x['value']['customer'])
43-
execute('DECR', 'product')
44-
45-
46-
# Stream Reader for Orders queue
47-
gb = GearsBuilder('StreamReader')
48-
gb.map(complete)
49-
gb.register(prefix='queue:orders', batch=3, trimStream=True)
50-
```
51-
5221
- Grafana query streams and Time-Series keys every 5 seconds to display samples using Grafana plugins.
5322

5423
## Demo
@@ -63,28 +32,12 @@ Demo is available on [demo.volkovlabs.io](https://demo.volkovlabs.io):
6332
- [Docker](https://docker.com) to start Redis and Grafana.
6433
- [Node.js](https://nodejs.org) to run simulation script.
6534

66-
## Start Redis with RedisTimeSeries, RedisGears modules installed and Grafana
35+
## Start Redis, Grafana and Application simulation
6736

6837
```
6938
npm run start
7039
```
7140

72-
## Register RedisGears functions
73-
74-
Install Readers to add Time-Series and complete orders
75-
76-
```
77-
npm run register
78-
```
79-
80-
## Install [ioredis](https://github.com/luin/ioredis) module and start simulation
81-
82-
Script `pop-up-store.js` will add customers to stream `queue:customers` and their orders to the `orders` keys.
83-
84-
```
85-
npm run simulation
86-
```
87-
8841
## Grafana Dashboards
8942

9043
Open Grafana Dashboard using browser http://localhost:3000

register.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)