Skip to content

Commit

Permalink
mount INSTANCE_IDENTITY_DIR as a tmpfs
Browse files Browse the repository at this point in the history
* calculate the size of the tmpfs based off of max containers and the
  size of the certificate and key

[finishes #138758503]
  • Loading branch information
jfmyers9 committed Feb 18, 2017
1 parent 01015b6 commit 9a59cfc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion jobs/rep/templates/rep_ctl.erb
Expand Up @@ -36,9 +36,18 @@ case $1 in
mkdir -p $DRIVERS_PATHS
chown vcap:vcap $DRIVERS_PATHS

# Key and Cert are generally ~2048 bytes. Add an extra 2048 for extra space
instance_cert_and_key_size=6144
instance_ca_size=$(wc -c ${CONF_DIR}/certs/rep/instance_identity.crt | cut -d' ' -f1)
max_containers=250
instance_tmpfs_size=$((($instance_ca_size + $instance_cert_and_key_size) * $max_containers))

INSTANCE_IDENTITY_DIR=${DATA_DIR}/instance_identity
rm -rf "$INSTANCE_IDENTITY_DIR"
if [ -d $INSTANCE_IDENTITY_DIR ]; then
umount -f $INSTANCE_IDENTITY_DIR
fi
mkdir -p "$INSTANCE_IDENTITY_DIR"
mount -t tmpfs -o size=$instance_tmpfs_size tmpfs $INSTANCE_IDENTITY_DIR
chown -R vcap:vcap "$INSTANCE_IDENTITY_DIR"

TRUSTED_CERTS_DIR=${DATA_DIR}/trusted_certs
Expand Down

0 comments on commit 9a59cfc

Please sign in to comment.