Skip to content

Commit 25d4d02

Browse files
committed
Update to work better
1 parent 771e463 commit 25d4d02

8 files changed

Lines changed: 86 additions & 30 deletions

File tree

SpiNNaker-nmpiserv/Dockerfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@
1515
# Use Ubuntu
1616
FROM ubuntu:noble
1717

18-
RUN apt update && apt install -y openjdk-21-jdk-headless maven git libltdl7
18+
ARG DOCKER_GROUP_ID
19+
ARG USER_ID
20+
ENV DOCKER_GROUP_ID $DOCKER_GROUP_ID
21+
ENV USER_ID $USER_ID
22+
23+
RUN apt update && apt install -y openjdk-21-jdk-headless maven git libltdl7 nginx
24+
25+
COPY --chown=www-data nginx.conf /etc/nginx/nginx.conf
26+
27+
RUN groupadd -g $DOCKER_GROUP_ID docker
28+
RUN usermod -a -G docker www-data
1929

2030
# Set the working directory in the container
2131
WORKDIR /app
@@ -29,5 +39,7 @@ RUN mvn -f JavaSpiNNaker -DskipTests=true -pl SpiNNaker-nmpiserv -am package
2939
# Get the binary into place
3040
RUN cp JavaSpiNNaker/SpiNNaker-nmpiserv/target/SpiNNakerNMPI.war .
3141

42+
COPY --chmod=0755 startup.sh /app/startup.sh
43+
3244
# Specify the command to start things
33-
CMD [ "java", "-Djava.net.preferIPv4Stack=true", "-Djava.awt.headless=true", "-jar", "SpiNNakerNMPI.war", "--spring.config.location=/app/nmpi.properties", "-" , "--server.port=9090" ]
45+
CMD [ "/app/startup.sh" ]

SpiNNaker-nmpiserv/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ This is a [Spring Boot](https://spring.io/projects/spring-boot) web application.
77
## Usage
88
This folder contains configuration which can be used to set up a docker compose instance of the service. To use this, do the following:
99

10-
1. Copy files ``application.properties.example``, ``Dockerfile``, ``docker-compose.yml``. ``nginx.conf`` and ``execute_pynn.bash`` to your deployment folder.
11-
2. Rename ``application.properties.example`` to ``application.properties``
12-
3. Update ``application.properties`` with valid values for your environment, particularly replacing items in angle brackets.
13-
4. Update ``docker-compose.yml`` with valid values for your environment,
14-
particularly replacing items in angle brackets.
15-
4. Run ``docker compose build`` to build the docker environment
16-
5. Run ``docker compose start -d`` to start the services
10+
1. Copy files ``nmpi.properties.example``, ``Dockerfile``, ``docker-compose.yml``, ``nginx.conf``, ``startup.sh``, ``env.example`` and ``execute_pynn.bash`` to your deployment folder.
11+
2. Rename ``nmpi.properties.example`` to ``nmpi.properties``
12+
3. Rename ``env.example`` to ``.env``
13+
4. Update ``.env`` with valid values for your environment
14+
5. Run ``docker compose build`` to build the docker environment
15+
6. Run ``docker compose start -d`` to start the services
1716

1817
### Viewing logs
1918
You can view the logs of the spalloc server with:
2019
```
21-
docker logs -f nmpi-host
20+
docker compose logs -f nmpi
2221
```

SpiNNaker-nmpiserv/docker-compose.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,21 @@ services:
1717
build:
1818
context: .
1919
dockerfile: Dockerfile
20+
args:
21+
DOCKER_GROUP_ID: ${DOCKER_GROUP_ID}
22+
USER_ID: ${USER_ID}
2023
container_name: nmpi-host
24+
env_file: .env
2125
ports:
2226
- "9090:9090"
2327
networks:
2428
- nmpi-network
2529
volumes:
2630
- ./nmpi.properties:/app/nmpi.properties
2731
- ./execute_pynn.bash:/app/execute_pynn.bash
28-
- <DATA_PATH>:/mnt/data/
29-
30-
nginx:
31-
image: nginx
32-
container_name: nmpi-nginx
33-
networks:
34-
- nmpi-network
35-
volumes:
36-
- <DOCKER_SOCK_PATH>/docker.sock:/docker.sock
37-
- ./nginx.conf:/etc/nginx/nginx.conf
32+
- /var/run/docker.sock:/var/run/docker.sock
33+
- $DATA_PATH:/mnt/data/
3834

3935
networks:
4036
nmpi-network:
41-
name: nmpi-network
37+
name: nmpi-network

SpiNNaker-nmpiserv/docker_image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN apt-get update --yes && \
3434
gcc \
3535
lsof \
3636
gcc-arm-none-eabi \
37-
openjdk-17-jdk \
37+
openjdk-21-jdk \
3838
maven \
3939
ffmpeg \
4040
curl \

SpiNNaker-nmpiserv/env.example

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) 2025 The University of Manchester
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# OpenID client id from EBRAINS
16+
EBRAINS_OPENID_CLIENT_ID=spalloc
17+
18+
# OpenID client secret from EBRAINS
19+
EBRAINS_OPENID_CLIENT_SECRET=
20+
21+
# The host that people will use to access the NMPI server
22+
# This is the host name of this machine as seen from outside
23+
NMPI_SERVER_HOST=
24+
25+
# The API Key to access NMPI services
26+
NMPI_API_KEY=
27+
28+
# The IP address or URL that should use to speak to the spalloc server
29+
SPALLOC_SERVER_URL=
30+
31+
# The path to where complete data files should be stored
32+
DATA_PATH=
33+
34+
# The Group ID of the docker user (found from "getent group docker")
35+
DOCKER_GROUP_ID=
36+
37+
# The User ID of the current user (found from "id" as the current user)
38+
USER_ID=

SpiNNaker-nmpiserv/nginx.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ http {
7070
# Virtual Host Configs
7171
##
7272
upstream docker {
73-
server unix:/docker.sock;
73+
server unix:/var/run/docker.sock;
7474
}
7575

7676
server {
@@ -81,4 +81,4 @@ http {
8181
proxy_pass http://docker/;
8282
}
8383
}
84-
}
84+
}

SpiNNaker-nmpiserv/application.properties.example renamed to SpiNNaker-nmpiserv/nmpi.properties.example

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,40 @@
1515
spalloc.enabled = True
1616
spalloc.use_java = False
1717
spalloc.port = 22244
18-
spalloc.server = <SPALLOC_SERVER_HOST>
18+
spalloc.server = ${SPALLOC_SERVER_URL}
1919
spalloc.user.name = NMPI
2020
nmpi.compat = False
2121
nmpi.url = https://nmpi-v3.hbpneuromorphic.eu/
22-
nmpi.apiKey =
22+
nmpi.apiKey = ${NMPI_API_KEY}
2323
nmpi.hardware = SpiNNaker
2424
results.directory = /mnt/data/nmpi-outputs
25-
baseserver.url = https://<SPALLOC_SERVER_HOST>
25+
baseserver.url = https://${NMPI_SERVER_HOST}
2626
localbaseserver.url = http://nmpi:9090
2727
cxf.path = /services
2828
cxf.rest.path = /rest
2929
callback.path = /callback
3030
deleteJobsOnExit = true
3131
liveUploadOutput = true
3232
requestSpiNNakerMachine = false
33-
oidc.clientId = <EBRAINS_OPENID_CLIENT_ID>
34-
oidc.secret = <EBRAINS_OPENID_CLIENT_SECRET>
33+
oidc.clientId = ${EBRAINS_OPENID_CLIENT_ID}
34+
oidc.secret = ${EBRAINS_OPENID_CLIENT_SECRET}
3535
oidc.discovery.uri = https://services.humanbrainproject.eu/oidc/.well-known/openid-configuration
3636
collab.service.uri = https://services.humanbrainproject.eu/
3737
document.service.uri = https://services.humanbrainproject.eu/
3838
results.purge.days = 100
3939
docker.enabled = true
4040
docker.image = nmpiexec
41-
docker.uri = http://nginx/
41+
docker.uri = http://localhost/
4242
docker.networkName = nmpi-network
4343
docker.maxVms = 10
4444
xen.server.enabled = false
4545
restartJobExecutorOnFailure = false
4646
setupScript = file:/app/execute_pynn.bash
4747
status.update = false
48+
status.update.type = STATUS_CAKE
49+
icinga2.url = https://hbpmonitor.bsc.es:5665/
50+
icinga2.service = UMAN-NMC-spinnaker!NMC-RemoteSpiNNaker-Push
51+
icinga2.username = uman
52+
icinga2.password =
53+
statusCake.primaryKey =
54+
statusCake.testID =

SpiNNaker-nmpiserv/startup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
service nginx start
3+
java -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -jar /app/SpiNNakerNMPI.war --spring.config.location=/app/nmpi.properties - --server.port=9090
4+
service nginx stop

0 commit comments

Comments
 (0)