GGCom : Docker : hubiC
Build from Dockerfile:
git clone https://github.com/gotget/ggcom-docker-hubic.git cd ggcom-docker-hubic sudo docker build -t gotget/hubic .
Pull from Docker Hub:
sudo docker pull gotget/hubic
Initializing a credentials file:
Step 1: Obtain a Client ID and reciprocal Secret Key from hubiC:
- Login to the hubiC Developer API portal.
- Click on "Add an application"
- For "Last name", I use the name of the server that I'm configuring this for.
- For "Redirection domain", I use https://SERVERNAME.example.com/
- (I literally use "example.com" for the domain name)
- Click "OK", and the application will appear in your list.
- Click on "Details" next to the newly-created entry for application.
- Copy the Client ID from the text field to use below, for retrieving an access token.
- Copy the Secret Client from the text field to use below, for retrieving an access token.
Step 2: Obtain a hubiC access token:
sudo docker rm -f hubic sudo docker run \ --rm \ --interactive --tty \ --name=hubic-init \ --entrypoint=/usr/local/bin/hubic_token \ gotget/hubic
Follow the on-screen instructions, and stick with the defaults in parenthesis if you don't need to change them for a special need. When finished answering questions, the output will comprise the bulk of your hubiC credentials file that you should save with read-only access by your specific user (probably root) that you're running the Docker as:
client_id=api_hubic_ABC123789XYZ client_secret=ABC123789XYZ refresh_token=ABC123789XYZ redirect_uri=https://SERVERNAME.example.com/ verify_ssl=True
Testing our setup:
sudo docker run \ --rm \ --interactive --tty \ --privileged \ --name=hubic \ -v /path/to/hubicfuse.ini:/root/.hubicfuse \ gotget/hubic
If everything works properly, you should see something along the lines of:
hubiC has been successfully mounted to /root/hubic/ You are now inside of the hubiC container with your mounted volumes from your host. (list of directories and files stored on your hubiC will appear here) root@abc123789xyz:~#
If a failure occurs, then ideally, you'll receive a specific message indicating what went wrong.
Manually launching the container, detached:
sudo docker run \ --detach \ --interactive --tty \ --privileged \ --name=hubic \ -v /path/to/hubicfuse.ini:/root/.hubicfuse \ -v /media/drive1/:/mnt/drive1/ \ -v /media/drive2/:/mnt/drive2/ \ -v /media/drive3/:/mnt/drive3/ \ gotget/hubic
Automatically launching the container with Upstart:
3 simple steps:
- Modify where appropriate, for your needs.
/usr/bin/env service docker-hubic restart
You can monitor the output of this service's status at
Example: processing raw data and sending it to hubiC:
Enter the hubiC container that's detached and running in the background:
sudo docker exec -it hubic bash
Gather a directory's contents together in an uncompressed file:
cd /mnt/drive3/ tar -cvf largeDirectory.tar ./largeDirectory/
Split the archive into segments
(hubiC seems to choke on anything greater than (or equal to?) a Gigabyte, so we'll split the file into a sequence of files that each measure 950 MegaBytes, sans the last file of the sequence which may be smaller)
split \ --bytes=950M \ largeDirectory.tar \ largeDirectory.tar.
(Notice the ending
.? This is what separates the name from the sequence that's named as an alphabetical suffix, which would save as:
Move split-sequence files to a holding directory:
mkdir -pv /mnt/drive3/tmp/ mv -iv largeDirectory.tar.* /mnt/drive3/tmp/
Synchronizing with hubiC:
(You can reverse paths if you want to synchronize from hubiC to your host volume)
hsync \ /mnt/drive3/tmp/ \ /hubic/largeDirectory-split/
hsyncis an alias to
rsyncwith a long list of options for hubiC compatibility, that was setup with this Docker container, and resides in
~/.bashrcinside of the Docker container.
hcpis an alias to
rsyncwith similar functionality to
hsyncbut meant for non-destructive delivery to the destination (e.g. deleting files on the destination end, that aren't part of the source).
- Many extra utilities are packaged into the container:
cURL- command-line tool for transferring data using various protocols.
duplicity) - a frontend that simplifies the use of
- (requires, and thus, includes
Duplicity, which provides an encrypted, digitally signed, versioned, remote backup of files requiring little of a remote server)
- (requires, and thus, includes
EncFS- FUSE-based cryptographic filesystem.
Nano- a text editor for Unix-like computing systems or operating environments using a command line interface.
rsnapshot- a filesystem snapshot utility based on rsync (and similar to
Duplicity, but with less built-in security, and geared more towards trusted environments).
rsync- a widely-used utility to keep copies of a file on two (or more) computer systems.
SSHFS- SSHFS (SSH Filesystem) is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection.
tree- a recursive directory listing program that produces a depth-indented listing of files.
- If you want to use additional utilities inside (e.g. FMDMS from GGCom Bash Utilities), mount a volume to
/root/bin/, as it's set in the container's
- Additional documents and notes are on my pet project, "open-sourcey"
Thanks, and please enjoy.
Written with StackEdit.