Skip to content

Commit

Permalink
Merge pull request #253 from sealink/TF-695-fix-nfs-mount-config
Browse files Browse the repository at this point in the history
[TF-695] Fix nfs-mount config script
  • Loading branch information
DamonShi1024 committed Aug 9, 2023
2 parents f304b86 + efce21b commit 194d551
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
8 changes: 2 additions & 6 deletions .ebextensions/01-nfs-mount.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,5 @@ commands:
sudo sshfs -o allow_other,StrictHostKeyChecking=no,password_stdin sftp-user@172.18.0.12:/ /mnt/nfs < /tmp/credentials
rm /tmp/credentials

05_enable_sshfs_on_boot:
command: |
echo 'sshfs#sftp-user@172.18.0.12:/ /mnt/nfs fuse.reconnect,allow_other 0 0' | sudo tee -a /etc/fstab

06_restart_docker:
command: service docker stop && service docker start
05_restart_docker:
command: sudo service docker restart
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
*.class

# Generated files
bin/
bin/*
gen/
out/
Dockerrun.aws.json
!bin/remount_sftp.sh

# Gradle files
.gradle/
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# QuickPrint

## Unreleased

* [TF-695] Fix nfs-mount config script

## 1.6.1

* [TF-470] Update nfs mount config
Expand Down
22 changes: 22 additions & 0 deletions bin/remount_sftp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Define your mount point
MOUNT_POINT="/mnt/nfs"

# Check if the mount point is already mounted
if mountpoint -q "$MOUNT_POINT"; then
echo "Mount point $MOUNT_POINT is already mounted."
else
echo "Mount point $MOUNT_POINT is not mounted. Mounting now..."

SFTP_PASSWORD=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k SFTP_PASSWORD)
echo "$SFTP_PASSWORD" > /tmp/credentials
sudo sshfs -o allow_other,StrictHostKeyChecking=no,password_stdin sftp-user@172.18.0.12:/ /mnt/nfs < /tmp/credentials
rm /tmp/credentials

echo "Mounting complete."

echo "Reboot docker now..."
sudo service docker restart
echo "Docker has been restarted."
fi

0 comments on commit 194d551

Please sign in to comment.