generated from intersystems-community/objectscript-docker-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b5824ad
Showing
17 changed files
with
330 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/.DS_Store | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.sh text eol=lf | ||
*.cls text eol=lf | ||
*.mac text eol=lf | ||
*.int text eol=lf | ||
Dockerfil* text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: objectscriptquality | ||
on: push | ||
|
||
jobs: | ||
linux: | ||
name: Linux build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Execute ObjectScript Quality Analysis | ||
run: wget https://raw.githubusercontent.com/litesolutions/objectscriptquality-jenkins-integration/master/iris-community-hook.sh && sh ./iris-community-hook.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "objectscript", | ||
"request": "launch", | ||
"name": "ObjectScript Debug Class", | ||
"program": "##class(PackageSample.ObjectScript).Test()", | ||
}, | ||
{ | ||
"type": "objectscript", | ||
"request": "attach", | ||
"name": "ObjectScript Attach", | ||
"processId": "${command:PickProcess}", | ||
"system": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"files.associations": { | ||
|
||
"Dockerfile*": "dockerfile", | ||
"iris.script": "objectscript" | ||
}, | ||
"objectscript.conn" :{ | ||
"ns": "IRISAPP", | ||
"active": true, | ||
"username":"_SYSTEM", | ||
"password": "SYS", | ||
"docker-compose": { | ||
"service": "iris", | ||
"internalPort": 52773 | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ARG IMAGE=store/intersystems/iris-community:2020.1.0.204.0 | ||
ARG IMAGE=intersystemsdc/iris-community:2020.1.0.209.0-zpm | ||
ARG IMAGE=intersystemsdc/iris-community:2020.2.0.204.0-zpm | ||
ARG IMAGE=intersystemsdc/iris-community:2020.3.0.200.0-zpm | ||
ARG IMAGE=intersystemsdc/irishealth-community:2020.3.0.200.0-zpm | ||
FROM $IMAGE | ||
|
||
USER root | ||
|
||
WORKDIR /opt/irisapp | ||
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/irisapp | ||
USER ${ISC_PACKAGE_MGRUSER} | ||
|
||
COPY Installer.cls . | ||
COPY src src | ||
COPY iris.script /tmp/iris.script | ||
|
||
# run iris and initial | ||
RUN iris start IRIS \ | ||
&& iris session IRIS < /tmp/iris.script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
ARG IMAGE=intersystems/iris:2019.1.0S.111.0 | ||
ARG IMAGE=store/intersystems/irishealth:2019.3.0.308.0-community | ||
ARG IMAGE=store/intersystems/iris-community:2019.3.0.309.0 | ||
ARG IMAGE=store/intersystems/iris-community:2019.4.0.379.0 | ||
FROM $IMAGE | ||
|
||
USER root | ||
|
||
WORKDIR /opt/irisapp | ||
RUN chown ${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /opt/irisapp | ||
|
||
USER irisowner | ||
|
||
COPY Installer.cls . | ||
COPY src src | ||
COPY irissession.sh / | ||
SHELL ["/irissession.sh"] | ||
|
||
RUN \ | ||
do $SYSTEM.OBJ.Load("Installer.cls", "ck") \ | ||
set sc = ##class(App.Installer).setup() \ | ||
zn "%SYS" \ | ||
write "Create web application ...",! \ | ||
set webName = "/csp/irisweb" \ | ||
set webProperties("NameSpace") = "IRISAPP" \ | ||
set webProperties("Enabled") = 1 \ | ||
set webProperties("CSPZENEnabled") = 1 \ | ||
set webProperties("AutheEnabled") = 32 \ | ||
set webProperties("iKnowEnabled") = 1 \ | ||
set webProperties("DeepSeeEnabled") = 1 \ | ||
set sc = ##class(Security.Applications).Create(webName, .webProperties) \ | ||
write "Web application "_webName_" has been created!",! | ||
|
||
|
||
# bringing the standard shell back | ||
SHELL ["/bin/bash", "-c"] | ||
CMD [ "-l", "/usr/irissys/mgr/messages.log" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Class App.Installer | ||
{ | ||
|
||
XData setup | ||
{ | ||
<Manifest> | ||
<Default Name="SourceDir" Value="#{$system.Process.CurrentDirectory()}src"/> | ||
<Default Name="Namespace" Value="IRISAPP"/> | ||
<Default Name="app" Value="irisapp" /> | ||
|
||
<Namespace Name="${Namespace}" Code="${Namespace}" Data="${Namespace}" Create="yes" Ensemble="0"> | ||
|
||
<Configuration> | ||
<Database Name="${Namespace}" Dir="/opt/${app}/data" Create="yes" Resource="%DB_${Namespace}"/> | ||
</Configuration> | ||
<Import File="${SourceDir}" Flags="ck" Recurse="1"/> | ||
<CSPApplication Url="/csp/${app}" Directory="${cspdir}${app}" ServeFiles="1" Recurse="1" MatchRoles=":%DB_${Namespace}" AuthenticationMethods="32" | ||
|
||
/> | ||
</Namespace> | ||
|
||
</Manifest> | ||
} | ||
|
||
ClassMethod setup(ByRef pVars, pLogLevel As %Integer = 3, pInstaller As %Installer.Installer, pLogger As %Installer.AbstractLogger) As %Status [ CodeMode = objectgenerator, Internal ] | ||
{ | ||
#; Let XGL document generate code for this method. | ||
Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "setup") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 InterSystems Developer Community | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
## intersystems-objectscript-template | ||
This is a template for InterSystems ObjectScript Github repository. | ||
The template goes also with a few files which let you immedietly compile your ObjecScript files in InterSystems IRIS Community Edition in a docker container | ||
|
||
## Prerequisites | ||
Make sure you have [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [Docker desktop](https://www.docker.com/products/docker-desktop) installed. | ||
|
||
## Installation | ||
|
||
Clone/git pull the repo into any local directory | ||
|
||
``` | ||
$ git clone https://github.com/intersystems-community/objectscript-docker-template.git | ||
``` | ||
|
||
Open the terminal in this directory and run: | ||
|
||
``` | ||
$ docker-compose build | ||
``` | ||
|
||
3. Run the IRIS container with your project: | ||
|
||
``` | ||
$ docker-compose up -d | ||
``` | ||
|
||
## How to Test it | ||
|
||
Open IRIS terminal: | ||
|
||
``` | ||
$ docker-compose exec iris iris session iris | ||
USER>zn "IRISAPP" | ||
IRISAPP>write ##class(PackageSample.ObjectScript).Test() | ||
``` | ||
## How to start coding | ||
This repository is ready to code in VSCode with ObjectScript plugin. | ||
Install [VSCode](https://code.visualstudio.com/), [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) and [ObjectScript](https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript) plugin and open the folder in VSCode. | ||
Open /src/cls/PackageSample/ObjectScript.cls class and try to make changes - it will be compiled in running IRIS docker container. | ||
![docker_compose](https://user-images.githubusercontent.com/2781759/76656929-0f2e5700-6547-11ea-9cc9-486a5641c51d.gif) | ||
|
||
Feel free to delete PackageSample folder and place your ObjectScript classes in a form | ||
/src/Package/Classname.cls | ||
[Read more about folder setup for InterSystems ObjectScript](https://community.intersystems.com/post/simplified-objectscript-source-folder-structure-package-manager) | ||
|
||
The script in Installer.cls will import everything you place under /src into IRIS. | ||
|
||
|
||
## What's inside the repository | ||
|
||
### Dockerfile | ||
|
||
The simplest dockerfile which starts IRIS and imports Installer.cls and then runs the Installer.setup method, which creates IRISAPP Namespace and imports ObjectScript code from /src folder into it. | ||
Use the related docker-compose.yml to easily setup additional parametes like port number and where you map keys and host folders. | ||
Use .env/ file to adjust the dockerfile being used in docker-compose. | ||
|
||
### Dockerfile-zpm | ||
|
||
Dockerfile-zpm builds for you a container which contains ZPM package manager client so you are able to install packages from ZPM in this container. | ||
As an example of usage in installs webterminal | ||
|
||
### Dockerfile-web | ||
|
||
Dockerfile-web starts IRIS does the same what Dockerfile does and also sets up the web app programmatically | ||
|
||
|
||
### .vscode/settings.json | ||
|
||
Settings file to let you immedietly code in VSCode with [VSCode ObjectScript plugin](https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript)) | ||
|
||
### .vscode/launch.json | ||
Config file if you want to debug with VSCode ObjectScript | ||
|
||
[Read about all the files in this artilce](https://community.intersystems.com/post/dockerfile-and-friends-or-how-run-and-collaborate-objectscript-projects-intersystems-iris) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# useful commands | ||
## build container with no cache | ||
``` | ||
docker-compose build --no-cache | ||
``` | ||
## open terminal to docker | ||
``` | ||
docker-compose exec iris iris session iris -U IRISAPP | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: '3.6' | ||
services: | ||
iris: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
restart: always | ||
ports: | ||
- 51773 | ||
- 52773 | ||
- 53773 | ||
volumes: | ||
- ~/iris.key:/usr/irissys/mgr/iris.key | ||
- ./:/irisdev/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
; run installer to create namespace | ||
do $SYSTEM.OBJ.Load("/opt/irisapp/Installer.cls", "ck") | ||
set sc = ##class(App.Installer).setup() | ||
|
||
zn "%SYS" | ||
Do ##class(Security.Users).UnExpireUserPasswords("*") | ||
|
||
; call your initial methods here | ||
halt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache" version="25"> | ||
<Document name="objectscript-sample.ZPM"> | ||
<Module> | ||
<Name>objectscript-sample</Name> | ||
<Version>0.0.1</Version> | ||
<Packaging>module</Packaging> | ||
<SourcesRoot>src</SourcesRoot> | ||
<Resource Name="PackageSample.PKG"/> | ||
</Module> | ||
</Document> | ||
</Export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Class PackageSample.ObjectScript | ||
{ | ||
|
||
ClassMethod Test() As %Status | ||
{ | ||
set a=42 | ||
return "It works!" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Class PackageSample.PersistentClass Extends %Persistent | ||
{ | ||
|
||
Property Test As %VarString; | ||
|
||
ClassMethod CreateRecord() As %Status | ||
{ | ||
s objPC=..%New() | ||
s objPC.Test="Test string" | ||
return objPC.%Save() | ||
} | ||
|
||
Storage Default | ||
{ | ||
<Data name="PersistentClassDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Test</Value> | ||
</Value> | ||
</Data> | ||
<DataLocation>^PackageSample.PersistentClassD</DataLocation> | ||
<DefaultData>PersistentClassDefaultData</DefaultData> | ||
<IdLocation>^PackageSample.PersistentClassD</IdLocation> | ||
<IndexLocation>^PackageSample.PersistentClassI</IndexLocation> | ||
<StreamLocation>^PackageSample.PersistentClassS</StreamLocation> | ||
<Type>%Storage.Persistent</Type> | ||
} | ||
|
||
} |