Make sure Git and Go are installed.
Once GOPATH
is correctly configured, run:
go get -u -v github.com/zincbase/zincserver
A zincserver.exe
(Windows) or zincserver
(Linux) executable should be created in your $GOPATH/bin
directory.
(pre-compiled binaries may become available in the future as well)
Starting an insecure (HTTP) listener on port 8000
with "./datastores"
as a storage directory:
./zincserver start -insecurePort 8000 -storagePath "./datastores"
Starting a secure (HTTPS) listener on port 8001
with "./datastores"
as a storage directory and HTTP2 enabled:
./zincserver start -securePort 8001 -storagePath "./datastores" -keyFile "myKey.pem" -certFile "myCert.pem" -enableHTTP2
(note it is possible to run both an HTTP and an HTTPS listener concurrently)
Run zincserver start -help
for more startup options.
When the server is launched, it creates a special .config
datastore at the specified storage path, if one doesn't exist already. The global configuration datastore is initialized with a boilerplate default configuration and a securely generated master key, which is printed to the console. The master key grants full access to all datastores and is the only access key permitted to view or modify a configuration datastore (both global and dedicated ones).
ZincServer allows two levels of configuration. Global and datastore-specific. Global configuration is stored at the .config
datastore, and datastore-specific settings can be specified in a datastore named <DatastoreName>.config
. Datastore-specific configuration inherits from the global one and would override any existing global setting when a value with identical key is set.
ZincServer configuration is fully live and can be freely modified while the server is running and data is read or written to it, with changes taking effect instantly and no need for any restarts. The web-based editor tool can be used to conveniently create and manage datastores, and datastore configurations, set up access keys and profiles. Since configuration datastores aren't different from regular ones, they can be created and modified using the REST API, or any higher level API (they can be cloned and modified as normal ZincDB databases).
The editor is a web-based application that can view and edit any ZincDB compatible datastore, including ZincServer configuration datastores.
- Make sure you have the latest Node.js installed.
- Download the ZincDB repository by selecting
Clone or Download
->Download ZIP
at the main repository page (or alternatively clone the repository by runninggit clone https://github.com/zincbase/zincdb.git
). - Unzip if needed.
- Run
npm install
,npm run build
,npm run devserver
at the repository's root directory. - Open a web browser at
http://localhost:8888/editor
. - Once the editor opens, fill the global configuration datastore URI (
http://localhost:[ZincServerPort]/datastore/.config
) and master key as access key and press enter.
ZincServer's access control is based on access keys, which must be 32 character lowercase hexadecimal strings. An access key is associated with an access profile that describes what permissions and limits are allowed for that key. A single access profile can be shared across multiple access keys.
The default configuration contains two boilerplate access profiles: Reader
and ReaderWriter
. To add an access key 912ec803b2ce49e4a541068d495ab570
associated with the profile Reader
and specific to the datastore MyDatastore
create a new datastore MyDatastore.config
, add the path:
["datastore","accessKeyHash","a84825308039ffcc6ea3cdb0022776079651bd00"]
and give it the value "Reader"
(note the string used in the path is the hexadecimal encoded SHA1 hash of the the target access key as plain string).
Please continue to the configuration reference for more details.
Please continue to the REST API reference.