Re: Initialization script for SSHFS

Daniel Mikusa

There's a branch of that repo that uses a .profile.d script.

It's a little different than the Python one as it pulls the connection info
from a bound service, but you don't have to do that.

Some additional comments inline...

mv $HOME/app/.ssh $HOME/
chmod 644 $HOME/.ssh/*
chmod 600 $HOME/.ssh/sshfs_rsa
mv $HOME/app/main.rb /tmp/
mkdir -p $HOME/app/SSHFS/
sshfs root(a)

Can you access from the container? You might try adding a
`ping -c 5` earlier in the script to test that. If it doesn't
work check your security groups and make sure that you can route to that

/root/ssh_target/ $HOME/app/SSHFS -o IdentityFile=$HOME/.ssh/sshfs_rsa -o
StrictHostKeyChecking=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o
idmap=user -o cache=yes -o kernel_cache -o compression=no -o large_read
Try running this command from your PC and make sure it works and that it
connects without prompting for a password. That last bit is critical or
you need to change the command so that the password is piped in like this.

mv /tmp/main.rb $HOME/app/SSHFS/
fusermount -uz $HOME/app/SSHFS
The Python script is run by the build pack, so it runs during staging.
This is why it unmounts the volume. A .profile.d script runs in the
runtime container prior to the application starting. You probably don't
want to unmount the drive or it won't be accessible. You also want to make
sure that it runs in the background or your script will just hang.


Join { to automatically receive all group messages.