Skip to content

Instantly share code, notes, and snippets.

@jcgregorio
Last active February 25, 2019 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcgregorio/3d30cb7673e80b85c2153db9ff8be7c4 to your computer and use it in GitHub Desktop.
Save jcgregorio/3d30cb7673e80b85c2153db9ff8be7c4 to your computer and use it in GitHub Desktop.

Create a Google Cloud Storage bucket, and then create a service account that has Admin access to that bucket. Export a JSON key of that service account and store it at:

~/.config/{bucket name goes here}/key.json

#!/bin/bash
set -x
go get -u github.com/googlecloudplatform/gcsfuse
cp $GOPATH/bin/gcsfuse $HOME/bin/
sudo loginctl enable-linger $USER
mkdir -p ~/textfiles/
mkdir -p ~/.config/systemd/user/
cp textfiles.service ~/.config/systemd/user/
systemctl --user enable textfiles
[Unit]
Description=Systemd autostart the gcs fuse fs.
Wants=local-fs.target
After=local-fs.target
[Service]
#
# Update these values to your own directory and bucket names.
#
WorkingDirectory=/home/jcgregorio
Restart=always
ExecStart=/home/jcgregorio/bin/gcsfuse --foreground --key-file=/home/jcgregorio/.config/{bucket name goes here}/key.json bitworking-textfiles /home/jcgregorio/textfiles
[Install]
WantedBy=default.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment