This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# vars | |
[ -z "$NUM_WORKERS" ] && NUM_WORKERS=3 | |
# init swarm (need for service command); if not created | |
docker node ls 2> /dev/null | grep "Leader" | |
if [ $? -ne 0 ]; then | |
docker swarm init > /dev/null 2>&1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir docker-ca | |
chmod 0700 docker-ca/ | |
cd docker-ca/ | |
# CA key | |
openssl genrsa -aes256 -out ca-key.pem 2048 | |
# CA certificate | |
openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem | |
# Server key |