Server side swift for the hackspace automated lighting
Code can be build with either the Xcode project or with swift build
Currently this is running on Queen
The PADockerfiles are generated by Perfect Assistant 3.0
Adding the instrumentation network to docker (only needs to be done once)
sudo docker network create -d macvlan \
--subnet=192.168.0.0/24 \
--ip-range=192.168.0.128/25 \
--gateway=192.168.0.1 \
-o parent=eth0.3 instrumentationBuild the intermediary docker image with our dependencies, only needs doing if PADockerfile_build has changed
sudo docker build -f PADockerfile_build -t perfectassistant/nh-lighting .Use our image to compile
sudo docker run \
--volume=/home/dpslwk/github/instrumentation-lighting:/perfectbuild \
--volume=/home/dpslwk/github/instrumentation-lighting/.packages_lin:/perfectbuild/Packages \
--volume=/home/dpslwk/github/instrumentation-lighting/.build_lin:/perfectbuild/.build \
--volume=/home/dpslwk/github/instrumentation-lighting/.package_lin.pins:/perfectbuild/Package.pins \
--volume=/home/dpslwk/github/instrumentation-lighting/.package_lin.resolved:/perfectbuild/Package.resolved \
--workdir=/perfectbuild --rm -t perfectassistant/nh-lighting swift buildRunning with files from current location, usefully for testing and change iteration
Create a container
sudo docker create \
--volume=/home/dpslwk/github/instrumentation-lighting:/perfectbuild \
--volume=/home/dpslwk/github/instrumentation-lighting/.packages_lin:/perfectbuild/Packages \
--volume=/home/dpslwk/github/instrumentation-lighting/.build_lin:/perfectbuild/.build \
--volume=/home/dpslwk/github/instrumentation-lighting/.package_lin.pins:/perfectbuild/Package.pins \
--volume=/home/dpslwk/github/instrumentation-lighting/.package_lin.resolved:/perfectbuild/Package.resolved \
--workdir=/perfectbuild --rm -t -p 8181:8181 --name nh-lighting perfectassistant/nh-lighting .build_lin/debug/nh-lightingConnect our container to the instrumentation network
sudo docker network connect instrumentation nh-lightingand start the container
sudo docker start nh-lightingFor long term deployment its better to build an images with all the files included
Compile for release
sudo docker run \
--volume=/home/dpslwk/github/instrumentation-lighting:/perfectbuild \
--volume=/home/dpslwk/github/instrumentation-lighting/.packages_lin:/perfectbuild/Packages \
--volume=/home/dpslwk/github/instrumentation-lighting/.build_lin:/perfectbuild/.build \
--volume=/home/dpslwk/github/instrumentation-lighting/.package_lin.pins:/perfectbuild/Package.pins \
--volume=/home/dpslwk/github/instrumentation-lighting/.package_lin.resolved:/perfectbuild/Package.resolved \
--workdir=/perfectbuild --rm -t perfectassistant/nh-lighting swift build -c releaseBuild a deploy image
sudo docker build -f PADockerfile_deploy -t perfectassistant/nh-lighting:deploy .Create a container using this image, connect to the instrumentation network and start the container
sudo docker create \
--restart=unless-stopped -t -p 8181:8181 --name nh-lighting perfectassistant/nh-lighting:deploy
sudo docker network connect instrumentation nh-lighting
sudo docker start nh-lightingIf you have docker-compose installed you can save yourself some typing
Compile with dockerised build environment
docker-compose -f build.yml up --buildRun in place
docker-compose up --build --detachSee build.yml and docker-compose.yml for further information
A SIGHUB will cause force a db reload
pkill -1 nh-lightingsudo docker kill --signal=HUP nh-lightingdocker-compose kill -s HUP nh-lighting