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 |