Microservice that replicates tags created with TagSpaces app, to Nextcloud.
Nexcloud is a great environment to keep private files accesible from any device in the confort of your own private cloud.
Tagspaces is a great tool for classification of content files using tags with easy.
Nextcloud has applications for mobile and desktop devices, the same as TagSpaces. Even that Nextcloud has it's own tag system, TagSpaces app excels in this task.
This integration service enables you to use TagSpaces desktop interfaces and apply changes to Nextcloud files.
This is a simple service implemented as an external process.
Even though this same functionality could be achieved as a native Nextcloud app, intention is to gain sight and experience on integrating more complex business processes into Nextcloud platform.
The main reason to choose the external service architecture was modern applications trend to microservices, enabling escalation and hight availability.
This integration service uses the great work done by hobigo with the node-Nextcloud-client.
- You must enable TagSpaces and Nextcloud Desktop App, to share the folders and files you whan to sync.
- Service will read unprocessed TagSpaces files, and tag the corresponding files with the same tags that where given in TagSpaces app.
- Configure Nextcloud desktop app to sync files with your server at /users/user_name/Nextcloud.
- Configure Nextcloud server to mark TagSpaces description files for processing.
- Configure TagSpaces to work with files at /users/user_name/Nextcloud.
- Configure TagSpaces to create "sider car" json files with your tag activity.
- Work normally with TagSpaces, creating tags and associating them to your files.
- Tagging files will be synced to your Nextcloud server.
- Files at /users/user_name/Nextcloud/Photos/.ts/ will be marked for processing.
- Every minute, the service will query unprocessed files and create Nextcloud tags accordingly.
- Clone
git clone https://github.com/velocity-formula/nextcloud-tagspaces-integration-service.git- Build
cd nextcloud-tagspaces-integration-service
docker build -t ncts-service .- Run
docker run --name ncts-service \
--hostname ncts-service \
--restart=always \
--publish 6080:80 \
--env NEXTCLOUD_USERNAME=active_nextcloud_user \
--env NEXTCLOUD_PASSWORD=nextcloud_user_app_secret \
--env NEXTCLOUD_SERVER_URL=nextcloud_host_url \
--env NEXTCLOUD_INTEGRATION_TAGNAME="TAG PENDING" \
--env NEXTCLOUD_CLEAR_PREVIOUS_TAGS=true \
--detach ncts-service- NEXTCLOUD_USERNAME: Nextcloud user name. Beware of Nexcloud security context, as integration service is subject to it.
- NEXTCLOUD_PASSWORD: Device or service password created for this service application.
- NEXTCLOUD_SERVER_URL: Nextcloud service ulr. Include port if necessary.
- NEXTCLOUD_INTEGRATION_TAGNAME: The name of the tag that will be used in Nextcloud to mark the unprocessed tagspaces JSON files.
-
NEXTCLOUD_CLEAR_PREVIOUS_TAGS: Indicates if service will clear any existing tags before applying the tags comming from TagSpaces app.
# Default value is false NEXTCLOUD_CLEAR_PREVIOUS_TAGS=[true|false]
-
APP_CRON_TASK_ACTIVE: Activates recurrent task for capturing tag files changes.
# Default value is true APP_CRON_TASK_ACTIVE=[true|false]
-
APP_CRON_INTERVAL: Service will query Nextcloud recurrently on every minute. To customize this interval, use a cron mask.
# Default is for every 1 minute: "*/1 * * * *" # Example for every 5 minutes: APP_CRON_INTERVAL="*/5 * * * *"
-
CORS_ALLOW_ORIGINS: Indicates allowed CORS origins for api requests. Should change to reflect network installation evironment.
# Default is "localhost" CORS_ALLOW_ORIGINS="example.com"
Default values can be customized at ./src/config/.env file
- GET - /api/test-connect : test service connection to Nextcloud server.
- GET - /api/process-tags : manually fires the integration process.
- GET - /api/get-progress : gets progress and process queue status.
// htttp://ncts-service/api/get-progress
// response example
{
"message": {
"Process": "Nextcloud-tagspaces-integration-service",
"IsActive": true,
"IsBusy": true,
"FilesInQ": 1,
"Errors": 0,
"PendingQ": [
{
"tag_file_name": "/Photos/.ts/20-05-29 08-15-28 2853.jpg.json",
"taged_file": "/Photos/20-05-29 08-15-28 2853.jpg",
"taged_file_old_tags": [],
"user_name": "ServiceUserForNextcloud",
"processing_status": "VALID",
"isFile": true
}
]
}
}
-
Download and enable Nextcloud Collaborative Tags App, Flow App and Automatic Tagging App.
-
Create a custom Nextcloud collaborative tag that will identify unprocess files. Ex. "TAG PENDING".
-
Create a new Automatic Tag Rule to mark TAGSPACES files for processing
-
Create a new App password to authenticate the integration service.
Download and configure with your preferences. Default configuration will point to /users/user_name/Nextcloud
-
Download and install TagSpaces desktop app.
-
Configure Tagspaces app to use sidecar type tag.
This will create a folder name ".ts" (hidden folder) that will contain a description file (JSON format) for the created tags.
-
Create a new location pointing to where Nextcloud files are
Besides the authentication created for the nextcloud user and CORS_ALLOW_ORIGINS environment variable, current implementation has no other security measures as service use is intended for local internal use only, so only GET api verbs are allowed. CORS_ALLOW_METHODS environment variable controlls allowed api verbs, but only has meaning if some other functionality is added.
Integration service is limited (by now) to Nextcloud security context of the user is set on NEXTCLOUD_USERNAME environment variable. If a service user is used for the integration, access should be granted to other users files. Consider using TagSpaces with Nexcloud shared folders.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The license text is available in the LICENSE file.




