convert osd to docker-compose

master
lub 5 years ago
parent 776d7c634b
commit d4f6a0509d

@ -3,16 +3,16 @@
version: "3.0"
services:
ceph_osd:
container_name: ceph_osd_${OSD_ID}
ceph_osd_%OSD_ID%:
container_name: ceph_osd_%OSD_ID%
image: docker.io/ceph/daemon:latest-nautilus
#copy hostname of the host to correctly calculate CRUSH map positions
hostname: ${HOSTNAME}
environment:
- OSD_ID=${OSD_ID}
- OSD_ID=%OSD_ID%
volumes:
- /ceph/osd_${OSD_ID}/var/lib/ceph/:/var/lib/ceph/
- /ceph/osd_${OSD_ID}/etc/ceph/:/etc/ceph/
- /ceph/osd_%OSD_ID%/var/lib/ceph/:/var/lib/ceph/
- /ceph/osd_%OSD_ID%/etc/ceph/:/etc/ceph/
- /dev/:/dev/
command: osd_ceph_volume_activate
privileged: true

@ -17,7 +17,14 @@ done
#manually bring up osd
for osd_dir in /ceph/osd_*; do
osd_name=$(basename "$osd_dir")
osd_name=$(basename "$osd_name")
osd_id=$(echo "$osd_dir" | cut -d'_' -f2)
docker run -d --rm --net=ceph --hostname "$HOSTNAME" --privileged -v /ceph/"$osd_name"/etc/ceph:/etc/ceph -v /ceph/"$osd_name"/var/lib/ceph:/var/lib/ceph -v /dev:/dev -e OSD_ID="$osd_id" --name "ceph_$osd_name" docker.io/ceph/daemon:latest-nautilus osd_ceph_volume_activate
#create temporary docker-compose.yml
sed "s/%OSD_ID%/$osd_id/g" > docker-compose.yml
HOSTNAME="$HOSTNAME" docker-compose up -d
#remove temporary docker-compose.yml
rm docker-compose.yml
done