Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
henryhamon authored Jul 11, 2024
0 parents commit de42d85
Show file tree
Hide file tree
Showing 27 changed files with 937 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.224.2/containers/docker-existing-docker-compose
{
"name": "intersystems-iris-dev-template devcontainer",

// Use the same recipe as creates the container we use when working locally.
"dockerComposeFile": [
"../docker-compose.yml"
],

"service": "iris",

"workspaceFolder": "/home/irisowner/dev",

// This provides the elements of the connection object which require different values when connecting to the workspace within the container,
// versus those in .vscode/settings.json which apply when operating locally on the workspace files.
// We define and use a `server` so that (a) a user-level `objectscript.conn.server` properly doesn't override us, and (b) so InterSystems
// Server Manager can also be used.
"settings": {
"objectscript.conn" :{
"server": "devcontainer",
"active": true,
},
"intersystems.servers": {
"devcontainer": {
"username": "SuperUser",
"password": "SYS",
"webServer": {
"scheme": "http",
"host": "127.0.0.1",
"port": 52773
},
},
},
"python.defaultInterpreterPath":"/usr/irissys/bin/irispython"
},

// Add the IDs of extensions we want installed when the container is created.
// Currently (March 2022) `intersystems.language-server` fails to run within the container (alpine platform).
// Issue is probably https://github.com/intersystems/language-server/issues/185 and/or https://github.com/intersystems/language-server/issues/32
// Crash gets reported to the user, after which `intersystems-community.vscode-objectscript` falls back to
// using its TextMate grammar for code coloring.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"intersystems-community.vscode-objectscript",
"intersystems.language-server",
"intersystems-community.servermanager",
"ms-vscode.docker"
],
}
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/.DS_Store
iris-main.log
.git
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.cls linguist-language=ObjectScript
*.mac linguist-language=ObjectScript
*.int linguist-language=ObjectScript
*.inc linguist-language=ObjectScript
*.csp linguist-language=Html

*.sh text eol=lf
*.cls text eol=lf
*.mac text eol=lf
*.int text eol=lf
Dockerfil* text eol=lf
19 changes: 19 additions & 0 deletions .github/workflows/build-push-gcr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Cloud Run Deploy

on:
push:
branches:
- master
- main
workflow_dispatch:

jobs:
deploy:
uses: intersystems-community/demo-deployment/.github/workflows/deployment.yml@master
with:
# Replace the name: parameter below to have your application deployed at
# https://project-name.demo.community.intersystems.com/
name: project-name
secrets:
# Do not forget to add Secret in GitHub Repoository Settings with name SERVICE_ACCOUNT_KEY
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
28 changes: 28 additions & 0 deletions .github/workflows/bump-module-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: versionbump

on:
push:
branches:
- master
- main
release:
types:
- released
permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Bump version
run: |
git config --global user.name 'ProjectBot'
git config --global user.email '[email protected]'
VERSION=$(sed -n '0,/.*<Version>\(.*\)<\/Version>.*/s//\1/p' module.xml)
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
sed -i "0,/<Version>\(.*\)<\/Version>/s//<Version>$VERSION<\/Version>/" module.xml
git add module.xml
git commit -m 'auto bump version'
git push
25 changes: 25 additions & 0 deletions .github/workflows/github-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build and publish a Docker image to ghcr.io
on:

# publish on pushes to the main branch (image tagged as "latest")
# image name: will be: ghcr.io/${{ github.repository }}:latest
# e.g.: ghcr.io/intersystems-community/intersystems-iris-dev-template:latest
push:
branches:
- master

jobs:
docker_publish:
runs-on: "ubuntu-20.04"

steps:
- uses: actions/checkout@v2

# https://github.com/marketplace/actions/push-to-ghcr
- name: Build and publish a Docker image for ${{ github.repository }}
uses: macbre/push-to-ghcr@master
with:
image_name: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# optionally push to the Docker Hub (docker.io)
# docker_io_token: ${{ secrets.DOCKER_IO_ACCESS_TOKEN }} # see https://hub.docker.com/settings/security
12 changes: 12 additions & 0 deletions .github/workflows/objectscript-quality.yml
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

28 changes: 28 additions & 0 deletions .github/workflows/runtests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: unittest

on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
release:
types:
- released

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and Test
uses: docker/build-push-action@v2
with:
context: .
push: false
load: true
tags: ${{ github.repository }}:${{ github.sha }}
build-args: TESTS=1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
iris-main.log
.env
.git

6 changes: 6 additions & 0 deletions .iris_init
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:alias enablebi do EnableDeepSee^%SYS.cspServer("/csp/"_$zcvt($namespace,"L")) ;
: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)" ;
:alias createdb do $SYSTEM.SQL.Execute("CREATE DATABASE $1") ;
: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") ;
:alias add%all x "n $namespace set $namespace=""%SYS"",P(""Globals"")=""%DEFAULTDB"",sc=##class(Config.Namespaces).Create(""%All"",.P)" ;
:alias exportglobal d $System.OBJ.Export("$1.GBL","$2$1.xml") ;
17 changes: 17 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"recommendations": [
"eamodio.gitlens",
"georgejames.gjlocate",
"github.copilot",
"intersystems-community.servermanager",
"intersystems-community.sqltools-intersystems-driver",
"intersystems-community.testingmanager",
"intersystems-community.vscode-objectscript",
"intersystems.language-server",
"mohsen1.prettify-json",
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode-remote.remote-containers"
]
}
18 changes: 18 additions & 0 deletions .vscode/launch.json
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(dc.sample.ObjectScript).Test()",
},
{
"type": "objectscript",
"request": "attach",
"name": "ObjectScript Attach",
"processId": "${command:PickProcess}",
"system": true
}
]
}
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"files.associations": {

"Dockerfile*": "dockerfile",
"iris.script": "objectscript"
},
"objectscript.conn" :{
"active": true,
"ns": "IRISAPP",
"username": "_SYSTEM",
"password": "SYS",
"docker-compose": {
"service": "iris",
"internalPort": 52773
},
"links": {
"UnitTest Portal": "${serverUrl}/csp/sys/%25UnitTest.Portal.Home.cls?$NAMESPACE=IRISAPP"
}
},
"intersystems.testingManager.client.relativeTestRoot": "tests"

}
28 changes: 28 additions & 0 deletions App.Installer.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// an example of Installer class just to create a new clear namespace and database IRISAPP
Class App.Installer
{

XData setup
{
<Manifest>
<Default Name="Namespace" Value="IRISAPP"/>
<Default Name="database" Value="irisapp"/>

<Namespace Name="${Namespace}" Code="${Namespace}-CODE" Data="${Namespace}-DATA" Create="yes" Ensemble="1">
<Configuration>
<Database Name="${Namespace}-DATA" Dir="${mgrdir}${database}/data" Create="yes" Resource="%DB_${Namespace}-DATA"/>
<Database Name="${Namespace}-CODE" Dir="${mgrdir}${database}/code" Create="yes" Resource="%DB_${Namespace}-CODE"/>
</Configuration>
<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")
}

}
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ARG IMAGE=intersystemsdc/irishealth-community:2020.3.0.200.0-zpm
ARG IMAGE=intersystemsdc/iris-community:2020.4.0.547.0-zpm
ARG IMAGE=containers.intersystems.com/intersystems/iris:2021.1.0.215.0
ARG IMAGE=intersystemsdc/irishealth-community
ARG IMAGE=intersystemsdc/iris-community
ARG IMAGE=intersystemsdc/iris-community:preview
FROM $IMAGE as builder

WORKDIR /home/irisowner/dev

## install git
## USER root
##RUN apt update && apt-get -y install git
##USER ${ISC_PACKAGE_MGRUSER}

ARG TESTS=0
ARG MODULE="dc-sample"
ARG NAMESPACE="IRISAPP"

## Embedded Python environment
ENV IRISUSERNAME "_SYSTEM"
ENV IRISPASSWORD "SYS"
ENV IRISNAMESPACE $NAMESPACE
ENV PYTHON_PATH=/usr/irissys/bin/
ENV PATH "/usr/irissys/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/irisowner/bin"

COPY .iris_init /home/irisowner/.iris_init

RUN --mount=type=bind,src=.,dst=. \
pip3 install -r requirements.txt && \
iris start IRIS && \
iris session IRIS < iris.script && \
([ $TESTS -eq 0 ] || iris session iris -U $NAMESPACE "##class(%ZPM.PackageManager).Shell(\"test $MODULE -v -only\",1,1)") && \
iris stop IRIS quietly


FROM $IMAGE as final
ADD --chown=${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} https://github.com/grongierisc/iris-docker-multi-stage-script/releases/latest/download/copy-data.py /home/irisowner/dev/copy-data.py
#ADD https://github.com/grongierisc/iris-docker-multi-stage-script/releases/latest/download/copy-data.py /home/irisowner/dev/copy-data.py

RUN --mount=type=bind,source=/,target=/builder/root,from=builder \
cp -f /builder/root/usr/irissys/iris.cpf /usr/irissys/iris.cpf && \
python3 /home/irisowner/dev/copy-data.py -c /usr/irissys/iris.cpf -d /builder/root/
12 changes: 12 additions & 0 deletions Dockerfile_mini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The most minimumalistic dockerfile possible.
# No embedded python support, no unit-testing, no aliases.
ARG IMAGE=intersystemsdc/irishealth-community
ARG IMAGE=intersystemsdc/iris-community
FROM $IMAGE

WORKDIR /home/irisowner/dev

RUN --mount=type=bind,src=.,dst=. \
iris start IRIS && \
iris session IRIS < iris.script && \
iris stop IRIS quietly
21 changes: 21 additions & 0 deletions LICENSE
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.
Loading

0 comments on commit de42d85

Please sign in to comment.