Skip to content

Commit 3c26f81

Browse files
committedFeb 8, 2024
add Docker
1 parent 4fbbfae commit 3c26f81

17 files changed

+402
-0
lines changed
 

‎.devcontainer/devcontainer.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.224.2/containers/docker-existing-docker-compose
3+
{
4+
"name": "intersystems-iris-dev-template devcontainer",
5+
6+
// Use the same recipe as creates the container we use when working locally.
7+
"dockerComposeFile": [
8+
"../docker-compose.yml"
9+
],
10+
11+
"service": "iris",
12+
13+
"workspaceFolder": "/home/irisowner/dev",
14+
15+
// This provides the elements of the connection object which require different values when connecting to the workspace within the container,
16+
// versus those in .vscode/settings.json which apply when operating locally on the workspace files.
17+
// We define and use a `server` so that (a) a user-level `objectscript.conn.server` properly doesn't override us, and (b) so InterSystems
18+
// Server Manager can also be used.
19+
"settings": {
20+
"objectscript.conn" :{
21+
"server": "devcontainer",
22+
"active": true,
23+
},
24+
"intersystems.servers": {
25+
"devcontainer": {
26+
"username": "SuperUser",
27+
"password": "SYS",
28+
"webServer": {
29+
"scheme": "http",
30+
"host": "127.0.0.1",
31+
"port": 52773
32+
},
33+
},
34+
},
35+
"python.defaultInterpreterPath":"/usr/irissys/bin/irispython"
36+
},
37+
38+
// Add the IDs of extensions we want installed when the container is created.
39+
// Currently (March 2022) `intersystems.language-server` fails to run within the container (alpine platform).
40+
// Issue is probably https://github.com/intersystems/language-server/issues/185 and/or https://github.com/intersystems/language-server/issues/32
41+
// Crash gets reported to the user, after which `intersystems-community.vscode-objectscript` falls back to
42+
// using its TextMate grammar for code coloring.
43+
"extensions": [
44+
"ms-python.python",
45+
"ms-python.vscode-pylance",
46+
"intersystems-community.vscode-objectscript",
47+
"intersystems.language-server",
48+
"intersystems-community.servermanager",
49+
"ms-vscode.docker"
50+
],
51+
}

‎.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/.DS_Store
2+
iris-main.log
3+
.git

‎.gitattributes

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.cls linguist-language=ObjectScript
2+
*.mac linguist-language=ObjectScript
3+
*.int linguist-language=ObjectScript
4+
*.inc linguist-language=ObjectScript
5+
*.csp linguist-language=Html
6+
7+
*.sh text eol=lf
8+
*.cls text eol=lf
9+
*.mac text eol=lf
10+
*.int text eol=lf
11+
Dockerfil* text eol=lf

‎.github/workflows/build-push-gcr.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Cloud Run Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
workflow_dispatch:
9+
10+
jobs:
11+
deploy:
12+
uses: intersystems-community/demo-deployment/.github/workflows/deployment.yml@master
13+
with:
14+
# Replace the name: parameter below to have your application deployed at
15+
# https://project-name.demo.community.intersystems.com/
16+
name: project-name
17+
secrets:
18+
# Do not forget to add Secret in GitHub Repoository Settings with name SERVICE_ACCOUNT_KEY
19+
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: versionbump
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
release:
9+
types:
10+
- released
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Bump version
20+
run: |
21+
git config --global user.name 'ProjectBot'
22+
git config --global user.email 'bot@users.noreply.github.com'
23+
VERSION=$(sed -n '0,/.*<Version>\(.*\)<\/Version>.*/s//\1/p' module.xml)
24+
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
25+
sed -i "0,/<Version>\(.*\)<\/Version>/s//<Version>$VERSION<\/Version>/" module.xml
26+
git add module.xml
27+
git commit -m 'auto bump version'
28+
git push

‎.github/workflows/github-registry.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build and publish a Docker image to ghcr.io
2+
on:
3+
4+
# publish on pushes to the main branch (image tagged as "latest")
5+
# image name: will be: ghcr.io/${{ github.repository }}:latest
6+
# e.g.: ghcr.io/intersystems-community/intersystems-iris-dev-template:latest
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
docker_publish:
13+
runs-on: "ubuntu-20.04"
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
# https://github.com/marketplace/actions/push-to-ghcr
19+
- name: Build and publish a Docker image for ${{ github.repository }}
20+
uses: macbre/push-to-ghcr@master
21+
with:
22+
image_name: ${{ github.repository }}
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
# optionally push to the Docker Hub (docker.io)
25+
# docker_io_token: ${{ secrets.DOCKER_IO_ACCESS_TOKEN }} # see https://hub.docker.com/settings/security
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: objectscriptquality
2+
on: push
3+
4+
jobs:
5+
linux:
6+
name: Linux build
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Execute ObjectScript Quality Analysis
11+
run: wget https://raw.githubusercontent.com/litesolutions/objectscriptquality-jenkins-integration/master/iris-community-hook.sh && sh ./iris-community-hook.sh
12+

‎.github/workflows/runtests.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: unittest
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request:
9+
branches:
10+
- master
11+
- main
12+
release:
13+
types:
14+
- released
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Build and Test
22+
uses: docker/build-push-action@v2
23+
with:
24+
context: .
25+
push: false
26+
load: true
27+
tags: ${{ github.repository }}:${{ github.sha }}
28+
build-args: TESTS=1

‎.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
iris-main.log
3+
.env
4+
.git
5+

‎.iris_init

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:alias enablebi do EnableDeepSee^%SYS.cspServer("/csp/"_$zcvt($namespace,"L")) ;
2+
:alias ssl x "n $namespace set $namespace=""%SYS"", name=$S(""$1""="""":""DefaultSSL"",1:""$1"") do:'##class(Security.SSLConfigs).Exists(name) ##class(Security.SSLConfigs).Create(name)" ;
3+
:alias createdb do $SYSTEM.SQL.Execute("CREATE DATABASE $1") ;
4+
:alias installipm s r=##class(%Net.HttpRequest).%New(),r.Server="pm.community.intersystems.com",r.SSLConfiguration="ISC.FeatureTracker.SSL.Config" d r.Get("/packages/zpm/latest/installer"),$system.OBJ.LoadStream(r.HttpResponse.Data,"c") ;
5+
:alias add%all x "n $namespace set $namespace=""%SYS"",P(""Globals"")=""%DEFAULTDB"",sc=##class(Config.Namespaces).Create(""%All"",.P)" ;
6+
:alias exportglobal d $System.OBJ.Export("$1.GBL","$2$1.xml") ;
7+
:alias rcc Write !,"Hi "_$namespace,! ;

‎.vscode/extensions.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"recommendations": [
3+
"eamodio.gitlens",
4+
"georgejames.gjlocate",
5+
"github.copilot",
6+
"intersystems-community.servermanager",
7+
"intersystems-community.sqltools-intersystems-driver",
8+
"intersystems-community.testingmanager",
9+
"intersystems-community.vscode-objectscript",
10+
"intersystems.language-server",
11+
"mohsen1.prettify-json",
12+
"ms-azuretools.vscode-docker",
13+
"ms-python.python",
14+
"ms-python.vscode-pylance",
15+
"ms-vscode-remote.remote-containers"
16+
]
17+
}

‎.vscode/launch.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "objectscript",
6+
"request": "launch",
7+
"name": "ObjectScript Debug Class",
8+
"program": "##class(dc.sample.ObjectScript).Test()",
9+
},
10+
{
11+
"type": "objectscript",
12+
"request": "attach",
13+
"name": "ObjectScript Attach",
14+
"processId": "${command:PickProcess}",
15+
"system": true
16+
}
17+
]
18+
}

‎.vscode/settings.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"files.associations": {
3+
4+
"Dockerfile*": "dockerfile",
5+
"iris.script": "objectscript"
6+
},
7+
"objectscript.conn" :{
8+
"active": true,
9+
"ns": "IRISAPP",
10+
"username": "_SYSTEM",
11+
"password": "SYS",
12+
"docker-compose": {
13+
"service": "iris",
14+
"internalPort": 52773
15+
},
16+
"links": {
17+
"UnitTest Portal": "${serverUrl}/csp/sys/%25UnitTest.Portal.Home.cls?$NAMESPACE=IRISAPP"
18+
}
19+
},
20+
"intersystems.testingManager.client.relativeTestRoot": "tests"
21+
22+
}

‎Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The most minimumalistic dockerfile possible.
2+
# No embedded python support, no unit-testing, no aliases.
3+
ARG IMAGE=intersystemsdc/iris-community
4+
FROM $IMAGE
5+
6+
WORKDIR /home/irisowner/dev
7+
COPY .iris_init /home/irisowner/.iris_init
8+
9+
RUN --mount=type=bind,src=.,dst=. \
10+
iris start IRIS && \
11+
iris session IRIS < iris.script && \
12+
iris stop IRIS quietly

‎dev.md

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# useful commands
2+
## clean up docker
3+
use it when docker says "There is no space left on device". It will remove built but not used images and other temporary files.
4+
```
5+
docker system prune -f
6+
```
7+
8+
```
9+
docker rm -f $(docker ps -qa)
10+
```
11+
12+
## build container with no cache
13+
```
14+
docker-compose build --no-cache --progress=plain
15+
```
16+
## start iris container
17+
```
18+
docker-compose up -d
19+
```
20+
21+
## open iris terminal in docker
22+
```
23+
docker exec iris iris session iris -U IRISAPP
24+
```
25+
26+
27+
## import objectscirpt code
28+
29+
do $System.OBJ.LoadDir("/home/irisowner/dev/src","ck",,1)
30+
## map iris key from Mac home directory to IRIS in container
31+
- ~/iris.key:/usr/irissys/mgr/iris.key
32+
33+
## install git in the docker image
34+
## add git in dockerfile
35+
USER root
36+
RUN apt update && apt-get -y install git
37+
38+
USER ${ISC_PACKAGE_MGRUSER}
39+
40+
41+
## install docker-compose
42+
```
43+
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
44+
45+
sudo chmod +x /usr/local/bin/docker-compose
46+
47+
```
48+
49+
## load and test module
50+
```
51+
52+
zpm "load /home/irisowner/dev"
53+
54+
zpm "test dc-sample"
55+
```
56+
57+
## select zpm test registry
58+
```
59+
repo -n registry -r -url https://test.pm.community.intersystems.com/registry/ -user test -pass PassWord42
60+
```
61+
62+
## get back to public zpm registry
63+
```
64+
repo -r -n registry -url https://pm.community.intersystems.com/ -user "" -pass ""
65+
```
66+
67+
## export a global in runtime into the repo
68+
```
69+
d $System.OBJ.Export("GlobalD.GBL","/irisrun/repo/src/gbl/GlobalD.xml")
70+
```
71+
72+
## create a web app in dockerfile
73+
```
74+
zn "%SYS" \
75+
write "Create web application ...",! \
76+
set webName = "/csp/irisweb" \
77+
set webProperties("NameSpace") = "IRISAPP" \
78+
set webProperties("Enabled") = 1 \
79+
set webProperties("CSPZENEnabled") = 1 \
80+
set webProperties("AutheEnabled") = 32 \
81+
set webProperties("iKnowEnabled") = 1 \
82+
set webProperties("DeepSeeEnabled") = 1 \
83+
set sc = ##class(Security.Applications).Create(webName, .webProperties) \
84+
write "Web application "_webName_" has been created!",!
85+
```
86+
87+
88+
89+
```
90+
do $SYSTEM.OBJ.ImportDir("/opt/irisbuild/src",, "ck")
91+
```
92+
93+
94+
### run tests described in the module
95+
96+
IRISAPP>zpm
97+
IRISAPP:zpm>load /irisrun/repo
98+
IRISAPP:zpm>test package-name
99+
100+
### install ZPM with one line
101+
// Install ZPM
102+
set $namespace="%SYS", name="DefaultSSL" do:'##class(Security.SSLConfigs).Exists(name) ##class(Security.SSLConfigs).Create(name) set url="https://pm.community.intersystems.com/packages/zpm/latest/installer" Do ##class(%Net.URLParser).Parse(url,.comp) set ht = ##class(%Net.HttpRequest).%New(), ht.Server = comp("host"), ht.Port = 443, ht.Https=1, ht.SSLConfiguration=name, st=ht.Get(comp("path")) quit:'st $System.Status.GetErrorText(st) set xml=##class(%File).TempFilename("xml"), tFile = ##class(%Stream.FileBinary).%New(), tFile.Filename = xml do tFile.CopyFromAndSave(ht.HttpResponse.Data) do ht.%Close(), $system.OBJ.Load(xml,"ck") do ##class(%File).Delete(xml)
103+
104+
105+
106+
107+
docker run --rm --name iris-sql -d -p 9091:1972 -p 9092:52773  -e IRIS_PASSWORD=demo -e IRIS_USERNAME=demo intersystemsdc/iris-community
108+
109+
110+
docker run --rm --name iris-ce -d -p 9091:1972 -p 9092:52773 -e IRIS_PASSWORD=demo -e IRIS_USERNAME=demo intersystemsdc/iris-community -a "echo 'zpm \"install webterminal\"' | iriscli"
111+
112+
113+
114+
docker run --rm --name iris-sql -d -p 9092:52773 containers.intersystems.com/intersystems/iris-community:2023.1.0.229.0
115+
116+
117+
docker run --rm --name iris-ce -d -p 9092:52773 containers.intersystems.com/intersystems/iris-community:2023.1.0.229.0

‎docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.6'
2+
services:
3+
iris:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
restart: always
8+
command: --check-caps false --ISCAgent false
9+
ports:
10+
- 41773:1972
11+
- 42773:52773
12+
volumes:
13+
- ./:/home/irisowner/dev

‎iris.script

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
zn "%SYS"
2+
3+
// Unexpire passwords and set up passwordless mode to simplify dev use.
4+
// ** Comment out these two line for Production use **
5+
do ##class(Security.Users).UnExpireUserPasswords("*")
6+
zpm "install passwordless"
7+
8+
zn "USER"
9+
10+
// Create /_vscode web app to support intersystems-community.testingmanager VS Code extension
11+
zpm "install vscode-per-namespace-settings"
12+
13+
zpm "load /home/irisowner/dev/ -v":1:1
14+
halt

0 commit comments

Comments
 (0)
Please sign in to comment.