Skip to content

Commit d10e91e

Browse files
authored
Merge pull request #5 from daimor/new
New cli generator
2 parents 6b42bc0 + 2543a53 commit d10e91e

23 files changed

Lines changed: 3741 additions & 2726 deletions

.github/workflows/main.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
on:
3+
- push
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
variant: [
10+
"cache",
11+
"iris"
12+
]
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@master
16+
- name: Login to Docker Registry
17+
run: docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
18+
env:
19+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
20+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
21+
- name: Build and push
22+
run: make ${{ matrix.variant }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ node_modules
22
dist
33
/temp/
44
build
5-
.vscode
5+
out

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"objectscript.conn": {
3+
"active": true,
4+
"ns": "BLOCKS",
5+
"docker-compose": {
6+
"service": "server"
7+
}
8+
}
9+
}

Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG CACHE_VERSION=2017.2
1+
ARG CACHE_VERSION=2018.1
22
FROM node:8-alpine AS web
33

44
WORKDIR /opt/blocks/
@@ -13,6 +13,8 @@ FROM daimor/intersystems-cache:${CACHE_VERSION}
1313

1414
WORKDIR /opt/blocks
1515

16+
RUN yum -y install ImageMagick
17+
1618
COPY ./server/src/ ./src
1719
COPY --from=web /opt/blocks/build/ /usr/cachesys/csp/blocks/
1820

@@ -27,3 +29,7 @@ RUN ccontrol start $ISC_PACKAGE_INSTANCENAME quietly \
2729
&& ccontrol stop $ISC_PACKAGE_INSTANCENAME quietly
2830

2931
VOLUME [ "/opt/blocks/db" ]
32+
33+
COPY entrypoint.sh /
34+
35+
ENTRYPOINT [ "/entrypoint.sh" ]

Dockerfile.iris

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
ARG IRIS_VERSION=2018.1
21
FROM node:8-alpine AS web
32

43
WORKDIR /opt/blocks/
@@ -9,9 +8,18 @@ RUN npm install \
98
&& export PATH="$PATH:./node_modules/.bin" \
109
&& webpack --mode production
1110

12-
FROM daimor/intersystems-iris:${IRIS_VERSION}
11+
FROM store/intersystems/iris-community:2020.1.0.209.0
1312

14-
WORKDIR /opt/blocks/
13+
WORKDIR /opt/blocks
14+
15+
USER root
16+
17+
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} ${PWD} && \
18+
apt-get -y update && \
19+
DEBIAN_FRONTEND=noninteractive apt-get -y install imagemagick --no-install-recommends && \
20+
rm -rf /var/lib/apt/lists/*
21+
22+
USER irisowner
1523

1624
COPY ./server/src/ ./src
1725
COPY --from=web /opt/blocks/build/ /usr/irissys/csp/blocks/
@@ -25,3 +33,7 @@ RUN iris start $ISC_PACKAGE_INSTANCENAME quietly \
2533
&& iris stop $ISC_PACKAGE_INSTANCENAME quietly
2634

2735
VOLUME [ "/opt/blocks/db" ]
36+
37+
COPY entrypoint.sh /
38+
39+
ENTRYPOINT [ "/entrypoint.sh" ]

README.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Caché Blocks Explorer
2-
Database Blocks Explorer for InterSystems Caché
1+
# Blocks Explorer
2+
Database Blocks Explorer for InterSystems IRIS/Caché
33

44
#### Key features
55
##### Tree explorer
@@ -19,20 +19,43 @@ Database Blocks Explorer for InterSystems Caché
1919
You need license key for Caché or IRIS on RedHat systems.
2020
##### Caché
2121
```
22-
docker run -d --name cacheblocksexplorer --rm \
23-
-p 52773:52773 \
22+
docker run -d --name blocksexplorer --rm \
23+
-p 57772:57772 \
24+
-v /opt/some/database/for/test:/opt/blocks/db/test \
25+
-v ~/cache.key:/usr/cachesys/mgr/cache.key \
26+
daimor/blocksexplorer:cache
27+
```
28+
Generate blocks map as image file in `out` directory
29+
```
30+
docker run -it --rm \
2431
-v /opt/some/database/for/test:/opt/blocks/db/test \
25-
-v ~/cache.key:/usr/cachesys/mgr/cache.key
26-
daimor/cacheblocksexplorer:cache
32+
-v `pwd`out:/opt/blocks/out \
33+
daimor/blocksexplorer:cache generate
2734
```
35+
2836
##### IRIS
2937
```
30-
docker run -d --name cacheblocksexplorer --rm \
31-
-p 57772:57772 \
38+
docker run -d --name blocksexplorer --rm \
39+
-p 52773:52773 \
3240
-v /opt/some/database/for/test:/opt/blocks/db/test \
33-
-v ~/iris.key:/usr/irissys/mgr/iris.key
34-
daimor/cacheblocksexplorer:iris
41+
daimor/blocksexplorer:iris
42+
```
43+
44+
Generate blocks map as image file in `out` directory
45+
```
46+
docker run -it --rm \
47+
-v /opt/some/database/for/test:/opt/blocks/db/test \
48+
-v `pwd`out:/opt/blocks/out \
49+
daimor/blocksexplorer:iris generate
50+
```
51+
52+
53+
#### Development mode
54+
Run with docker-compose, will start web part with hot reloading.
55+
```
56+
docker-compose up -d
3557
```
58+
By default running on 80 port. To start using it, just open http://localhost/
3659

3760
## Screenshots
3861

docker-compose.cache.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "2.4"
2+
3+
services:
4+
server:
5+
build:
6+
context: server
7+
args:
8+
CACHE_VERSION: ${CACHE_VERSION-2018.1}
9+
ports:
10+
- "${CACHE_WEBPORT-57772}:57772"
11+
- "${CACHE_PORT-1972}:1972"
12+
volumes:
13+
- ~/cache.key:/usr/cachesys/mgr/cache.key
14+
- ./server/src:/opt/blocks/src
15+
web:
16+
environment:
17+
- DB_PORT=57772

docker-compose.iris.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
1-
version: "3"
1+
version: "2.4"
22

33
services:
44
server:
55
build:
66
context: server
77
dockerfile: Dockerfile.iris
88
args:
9-
IRIS_VERSION: ${IRIS_VERSION-2018.1}
9+
IRIS_VERSION: 2020.1.0.209.0
1010
ports:
1111
- "${IRIS_WEBPORT-52773}:52773"
1212
- "${IRIS_PORT-51773}:51773"
1313
volumes:
1414
- ~/iris.key:/usr/irissys/mgr/iris.key
1515
- ./server/src:/opt/blocks/src
1616
web:
17-
build:
18-
context: web
19-
links:
20-
- server
2117
environment:
22-
- DB_HOST=server
23-
- DB_PORT=${IRIS_WEBPORT-52773}
24-
- WEB_PORT=${WEB_PORT-80}
25-
ports:
26-
- "${WEB_PORT-80}:${WEB_PORT-80}"
27-
volumes:
28-
- node_modules:/opt/app/node_modules
29-
- web_build:/opt/app/build
30-
- ./web:/opt/app
31-
volumes:
32-
node_modules: null
33-
web_build: null
18+
- DB_PORT=52773

docker-compose.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
version: "3"
1+
version: "2.4"
22

33
services:
44
server:
5-
build:
6-
context: server
7-
args:
8-
CACHE_VERSION: ${CACHE_VERSION-2017.1}
9-
ports:
10-
- "${CACHE_WEBPORT-57772}:57772"
11-
- "${CACHE_PORT-1972}:1972"
5+
extends:
6+
file: docker-compose.${MODE:-iris}.yml
7+
service: server
128
volumes:
13-
- ~/cache.key:/usr/cachesys/mgr/cache.key
14-
- ./server/src:/opt/blocks/src
9+
- ./out:/opt/blocks/out
1510
web:
11+
extends:
12+
file: docker-compose.${MODE:-iris}.yml
13+
service: web
1614
build:
1715
context: web
1816
links:
1917
- server
2018
environment:
2119
- DB_HOST=server
22-
- DB_PORT=${CACHE_WEBPORT-57772}
2320
- WEB_PORT=${WEB_PORT-80}
2421
ports:
2522
- "${WEB_PORT-80}:${WEB_PORT-80}"

entrypoint.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
if [ "$#" -lt 1 ]; then
4+
# just start server
5+
if [ -f /iris-main ]; then
6+
/iris-main
7+
else
8+
/ccontainermain
9+
fi
10+
exit
11+
fi
12+
13+
COMMAND=$1
14+
if [ -x "$(command -v ccontrol)" ]; then
15+
CCONTROL=ccontrol
16+
else
17+
CCONTROL=iris
18+
fi
19+
20+
if [ "${COMMAND,,}" = "generate" ]; then
21+
shift
22+
re='^[0-9]+$'
23+
if ! [[ "$1" =~ $re ]]; then
24+
DATABASE=$1
25+
shift
26+
fi
27+
OutputFolder=/out/
28+
CellSize=${1:-1}
29+
CellSpace=${2:-0}
30+
ShowFill=${3:-0}
31+
DATABASE=${DATABASE:-/db}
32+
33+
echo
34+
echo "Starting server..."
35+
$CCONTROL start $ISC_PACKAGE_INSTANCENAME quietly
36+
echo
37+
echo "Generating image..."
38+
echo "Database = \"$DATABASE\""
39+
echo "OutputFolder = \"$OutputFolder\""
40+
echo "CellSize = $CellSize"
41+
echo "CellSpace = $CellSpace"
42+
echo "ShowFill = $ShowFill"
43+
rm ${OutputFolder}BlocksMap.{png,bmp}
44+
$CCONTROL session $ISC_PACKAGE_INSTANCENAME -UBLOCKS "##class(Blocks.BlocksMap).Generate(\"$DATABASE\",\"${OutputFolder}\",\"${CellSize}\",\"${CellSpace}\",\"${ShowFill}\")"
45+
echo
46+
echo "Stopping server..."
47+
$CCONTROL stop $ISC_PACKAGE_INSTANCENAME quietly
48+
echo "Finished"
49+
else
50+
/bin/echo -e "" \
51+
"Available commands:\n\n" \
52+
" help - this help\n" \
53+
" generate - will generate BlocksMap for the database located in /opt/blocks/db/test/\n" \
54+
" as an image in bmp and png format in folder /opt/blocks/out\n"
55+
" \n"
56+
fi

0 commit comments

Comments
 (0)