### Run Filestash with Docker Compose Source: https://www.filestash.app/docs/install-and-upgrade Creates a directory, downloads the docker-compose.yml, and starts the containers. The output shows the filestash and wopi containers starting. ```bash ~/$ mkdir filestash && cd filestash ~/filestash$ curl -O https://downloads.filestash.app/latest/docker-compose.yml % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 322 100 322 0 0 98 0 0:00:03 0:00:03 --:--:-- 98 ~/filestash$ docker compose up -d [+] Running 3/3 ✔ Volume "filestash_filestash" Created ✔ Container filestash_wopi Started ✔ Container filestash Started ``` -------------------------------- ### Docker volume driver setup with compose file Source: https://www.filestash.app/docs/guide/storage.html Install the fdrive Docker plugin, set required environment variables, and run a compose file that mounts a volume using the fdrive driver. The compose file defines a service that lists the mounted files. ```bash docker plugin install machines/fdrive --alias fdrive export FILESTASH_SERVER=https://demo.filestash.app export FILESTASH_TOKEN=uKzArshpw49Pta2tJZmg1mywkHcmimpW4lCjtVDNTbUFpmN0W2PXajSRR_fA5VrRr4Ks1S5SHwn9YffL74qRrVr1jssRUCXp4_uZdItrYUhQegWAGh5xT45-DgHowJb5aFtO-nODOMpFa6Y84Sit7za3GyM1miEpYm0wWgVucCs4tA== docker compose -f - up < ls documents remoteFTP remoteS3 sftp> documents/foobar/ documents/foobar/bin documents/foobar/boot documents/foobar/core documents/foobar/dev documents/foobar/dist documents/foobar/etc ... sftp> ``` -------------------------------- ### Plugin configuration registration pattern in config.go Source: https://www.filestash.app/docs/guide/plugin-development.html Standard structure for a plugin's config.go file. Registers a configuration field during the Onload phase using Hooks.Register.Onload and Config.Get().Schema(). The example defines an 'enable' field of type 'enable' with a default of false, which appears in the admin console. ```go package plg_xxx_xxx import ( . "github.com/mickael-kerjean/filestash/server/common" ) func init() { Hooks.Register.Onload(func() { PluginEnable() // ... add more config options }) } var PluginEnable = func() bool { return Config.Get("features.foobar.enable").Schema(func(f *FormElement) *FormElement { if f == nil { f = &FormElement{} } f.Name = "enable" f.Type = "enable" f.Target = []string{} f.Description = "Enable/Disable the foobar feature" f.Default = false return f }).Bool() } // ... add more config options ``` -------------------------------- ### Compiled Plugin Scaffold Source: https://www.filestash.app/docs/guide/plugin-development.html The standard scaffold for a compiled plugin in Go. It registers an implementation of a core interface using Hooks.Register. The example shows the required import and init function pattern. ```go package plg_interface_example import ( . "github.com/mickael-kerjean/filestash/server/common" ) func init() { Hooks.Register.XXX(Impl{}) } type Impl struct {} func (this Impl) ... ``` -------------------------------- ### VFS configuration with variables Source: https://www.filestash.app/docs/guide/virtual-filesystem.html Parameterize VFS configurations using Go template variables. Identity provider attributes are exposed in the template context (e.g., .user), and environment variables are available via the .ENV_ prefix. ```plaintext /projects/ {"type": "local", "password": "test", "path": "/home/{{ .user }}/Documents/"} /projects/azure/ { "type":"azure", "account_name":"{{ .ENV_AZURE_ACCOUNT_NAME }}","account_key":"{{ .ENV_AZURE_ACCOUNT_KEY}}"} ``` -------------------------------- ### GET /api/files/cat Source: https://www.filestash.app/docs/api Downloads a file from the specified path. ```APIDOC ## GET /api/files/cat ### Description Downloads a file from the specified path. ### Method GET ### Endpoint /api/files/cat ### Parameters #### Query Parameters - **path** (string) - Required - The path of the file to download. ### Request Example GET /api/files/cat?path=/file.txt ### Response #### Success Response (200) The response body contains the file content. #### Response Example Lorem Ipsum ``` -------------------------------- ### Windows: import certificate with certutil Source: https://www.filestash.app/docs/guide/managing-certificates.html Command to import the certificate into the machine root store from an Administrator command prompt. The output confirms the certificate was added successfully. ```bash C:\Users\filestash> certutil -addstore -f Root .\cert.pem Root "Trusted Root Certification Authorities" Signature matches Public Key Certificate "O=Filestash" added to store. CertUtil: -addstore command completed successfully. ``` -------------------------------- ### GET /api/files/zip Source: https://www.filestash.app/docs/api Creates a ZIP archive of the specified directory. ```APIDOC ## GET /api/files/zip ### Description Creates a ZIP archive of the specified directory. ### Method GET ### Endpoint /api/files/zip ### Parameters #### Query Parameters - **path** (string) - Required - The directory path to zip. ### Request Example GET /api/files/zip?path=/ ### Response #### Success Response (200) The response body contains the ZIP file content. #### Response Example Binary ZIP file content ``` -------------------------------- ### attribute_mapping params JSON structure Source: https://www.filestash.app/docs/guide/configuration.html Example of the JSON string used for the attribute_mapping params field, mapping storage labels to their connection details. ```json { "mystorage": {"type":"s3","access_key_id":"...","secret_access_key":"..."}, "other": {"type":"blackhole"} } ``` -------------------------------- ### POST /api/files/mkdir Source: https://www.filestash.app/docs/api Creates a directory. ```APIDOC ## POST /api/files/mkdir ### Description Creates a directory. ### Method POST ### Endpoint /api/files/mkdir ### Parameters #### Query Parameters - **path** (string) - Required - The path of the directory to create. ### Request Example POST /api/files/mkdir?path=/folder/ ### Response #### Success Response (200) - **status** (string) - Status of the request, e.g., "ok". #### Response Example { "status": "ok" } ``` -------------------------------- ### config.json settings section structure Source: https://www.filestash.app/docs/guide/configuration.html Illustrates how settings keys map to UI titles, with first-level keys like general and features, and nested keys like api as second-level titles. ```json { "general": { // <- that's your first level title "name": ... ... }, "features": { // <- next first level title "api": { // <- second level title ... }, ... }, ... } ``` -------------------------------- ### Connect to SFTP Gateway using sftp CLI Source: https://www.filestash.app/docs/api Connects to the Filestash SFTP gateway on port 2222 using the sftp command. The example shows listing directories and navigating into a folder. ```bash ~/$ sftp -P 2222 test@127.0.0.1 test@127.0.0.1's password: Connected to 127.0.0.1. sftp> ls documents downloads sftp> documents/foobar/ documents/foobar/bin documents/foobar/boot documents/foobar/core documents/foobar/dev documents/foobar/dist documents/foobar/etc ... sftp> ``` -------------------------------- ### Basic VFS mount point configuration Source: https://www.filestash.app/docs/guide/virtual-filesystem.html A typical VFS configuration is a list of mount points, each associating a path with a storage specification in JSON format. The storage provider is identified by the 'type' key, and each provider has its own configuration fields. ```plaintext /folderA/ {"type": "local", ... } /folderA/childOfA/ {"type":"azure", ...} /folderB/ {"type": "local", "path": "/mnt/" ... } ``` -------------------------------- ### Connect to SFTP gateway with private key authentication Source: https://www.filestash.app/docs/guide/sftp-gateway.html Connects to the SFTP gateway using private key authentication with the -i flag. The output shows the same virtual filesystem listing. This demonstrates that the gateway supports private key authentication. ```bash ~/$ sftp -P 2222 -i id_rsa testWithKey@127.0.0.1 Connected to 127.0.0.1. sftp> ls documents remoteFTP remoteS3 sftp> ``` -------------------------------- ### POST /api/files/touch Source: https://www.filestash.app/docs/api Creates an empty file. ```APIDOC ## POST /api/files/touch ### Description Creates an empty file. ### Method POST ### Endpoint /api/files/touch ### Parameters #### Query Parameters - **path** (string) - Required - The path of the file to create. ### Request Example POST /api/files/touch?path=/file.txt ### Response #### Success Response (200) - **status** (string) - Status of the request, e.g., "ok". #### Response Example { "status": "ok" } ``` -------------------------------- ### Docker Compose up with fdrive volume for agent Source: https://www.filestash.app/docs/guide/agents.html Runs a Docker Compose stack that mounts a Filestash virtual filesystem as a volume named 'files' using the fdrive driver. The agent container lists the mounted directory with 'ls -la /mnt'. The output shows the directory listing and successful exit. ```bash ~/$ docker compose -f - up <