Stream: shorthand
Topic: Running sushi + publisher in Docker
Josh Mandel (Aug 18 2020 at 16:39):
Is there already a docker container that I can volume-mount a local dir into and have sushi + IG Publisher both run and do their thing? (i.e., with Java + Jekyll/ruby + node all installed/configured?) I can make one, but figured I'd check here first.
Josh Mandel (Aug 19 2020 at 21:29):
OK, I put together a dev wrapper at https://github.com/FHIR/auto-ig-builder/tree/master/images/ig-publisher-base. Demo: coming...
Josh Mandel (Aug 19 2020 at 21:31):
Quick question: if I run _genonce.sh
before ig.ini exists, the publisher fails. I need to manually run sushi
first, and then _genonce.sh
succeeds. Is this expected?
Josh Mandel (Aug 19 2020 at 23:01):
OK, wrapped in docker for local dev:
$ git clone -b move-to-fsh https://github.com/hl7/smart-app-launch
$ cd smart-app-launch
$ docker run \
--rm -it \
-v $(pwd):/home/publisher/ig \
hl7fhir/ig-publisher-base
$ sushi # This shouldn't be necessary but currently it is, the first time
$ _updatePublisher.sh # If you haven't done it before
$ _genonce.sh
(@Dan Gottlieb would love to make sure this works for you; I don't have a good way to test on Mac OS.)
Dan Gottlieb (Aug 20 2020 at 14:19):
@Josh Mandel The image works great on Mac! Building the Bulk Data IG fails though, I think because of incompatibilities with the latest version of the publisher that I'll need to track down...
Chris Moesel (Aug 20 2020 at 18:11):
Quick question: if I run _genonce.sh before ig.ini exists, the publisher fails. I need to manually run sushi first, and then _genonce.sh succeeds. Is this expected?
Yeah, I think that's expected if you run it using _genonce.sh
. On the HL7 auto-build, it's not necessary because that runs the publisher with the -auto-ig-build
flag -- and Grahame does some special magic to accommodate the missing ig.ini
when that flag is used. If you updated the image to call the publisher directly (w/ -auto-ig-build
) it would work -- but I don't know if there are any additional undesirable side effects in that case.
Chris Moesel (Aug 20 2020 at 18:11):
Sorry, forgot to tag you, @Josh Mandel. Don't know if you follow this channel regularly.
Josh Mandel (Aug 20 2020 at 18:18):
Thanks Chris! I guess I'll leave this as-is for the moment, but it's good to know I can emulate the auto-build behavior if needed.
Grahame Grieve (Aug 20 2020 at 20:59):
there's several side effects from running it with the -auto-ig-build flag, and I certainly wouldn't want to see people do that regularly. But I don't understand this anyway - if the problem is with _genonce.sh, and you work around it by running the Ig publisher directly, you don't need the -auto-ig-build flag when you do that
Chris Moesel (Aug 20 2020 at 21:06):
The problem with _genonce.sh
is that it does not use the -auto-ig-build
flag. The workaround is to run the IG Publisher directly with the -auto-ig-build flag -- so if that's not a recommended approach for end-users, then there is no workaround except to run SUSHI before you run the publisher. OR to manually manage the ig.ini file instead of having SUSHI generate it (which, really, isn't that much of a lift).
Grahame Grieve (Aug 20 2020 at 21:14):
I don't understand then. Why is this required?
Chris Moesel (Aug 20 2020 at 21:38):
When run normally, the IG publisher expects an ig.ini
file at the root -- and checks for that first thing (before running SUSHI). But some FSH projects depend on SUSHI to generate the ig.ini
file -- so it won't be there when the IG Publisher checks for it. This causes a problem for those projects -- requiring them to run SUSHI manually first, and then run the IG Publisher (which happily finds the ig.ini
now and then runs SUSHI again).
Grahame Grieve (Aug 20 2020 at 22:59):
I don't see this. I take an existing guide, and delete everything except for the fsh directory, and run the publisher on it directly, and it all succeeds ok
Jose Costa Teixeira (Aug 21 2020 at 03:31):
If I understand well, the problem is that the _genOnce does not work when there is no ig.ini created.
Jose Costa Teixeira (Aug 21 2020 at 03:32):
if that is true, that is by design. _genOnce is not to setup a new IG (create ig.ini, etc). _genOnce is to build the IG.
Jose Costa Teixeira (Aug 21 2020 at 03:33):
I don't think we should mix the 2 modes of operation
- setup a new IG, (re)create the entire ig.ini etc
- update content like a page or an example
Jose Costa Teixeira (Aug 21 2020 at 03:36):
If my understanding of the challenge is correct, then I don't think this is a problem.
Jose Costa Teixeira (Aug 21 2020 at 03:38):
(i have suggested elsewhere to separate the activities of setting up an ig from sushi vs parsing fsh)
Grahame Grieve (Aug 21 2020 at 05:30):
why does _genOnce care about the ig.ini?
Jose Costa Teixeira (Aug 21 2020 at 05:52):
_genonce simply does java -jar -ig ig.ini
Jose Costa Teixeira (Aug 21 2020 at 05:53):
it cares that it exists, not the content
Grahame Grieve (Aug 21 2020 at 05:55):
why does it do that?
Grahame Grieve (Aug 21 2020 at 05:55):
it should do java -jar -ig .
Jose Costa Teixeira (Aug 21 2020 at 06:20):
i don't know if there's a reason. we can wait for Lloyd to confirm, if there was any. but perhaps we can change that.
Jose Costa Teixeira (Aug 21 2020 at 06:22):
i didn't know that -ig.ini . worked - it does. Will it cause any issues if we change it?
Jose Costa Teixeira (Aug 21 2020 at 06:23):
i.e. what could go wrong if we change it? Perhaps that would be an issue if someone had 2 ini files in the root folder (...why ever?).
Jose Costa Teixeira (Aug 21 2020 at 06:33):
@Grahame Grieve if you agree you can merge this PR
https://github.com/FHIR/sample-ig/pull/40
Grahame Grieve (Aug 21 2020 at 06:57):
merged. Can't be more than on functional ini file that matters
Chris Moesel (Aug 21 2020 at 11:42):
Thanks, @Grahame Grieve and @Jose Costa Teixeira -- and my apologies for misunderstanding who is requiring what where and when!
Josh Mandel (Aug 21 2020 at 12:10):
Awesome! And in the process I learned where sushi sources these _gen*.sh scripts from ;-)
Lloyd McKenzie (Aug 23 2020 at 18:01):
The ig.ini points to the ig. The ig.ini is in a predictable place with a predictable name. The ig is not. We don't want the .bat files changing from project to project.
Grahame Grieve (Aug 23 2020 at 21:11):
I don't understand that comment but the ig.ini has turned out not to be a predictable place
Lloyd McKenzie (Aug 24 2020 at 03:29):
The publisher requires the ig.ini to be in the root folder, no?
Elliot Silver (Sep 01 2020 at 19:47):
Did this end up resulting in a change? For a clean build of a FSH IG, are the required steps still run sushi before running _genonce (which runs sushi again)? Is there an option I can pass to _genonce to supress running sushi the second time?
Jean Duteau (Sep 01 2020 at 19:50):
_genonce isn't running sushi. The IG publisher finds a fsh folder and then runs sushi. you don't have to run sushi the first time if you provide an ig.ini in the root directory that points to the ig and defines the template to use.
Elliot Silver (Sep 01 2020 at 19:52):
Right, should have been clearer. Is there an option I can pass to _genonce that will get passed on to the publisher to suppress the publisher from running sushi the second time?
Jean Duteau (Sep 01 2020 at 19:52):
don't name your fsh folder "fsh". i'm pretty sure that's how the ig publisher detects that sushi should run
Jean Duteau (Sep 01 2020 at 19:55):
i think that the easiest option for now is to create/check in the ig.ini file so that it is there from the beginning. then you don't have to run sushi the first time.
Jean Duteau (Sep 01 2020 at 19:56):
so your source repository would have the bat/sh scripts, the fsh directory, and the ig.ini file
Elliot Silver (Sep 01 2020 at 19:56):
hmm, just found a -no-sushi parameter for the publisher.
Jean Duteau (Sep 01 2020 at 19:56):
really? cool!
Elliot Silver (Sep 01 2020 at 19:58):
Yay! It works:
./_genonce.sh -no-sushi
Larry Shields (Apr 06 2021 at 19:16):
Thank you for this image @Josh Mandel . This really helps to get an environment ready to build FSH items within a Container using Dev Containers in VSCode.
Josh Mandel (Apr 06 2021 at 19:28):
Sure thing! I haven't don't much (anything) to keep it up to date, so let me know if there are any issues! (Or better yet, propose a fix in a PR ;-))
Brian Kaney (Jun 11 2021 at 22:42):
Here is that docker image I shared at DevDays (I added a wrapper script called nori
) - https://github.com/Vermonster/shorthand-docker
It has all the requirements to run sushi and IG Publisher. The idea is to help local development for people who don't want to install all the system requirements, but the image could also be used as a basis for CI/CD.
Matt Rouhana (Nov 16 2021 at 17:22):
@Josh Mandel - the ig-publisher-base image seems to be exhibiting strange behavior. It doesn't actually update SUSHI until the ENTRYPOINT
, so trying to build on top of the image and RUN sushi .
during the build results in an older version of SUSHI being used:
docker run --rm -it hl7fhir/ig-publisher-base:latest
. . .
publisher@92e879a8d4da:~/ig$ sushi --version
SUSHI v2.2.0 (implements FHIR Shorthand specification v1.2.0)
vs
docker build -t new-ig .
[+] Building 11.3s (12/15)
. . .
=> [ig-publisher 1/7] FROM docker.io/hl7fhir/ig-publisher-base:lates 0.0s
=> CACHED [ig-publisher 2/7] WORKDIR /home/publisher/ig 0.0s
=> CACHED [ig-publisher 3/7] COPY src/. . 0.0s
=> ERROR [ig-publisher 5/7] RUN sushi . 8.8s
------
> [ig-publisher 5/7] RUN sushi .:
#12 2.000 info Running SUSHI v2.0.1 (implements FHIR Shorthand specification v1.2.0)
Last updated: Apr 12 2022 at 19:14 UTC