This repository contains a showcase for synchronizing on-premises data including offline support, powered by PouchDB, Ionic 2 and Thinktecture RelayServer.
server
– working directory of the PouchDB Server, its files will be placed hereconnector
– placeholder directory where build artifacts of Thinktecture RelayServer On-Premises Connector Service should be placedclient
– source files of the Ionic 2 client app live here
- Not surprisingly, you need Node.js and Node Package Manager installed
- Running instance of Thinktecture RelayServer
- Requires RabbitMQ and Microsoft SQL Server
- Build of Thinktecture RelayServer On-Premises Connector Service
- .NET application
- Integrating RelayServer into applications is an architectural decision. Therefore, the Connector Service is not a part of the pre-built RelayServer release and it has to be built/integrated manually.
- Clone this repository and build the
Thinktecture.RelayServer
solution - Copy the build output of
Thinktecture.RelayServer.OnPremisesConnector
over to the target machine (preferably theconnector
directory of this repository)
- If you want to build/execute the client, Ionic 2 (Beta) needs to be installed globally by running
npm i -g ionic@beta
- Please run
npm i
first. - Relay Server
- Public facing
- Can be hosted anywhere (inhouse, hoster, …)
- Refer to the RelayServer documentation (German) for installing and running RelayServer
- Local On-Premises Device
- Connects to Relay Server using the Thinktecture RelayServer Connector Service (.NET or Mono runtime required)
- Only outgoing connections to port 443 (HTTPS) must be allowed
- Not public facing
- Contains private data, here provided by PouchDB Server (On-Premises Application)
- Run the connector by launching its executable (.NET or Mono runtime required), e.g. by calling
npm run connector
(.NET) ornpm run connector-mono
(Mono) respectively - Run PouchDB Sever by launching its executable, e.g. by calling
npm run pouchdb-server
- Mobile Device (or any other remote client)
- Connects to Relay Server which is connected to the on-premises data storage
- Support for editing data offline and synchronizing it with the remote database
- Please set the
remote
property of theData
service inclient/app/providers/data/data.js
to the remote database endpoint (e.g.https://example.com/relay/raspberry-pi/pouchdb/pizzas/
) - Run the client by navigating to the
client
directory and executeionic serve
- To run the client on a mobile device, add the target platforms using
ionic platform add <platform>
(ios
,android
orwindows
) and runionic run <platform> --device
- PouchDB Server, CouchDB-compatible HTTP server using PouchDB and Node.js
- Thinktecture RelayServer, enabling bidirectional, secure communication between on-premises applications and mobile clients
- Ionic 2, advanced HTML5 mobile development framework and SDK
This sample is/was presented at the following conferences/meetups.
- RheinNeckarJS, April 27, 2016, 20:00, Mafinex, Mannheim.
- DeveloperWeek 2016, June 20, 2016, 14:15, Nuremberg Conference Center, Nuremberg.
- Weyer, Christian: Offline-First Architectures for HTML5 Apps (German)
- Morony, Josh: Syncing Data with PouchDB and Cloudant in Ionic 2
- Thinktecture RelayServer Documentation (German)
- PouchDB Documentation
- Ionic 2 Documentation
- Installing
pouchdb-server
using a current version of Node.js will fail on Debian 7 (Wheezy). Either use an older version of Node.js (e.g. 0.10) or update your version of GCC. - Live/continuous replication is unsupported as RelayServer doesn’t support Long Polling.