Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ workspace/

*.r
src/out.log
client.log
**/.DS_Store
docker/._*

Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# HttpClientForOpenEdge
Http client for OpenEdge with ABL and Dotnet implementations.

# Install / Get started

Build image (in `docker` dir)
`build-image.sh`
This creates a symbolic link in `/etc/ssl/certs` to `/usr/bin/certs/84736cea.0`, so also .NET has access to this certificate after the container has run (see below)

Start Caddy webservice with petstore (in `petstore-local` dir)
`start-caddy.sh`
This also extracts the caddy ssl certificate and stores it as: `src/certs/84736cea.0`
Creates the `appnet` network
Swagger is now available on: http://localhost:8080/

Run docker container for the first time (in `docker` dir)
`run-tty.sh`
This copies the certificates to the `/usr/dlc/certs` dir which is also linked to `/etc/ssl/certs` dir for .NET
It attaches to the `appnet` network

Or when the container already exits (in `docker` dir)
`start-tty.sh`
6 changes: 6 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ USER root

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && update-ca-certificates

# also install 'curl' to test network connections
RUN apt-get update && apt-get install -y curl

# already create a symbolic link for the caddy certificate
RUN ln -s /usr/dlc/certs/84736cea.0 /etc/ssl/certs/84736cea.0

USER openedge
6 changes: 3 additions & 3 deletions docker/build-image.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
@echo off

IMAGE=flusso/http-client-pug-image
image=flusso/http-client-pug-image

docker build --rm --platform linux/amd64 -t %IMAGE% .
docker build --rm --platform linux/amd64 -t %image% .
29 changes: 15 additions & 14 deletions docker/run-tty.bat
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
@ECHO OFF
@echo off

set IMAGE=flusso/http-client-pug-image
set CONTAINER=http-client-pug-container
set image=flusso/http-client-pug-image
set container=http-client-pug-container

echo "Stop container %CONTAINER% ..."
docker stop %CONTAINER%
echo "Stop container %container% ..."
docker stop %container%

echo "Remove container %CONTAINER% ..."
docker rm %CONTAINER%
echo "Remove container %container% ..."
docker rm %container%

echo "Run new container (interactive) ..."
docker run -it ^
--name %CONTAINER% ^
--name %container% ^
--network appnet ^
--platform linux/amd64 ^
-v %CD%/../license/progress.cfg:/usr/dlc/progress.cfg ^
-v %CD%/../src:/app/src ^
-v %CD%/../assemblies:/app/assemblies ^
-v %CD%/../config:/app/config ^
%IMAGE% ^
bash
-v %cd%/../license/progress.cfg:/usr/dlc/progress.cfg ^
-v %cd%/../src:/app/src ^
-v %cd%/../assemblies:/app/assemblies ^
-v %cd%/../config:/app/config ^
%image% ^
bash -c "cp -p /app/src/certs/* /usr/dlc/certs/ && exec bash"
3 changes: 2 additions & 1 deletion docker/run-tty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ docker rm ${container}
echo "Run new container (interactive) ..."
docker run -it \
--name ${container} \
--network appnet \
--platform linux/amd64 \
-v $(pwd)/../license/progress.cfg:/usr/dlc/progress.cfg \
-v $(pwd)/../src:/app/src \
-v $(pwd)/../assemblies:/app/assemblies \
-v $(pwd)/../config:/app/config \
${image} \
bash
bash -c "cp -p /app/src/certs/* /usr/dlc/certs/ && exec bash"
6 changes: 3 additions & 3 deletions docker/start-tty.bat
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@ECHO OFF
@echo off

set CONTAINER=http-client-pug-container
set container=http-client-pug-container

echo "Start container (interactive) ..."

docker ps

echo

docker start -i %CONTAINER%
docker start -i %container%
18 changes: 18 additions & 0 deletions petstore-local/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
https://localhost:8443 {
tls internal # Caddy maakt automatisch een lokaal (self-signed) cert
encode gzip # (optioneel) compressie
reverse_proxy petstore:8080
}

https://caddy:8443 {
tls internal # Caddy maakt automatisch een lokaal (self-signed) cert
encode gzip # (optioneel) compressie
reverse_proxy petstore:8080
}

# voor Parallels windows
https://caddy.lan:8443 {
tls internal # Caddy maakt automatisch een lokaal (self-signed) cert
encode gzip # (optioneel) compressie
reverse_proxy petstore:8080
}
29 changes: 29 additions & 0 deletions petstore-local/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
services:
petstore:
image: swaggerapi/petstore
container_name: petstore
# (optioneel) ook via HTTP direct testen:
ports:
- "8080:8080"
networks: [appnet]

caddy:
image: caddy:2-alpine
container_name: caddy
depends_on:
- petstore # niet wachten op 'healthy'
ports:
- "8443:8443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
networks: [appnet]

volumes:
caddy_data:
caddy_config:

networks:
appnet:
name: appnet
31 changes: 31 additions & 0 deletions petstore-local/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Valideer je compose-bestand vóór je start:
docker compose config

Docker draaien (detached mode):
docker compose up -d

Met recreate:
docker-compose up -d --force-recreate caddy

Docker kijken of alles draait:
docker compose ps

Docker down brengen:
docker compose down --remove-orphans

Testen:
Swagger interface:
http://localhost:8080/

HTTP GET:
curl -X 'GET' http://localhost:8080/api/store/inventory

HTTPS GET:
Server certificate ophalen:
docker exec caddy sh -c 'cat /data/caddy/pki/authorities/local/root.crt' > caddy-root.crt
Certificate meegeven (of anders in cert store opslaan)
curl -X 'GET' --cacert caddy-root.crt https://localhost:8443/api/store/inventory

==============

Meer over certificaten, zie mail d.d. 17-04-2025: OpenEdge HttpClient certificates
8 changes: 8 additions & 0 deletions petstore-local/start-caddy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off

docker compose up -d

# download the certificate
docker exec caddy sh -c 'cat /data/caddy/pki/authorities/local/root.crt' > ..\src\certs\84736cea.0

dir ..\src\certs\84736cea.0
8 changes: 8 additions & 0 deletions petstore-local/start-caddy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

docker compose up -d

# download the certificate
docker exec caddy sh -c 'cat /data/caddy/pki/authorities/local/root.crt' > ../src/certs/84736cea.0

ls -l ../src/certs/84736cea.0
3 changes: 3 additions & 0 deletions petstore-local/stop-caddy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

docker compose down
3 changes: 3 additions & 0 deletions petstore-local/stop-caddy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

docker compose down
11 changes: 11 additions & 0 deletions src/certs/84736cea.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----BEGIN CERTIFICATE-----
MIIBozCCAUqgAwIBAgIRAMC/AkerJ7H+V5tcLaxOvGswCgYIKoZIzj0EAwIwMDEu
MCwGA1UEAxMlQ2FkZHkgTG9jYWwgQXV0aG9yaXR5IC0gMjAyNSBFQ0MgUm9vdDAe
Fw0yNTA5MjQwNzE0MzJaFw0zNTA4MDMwNzE0MzJaMDAxLjAsBgNVBAMTJUNhZGR5
IExvY2FsIEF1dGhvcml0eSAtIDIwMjUgRUNDIFJvb3QwWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAATUSTVg6M1nfxUmuErrTv8rKZ7oS01L8G+LjIVrg61i+vEXllep
vculRhdLzSohXGE/DqBaxN4ZF+OFPLJ0Z8I/o0UwQzAOBgNVHQ8BAf8EBAMCAQYw
EgYDVR0TAQH/BAgwBgEB/wIBATAdBgNVHQ4EFgQUDCW1ayuZUKsLp8TXM8UDvqI+
0YswCgYIKoZIzj0EAwIDRwAwRAIgAJhJ/Fy+nYbVrWExWsVVkUqYeYBKYr8CdbMQ
8p4LXf4CIHrMe8ncC8YT2yAl21getuMOdy8p/1jYfp4moC4L9YBu
-----END CERTIFICATE-----
11 changes: 11 additions & 0 deletions src/create-pets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

export PROPATH=../bin,.,/usr/dlc/tty/netlib/OpenEdge.Net.apl,../config

rm -f out.log
touch out.log

# -preloadCLR fails on Linux
mbpro -pf demo.pf clrnetcore -assemblies ../assemblies -q -rr -reusableObjects 500000 -p flusso/demo/createPets.p -param "$1" > out.log

tail -f out.log
2 changes: 1 addition & 1 deletion src/demo.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ setlocal

set PROPATH=.,%DLC%\tty\netlib\OpenEdge.Net.apl

call mbpro -clrnetcore -p flusso\demo\demo.p -basekey "INI" -ininame "win.ini" -param "%1,%2"
call mbpro -pf demo.pf -basekey "INI" -ininame "win.ini" -param "%1,%2"
6 changes: 6 additions & 0 deletions src/demo.pf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-clrnetcore
-assemblies ../assemblies
-q
-rr
-reusableObjects 500000
-p flusso/demo/demo.p
5 changes: 1 addition & 4 deletions src/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ export PROPATH=../bin,.,/usr/dlc/tty/netlib/OpenEdge.Net.apl,../config
rm -f out.log
touch out.log

# copy certificates to DLC folder, since -certstorepath can only contain 1 path
cp -p certs/* /usr/dlc/certs

# -preloadCLR fails on Linux
mbpro -clrnetcore -assemblies ../assemblies -q -rr -reusableObjects 500000 -p flusso/demo/demo.p -param "$1,$2" > out.log
mbpro -pf demo.pf -param "$1,$2" > out.log

tail -f out.log

Loading