Skip to content

Commit 93bf69d

Browse files
authored
Merge pull request #1467 from SpiNNakerManchester/update-docker-config
Update docker config
2 parents 7a38bf9 + 059fde6 commit 93bf69d

13 files changed

Lines changed: 99 additions & 55 deletions

File tree

SpiNNaker-allocserv/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Use Ubuntu
1616
FROM ubuntu:noble
1717

18-
RUN apt update && apt install -y openjdk-21-jdk-headless maven git ping
18+
RUN apt update && apt install -y openjdk-21-jdk-headless maven git iputils-ping
1919

2020
# Set the working directory in the container
2121
WORKDIR /app

SpiNNaker-allocserv/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ docker logs -f spalloc-spring-container
2323
### Connecting to docker compose SQL server
2424
You can connect to the spalloc database with:
2525
```
26-
docker exec -it spalloc-mysql-container /usr/bin/mysql -D spalloc -u <SPRING_DATASOURCE_USERNAME> -p
26+
docker exec -it spalloc-mysql-container /usr/bin/mysql -D spalloc -u spalloc -pspalloc
2727
```
28-
replacing the value of ``<SPRING_DATASOURCE_USERNAME>`` with the username in the env file, and followed by entering the value of ``SPRING_DATASOURCE_PASSWORD`` when asked for a password.

SpiNNaker-allocserv/docker-compose.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,23 @@ services:
1616
spalloc-mysql-db:
1717
image: mysql:8.0
1818
container_name: spalloc-mysql-container
19-
env_file: spalloc.env
19+
environment:
20+
SPRING_DATASOURCE_USERNAME: spalloc
21+
SPRING_DATASOURCE_PASSWORD: spalloc
22+
MYSQL_ROOT_PASSWORD: spalloc-root
2023
healthcheck:
21-
test: ["CMD", "/usr/bin/mysql", "--database=spalloc_history", "--user=$$SPRING_DATASOURCE_USERNAME", "--password=$$SPRING_DATASOURCE_PASSWORD", "--execute", "SHOW DATABASES;"]
22-
interval: 2s
23-
timeout: 2s
24-
retries: 100
24+
test: ["CMD", "/usr/bin/mysql", "--database=spalloc_history", "--user=spalloc", "--password=spalloc", "--execute", "SHOW DATABASES;"]
25+
interval: 2s
26+
timeout: 2s
27+
retries: 100
2528
ports:
2629
- "3306:3306"
2730
networks:
2831
- spalloc-mysql
2932
volumes:
3033
- spalloc-mysql-data:/var/lib/mysql
3134
- ./spalloc-mysql/init:/docker-entrypoint-initdb.d
35+
restart: always
3236

3337
spalloc:
3438
build:
@@ -45,10 +49,13 @@ services:
4549
condition: service_healthy
4650
env_file: spalloc.env
4751
environment:
52+
SPRING_DATASOURCE_USERNAME: spalloc
53+
SPRING_DATASOURCE_PASSWORD: spalloc
4854
SPRING_DATASOURCE_URL: jdbc:mysql://spalloc-mysql-container:3306/spalloc?autoReconnect=true&useSSL=false
4955
SPRING_HISTORICAL_DATASOURCE_URL: jdbc:mysql://spalloc-mysql-container:3306/spalloc_history?autoReconnect=true&useSSL=false
5056
volumes:
5157
- ./application.yml:/app/application.yml
58+
restart: always
5259

5360
networks:
5461
spalloc-mysql:

SpiNNaker-allocserv/spalloc.env.example

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Root password for the MYSQL instance
16-
MYSQL_ROOT_PASSWORD=
17-
18-
# Username for the spalloc database
19-
SPRING_DATASOURCE_USERNAME=
20-
21-
# Password for the spalloc database
22-
SPRING_DATASOURCE_PASSWORD=
23-
2415
# OpenID client id from EBRAINS
25-
EBRAINS_OPENID_CLIENT_ID=
16+
EBRAINS_OPENID_CLIENT_ID=spalloc
2617

2718
# OpenID client secret from EBRAINS
2819
EBRAINS_OPENID_CLIENT_SECRET=
2920

3021
# The host that people will use to access spalloc
22+
# This is the host name of this machine as seen from outside
3123
SPRING_SERVER_HOST=
3224

3325
# The API Key to access NMPI services (quota etc.)
3426
SPALLOC_NMPI_API_KEY=
3527

3628
# The IP address that the proxy should use to speak to real machines
29+
# This is the IP address of the local machine on the SpiNNaker network (e.g. 10.11.192.X)
3730
SPALLOC_PROXY_LOCAL_HOST=

SpiNNaker-nmpiserv/Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@
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+
ENV DOCKER_GROUP_ID $DOCKER_GROUP_ID
20+
21+
RUN apt update && apt install -y openjdk-21-jdk-headless maven git libltdl7 nginx
22+
23+
COPY --chown=www-data nginx.conf /etc/nginx/nginx.conf
24+
25+
RUN groupadd -g $DOCKER_GROUP_ID docker
26+
RUN usermod -a -G docker www-data
1927

2028
# Set the working directory in the container
2129
WORKDIR /app
@@ -29,5 +37,7 @@ RUN mvn -f JavaSpiNNaker -DskipTests=true -pl SpiNNaker-nmpiserv -am package
2937
# Get the binary into place
3038
RUN cp JavaSpiNNaker/SpiNNaker-nmpiserv/target/SpiNNakerNMPI.war .
3139

40+
COPY --chmod=0755 startup.sh /app/startup.sh
41+
3242
# 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" ]
43+
CMD [ "/app/startup.sh" ]

SpiNNaker-nmpiserv/README.md

Lines changed: 8 additions & 9 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 up -d`` to start the services
1716

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

SpiNNaker-nmpiserv/docker-compose.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,20 @@ services:
1717
build:
1818
context: .
1919
dockerfile: Dockerfile
20+
args:
21+
DOCKER_GROUP_ID: ${DOCKER_GROUP_ID}
2022
container_name: nmpi-host
23+
env_file: .env
2124
ports:
2225
- "9090:9090"
2326
networks:
2427
- nmpi-network
2528
volumes:
2629
- ./nmpi.properties:/app/nmpi.properties
2730
- ./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
31+
- /var/run/docker.sock:/var/run/docker.sock
32+
- ${DATA_PATH}:/mnt/data/
3833

3934
networks:
4035
nmpi-network:
41-
name: nmpi-network
36+
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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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=

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+
}

0 commit comments

Comments
 (0)