Skip to content

Commit 4342d3a

Browse files
committed
BF: Makefile should better support Linux (simulator)
1 parent da53e16 commit 4342d3a

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818
###########################################################################
1919
#___INFO__MARK_END_NEW__
2020

21-
# This Makefile is used for development and testing purposes only.
21+
# --------------------------------------------------------------------
22+
# This configuration is intended for local development on Darwin/macOS
23+
# with ARM architecture (such as M4).
24+
#
25+
# Usage on Linux systems and/or AMD64 architectures may require
26+
# adjustments to ensure images build and run correctly.
27+
#
28+
# Contributions to broaden compatibility are welcome!
29+
# --------------------------------------------------------------------
2230

2331
IMAGE_NAME = $(shell basename $(CURDIR))
2432
IMAGE_TAG = V902_TAG
@@ -36,14 +44,14 @@ build:
3644
run-privileged: build
3745
@echo "Running the Open Cluster Scheduler container in privileged mode..."
3846
mkdir -p ./installation
39-
docker run -p 7070:7070 --rm -it -h master --privileged -v /dev/fuse:/dev/fuse --cap-add SYS_ADMIN --name $(CONTAINER_NAME) -v ./installation:/opt/cs-install -v ./:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash
47+
docker run -p 7070:7070 --rm -it -h master --privileged -v /dev/fuse:/dev/fuse --cap-add SYS_ADMIN --name $(CONTAINER_NAME) -v ${PWD}/installation:/opt/cs-install -v ${PWD}/:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash
4048

4149
.PHONY: run
4250
run: build
4351
@echo "Running the Open Cluster Scheduler container..."
4452
@echo "For a new installation, you need to remove the ./installation subdirectory first."
4553
mkdir -p ./installation
46-
docker run --platform=linux/amd64 -p 7070:7070 -p 9464:9464 --rm -it -h master --name $(CONTAINER_NAME) -v ./installation:/opt/cs-install -v ./:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash
54+
docker run --platform=linux/amd64 -p 7070:7070 -p 9464:9464 --rm -it -h master --name $(CONTAINER_NAME) -v ${PWD}/installation:/opt/cs-install -v ${PWD}/:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash
4755

4856
# Running apptainers in containers requires more permissions. You can drop
4957
# the --privileged flag and the --cap-add SYS_ADMIN flag if you don't need
@@ -55,7 +63,7 @@ simulate:
5563
rm -rf ./installation
5664
@echo "Creating new subdirectory for installation..."
5765
mkdir -p ./installation
58-
docker run --platform=linux/amd64 --rm -it -h master --privileged --cap-add SYS_ADMIN -p 9464:9464 -p 8888:8888 --name $(CONTAINER_NAME) -v ./installation:/opt/cs-install -v ./:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash -c "cd /root/go/src/github.com/hpc-gridware/go-clusterscheduler/cmd/simulator && go build . && ./simulator run ../../cluster.json && /bin/bash"
66+
docker run --platform=linux/amd64 --rm -it -h master --privileged --cap-add SYS_ADMIN -p 9464:9464 -p 8888:8888 --name $(CONTAINER_NAME) -v ${PWD}/installation:/opt/cs-install -v ${PWD}/:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash -c "cd /root/go/src/github.com/hpc-gridware/go-clusterscheduler/cmd/simulator && GOFLAGS=-buildvcs=false go build . && ./simulator run ../../cluster.json && /bin/bash"
5967

6068
#.PHONY: simulate
6169
#simulate:
@@ -68,14 +76,14 @@ adapter:
6876
@echo "Running the adapter on port 8282...POST to http://localhost:8282/api/v0/command"
6977
@echo "Example: curl -X POST http://localhost:8282/api/v0/command -d '{\"method\": \"ShowSchedulerConfiguration\"}'"
7078
mkdir -p ./installation
71-
docker run --platform=linux/amd64 --rm -it -h master -p 8282:8282 --name $(CONTAINER_NAME) -v ./installation:/opt/cs-install -v ./:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash -c "cd /root/go/src/github.com/hpc-gridware/go-clusterscheduler/cmd/adapter && go build . && ./adapter"
79+
docker run --platform=linux/amd64 --rm -it -h master -p 8282:8282 --name $(CONTAINER_NAME) -v ${PWD}/installation:/opt/cs-install -v ${PWD}/:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash -c "cd /root/go/src/github.com/hpc-gridware/go-clusterscheduler/cmd/adapter && GOFLAGS=-buildvcs=false go build . && ./adapter"
7280

7381
.PHONY: run-rest
7482
run-rest: build
7583
@echo "Running the Open Cluster Scheduler container with REST adapter..."
7684
@echo "For a new installation, you need to remove the ./installation subdirectory first."
7785
mkdir -p ./installation
78-
docker run --platform=linux/amd64 -p 7070:7070 -p 9464:9464 -p 9898:9898 --rm -it -h master --name $(CONTAINER_NAME) -v ./installation:/opt/cs-install -v ./:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash -c "cd /root/go/src/github.com/hpc-gridware/go-clusterscheduler/cmd/adapter && go build . && ./adapter --port 9898 & exec bash"
86+
docker run --platform=linux/amd64 -p 7070:7070 -p 9464:9464 -p 9898:9898 --rm -it -h master --name $(CONTAINER_NAME) -v ${PWD}/installation:/opt/cs-install -v ${PWD}/:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash -c "cd /root/go/src/github.com/hpc-gridware/go-clusterscheduler/cmd/adapter && GOFLAGS=-buildvcs=false go build . && ./adapter --port 9898 & exec bash"
7987

8088
.PHONY: clean
8189
clean:

installer.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,18 @@ cd /opt/helpers
5252
cp autoinstall.template ${MOUNT_DIR}/
5353
cd ${MOUNT_DIR}
5454

55+
# Installer calls:
56+
#./utilbin/lx-amd64/filestat -owner .
57+
# linux namespaces cause a different ownership of the host mounted
58+
# directory - this causes the installer to abort on Linux
59+
60+
rm ./utilbin/lx-amd64/filestat
61+
echo "#!/bin/bash" > ./utilbin/lx-amd64/filestat
62+
echo "echo root\n" >> ./utilbin/lx-amd64/filestat
63+
chmod +x ./utilbin/lx-amd64/filestat
64+
5565
# Install qmaster and execd from scratch when container starts.
56-
cat ./autoinstall.template | sed -e 's:docker:$HOSTNAME:g' > ./template_host
66+
sed "s:docker:${HOSTNAME}:g" ./autoinstall.template > ./template_host
5767
./inst_sge -m -x -auto ./template_host
5868

5969
# Make sure installation is in path and libraries can be accessed.

0 commit comments

Comments
 (0)