How to self-host GroupDocs.Merger Cloud with Docker
How to self-host GroupDocs.Merger Cloud with Docker
Leave feedback
On this page
Docker is an open platform that effectively solves three main tasks development, deployment, and running the applications. With Docker, you can isolate your applications from the infrastructure that simplifies software development and delivery. The main building blocs are images and containers. The image includes everything you need to run the application: code or binaries, runtime dependencies, file system. The container is an isolated process with additional features that you can interact with. The use of containers to deploy applications is called containerization.
Docker Hub is a repository or library of the container images where you can share and find images.
To run the GroupDocs.Merger Cloud in Docker the Docker itself should be installed on your machine.
Install Docker
Check Get Started section for Docker installation for your platform. After you installed and started Docker on your local machine we can run the container.
Before running the container you can create two optional folders with files to process and custom fonts that we’ll be mounted and available to GroupDocs.Merger Cloud service when we start the container.
To run GroupDocs.Merger Cloud in Docker type one of the following commands:
Note
In case you don’t have license keys you can omit LICENSE_PUBLIC_KEY and LICENSE_PRIVATE_KEY parameters. Without license GroupDocs.Merger will work in evaluation mode.
docker run \
В В В В -p 8080:80 \
В В В В -v $(pwd)/data:/data \
В В В В -e LICENSE_PUBLIC_KEY#public_key \
В В В В -e LICENSE_PRIVATE_KEY#private_key \
В В В В --name merger_cloud \
В В В В groupdocs/merger-cloud
The Docker would download GroupDocs.Merger Cloud image from Docker Hub and start a container.
Note
I’m running Docker on Windows and will be using PowerShell to run the commands but the experience would be the same in case you’re on Linux.
After the container is started you’ll see the following messages that indicate that GroupDocs.Merger Cloud service up and running.
Now you can work with GroupDocs.Merger Cloud which is hosted on your machine.
Health-check
When the container and GroupDocs.Merger Cloud started you can check service status by calling GET http://localhost:8080/. The successful response status (200) will indicate that the service is up and running.
Invoke-WebRequest-Urihttp://localhost:8080/
curl -i http://localhost:8080/
At the following screenshot, I’m calling http://localhost:8080/ in a separate Powershell window and response indicates that service is alive:
Using UI
After starting, you can use Swagger UI at http://localhost:8080/swagger/ and explore the API. With Swagger UI you can call API methods in your browser.
Using SDK
We generate our SDKs in different languages so you may check if yours is available at GitHub. SDKs require authentication, so predefined CLIENT_ID/CLIENT_SECRET parameters must be set.
Note
If you don’t find your language in the SDK list, feel free to request for it on our Support Forums, or use raw REST API requests as you can find it here.
The authentication is required in case you’re going to use SDK. To enable authentication set CLIENT_ID/CLIENT_SECRET parameters as it shown below.
Then, when using SDK, setup the api base url, as shown in examples below:
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-dotnet-samplesstringClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudstringClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudvarconfiguration=newConfiguration(ClientId,ClientSecret){ApiBaseUrl="http://localhost:8080"};varapiInstance=newInfoApi(configuration);varresponse=apiInstance.GetSupportedFileFormats();
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-java-samples
StringClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
StringClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
Configurationconfiguration=newConfiguration(ClientId,ClientSecret);configuration.setApiBaseUrl("http://localhost:8080");InfoApiapiInstance=newInfoApi(configuration);FormatsResultresponse=apiInstance.getSupportedFileFormats();
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-php-samples
useGroupDocs\Merger\Model;useGroupDocs\Merger\Model\Requests;$ClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
$ClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
$configuration=newGroupDocs\Merger\Configuration();$configuration->setAppSid($ClientId);$configuration->setAppKey($ClientSecret);$configuration->setApiBaseUrl("http://localhost:8080");$infoApi=newGroupDocs\Merger\InfoApi($configuration);$response=$infoApi->getSupportedFileFormats();
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-node-samples
global.merger_cloud=require("groupdocs-merger-cloud");global.clientId="XXXX-XXXX-XXXX-XXXX";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
global.clientSecret="XXXXXXXXXXXXXXXX";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
constconfig=newConfiguration(clientId,clientSecret);config.apiBaseUrl="http://localhost:8080";global.infoApi=merger_cloud.InfoApi.fromConfig(config);letresponse=awaitinfoApi.getSupportedFileFormats();
# For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-python-samplesimportgroupdocs_merger_cloudclient_id="XXXX-XXXX-XXXX-XXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudclient_secret="XXXXXXXXXXXXXXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudconfiguration=Configuration(client_id,client_secret)configuration.api_base_url="http://localhost:8080"infoApi=groupdocs_merger_cloud.InfoApi.from_config(configuration)result=infoApi.get_supported_file_formats()
# For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-ruby-samplesrequire'groupdocs_merger_cloud'$client_id="XXXX-XXXX-XXXX-XXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud$client_secret="XXXXXXXXXXXXXXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudconfig=Configuration.new(client_id,client_secret)config.api_base_url="http://localhost:8080"infoApi=GroupDocsMergerCloud::InfoApi.from_config(config)result=infoApi.get_supported_file_formats()
Enable Google Cloud Storage
By default, a local storage used inside container for file operations. It’s possible to connect a Google Cloud storage by setting GOOGLE_APPLICATION_CREDENTIALS and GOOGLE_STORAGE_BUCKET environment variables.
To stop the running Docker container, just use Ctrl+C in the same terminal where the container is running. Alternatively, you can stop the container by name.
docker stop merger_cloud
Licensing
GroupDocs.Merger Cloud can be started in trial and licensed modes. When GroupDocs.Merger Cloud is working in trial mode the following limitations are applied:
You can compare only two first pages of the document