Skip to content

Commit 9548d6f

Browse files
committed
Update documentation to include more accurate code
1 parent 72b7364 commit 9548d6f

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

pages/docs/user-docs/docs-instances.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ And now we need to define what happens when we start an instance of the containe
126126

127127
```
128128
%startscript
129-
cd /scif/apps/pdf_server/pdf_server
129+
cd /pdf_server
130130
# Use nohup and /dev/null to completely detach server process from terminal
131131
nohup npm start > /dev/null 2>&1 < /dev/null &
132132
```
@@ -135,10 +135,11 @@ Also, the `url-to-pdf-api` server requires some environment variables be set, wh
135135

136136
```
137137
%environment
138-
export NODE_ENV=development
139-
export PORT=8000
140-
export ALLOW_HTTP=true
141-
export URL=localhost
138+
NODE_ENV=development
139+
PORT=8000
140+
ALLOW_HTTP=true
141+
URL=localhost
142+
export NODE_ENV PORT ALLOW_HTTP URL
142143
```
143144

144145
Now we can build the definition file into an image! Simply run build and the image will be ready to go:
@@ -199,6 +200,15 @@ First off, we're going to move the installation of the `url-to-pdf-api` into an
199200
chmod -R 0755 .
200201
```
201202

203+
And update our `startscript` to point to the app location:
204+
205+
```
206+
%startscript
207+
cd "${APPROOT_pdf_server}/pdf_server"
208+
# Use nohup and /dev/null to completely detach server process from terminal
209+
nohup npm start > /dev/null 2>&1 < /dev/null &
210+
```
211+
202212
Now we want to define the pdf_client app, which we will run to send the requests to the server:
203213

204214
```
@@ -207,7 +217,7 @@ Now we want to define the pdf_client app, which we will run to send the requests
207217
echo "Usage: singularity run --app pdf <instance://name> <URL> [output file]"
208218
exit 1
209219
fi
210-
curl -o "/scif/data/pdf_client/output/${2:-output.pdf}" "${URL}:${PORT}/api/render?url=${1}"
220+
curl -o "${SINGULARITY_APPDATA}/output/${2:-output.pdf}" "${URL}:${PORT}/api/render?url=${1}"
211221
```
212222

213223
As you can see, the `pdf_client` app checks to make sure that the user provides at least one argument. Now that we have an output directory in the container, we need to expose it to the host using a bind mount. Once we've rebuilt the container, make a new directory callout `out` for the generated PDF's to go. Now we simply start the instance like so:

0 commit comments

Comments
 (0)