Skip to content

Instantly share code, notes, and snippets.

@shanmuha
Forked from craigafinch/gcs.service
Last active July 14, 2020 06:25
Show Gist options
  • Save shanmuha/82171408704e9fd2912b7c0d418d7578 to your computer and use it in GitHub Desktop.
Save shanmuha/82171408704e9fd2912b7c0d418d7578 to your computer and use it in GitHub Desktop.
A systemd service to manage a Google Cloud Storage bucket mounted with GCSFuse
# https://github.com/GoogleCloudPlatform/gcsfuse
# put this file as /etc/systemd/system/gcsfusemount.service and then `systemctl enable gcsfusemount.service`
#
[Unit]
Description=Google Cloud Storage FUSE mounter
After=local-fs.target network-online.target google.service sys-fs-fuse-connections.mount
Before=shutdown.target
[Service]
Type=forking
User=tomcat
Environment=BUCKET=gcs-bucket-name
Environment=MOUNT_POINT=/some/directory
#Environment=GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
ExecStart=/usr/bin/gcsfuse $BUCKET $MOUNT_POINT
ExecStop=/bin/fusermount -u $MOUNT_POINT
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment