Giter VIP home page Giter VIP logo

replikator-api's Introduction

Replikator API

Go Report Card Build Status

This project adds a REST API around the Replikator that makes it possible to manage the replikated databases using a REST api.

Usage of replikator-api:
	Restfull Replikator API server
Options:
  -l, --listen=:8080                      listen address
  -r, --replikator="sudo replikator-ctl"  Path to replikator-ctl
  -s, --secret=                           CORS secret, minimal length 20 chars
  -h, --help                              Show usage message
  --version                               Show version

Run locally

Usage:

$ go get github.com/MarijnKoesen/replikator-api
$ go build github.com/MarijnKoesen/replikator-api
$ ./replikator-api

# when you don't have replikator-ctl available
$ ./replikator-api -r echo

From source:

$ git clone [email protected]:MarijnKoesen/replikator-api.git
$ go run . -r echo
> curl -XPUT localhost:8080/replikator/foo -vvv
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> PUT /replikator/foo HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json
< Date: Wed, 26 Oct 2022 11:22:50 GMT
< Content-Length: 27
<
--output json --create foo
* Connection #0 to host localhost left intact

Installation on server

Steps to install replikator-api on an ubuntu server:

  1. Install replikator-ctl in /usr/bin/replikator-ctl

  2. Create a replikator user/group

# groupadd replikator
# useradd -r -s /bin/nologin replikator2
  1. Create file /etc/sudoers.d/replikator with content:
replikator ALL=(ALL) NOPASSWD:/usr/bin/replikator-ctl
  1. Install replikator-api binary
# go get github.com/MarijnKoesen/replikator-api
# go build -o /usr/bin/replikator-api  github.com/MarijnKoesen/replikator-api
  1. Create a replikator service

Create file /etc/systemd/system/replikator-api.service

[Unit]
Description=Replikator API
ConditionPathExists=/usr/bin/replikator-api
After=network.target

[Service]
Type=simple
User=replikator
Group=replikator
LimitNOFILE=1024

KillMode=process

Restart=on-failure
RestartSec=10

ExecStart=/usr/bin/replikator-api

[Install]
WantedBy=multi-user.target

Now install and enable the service:

# systemctl daemon-reload
# systemctl enable replikator-api
# systemctl start replikator-api

replikator-api's People

Contributors

renan avatar ruudvanderweijde avatar marijnkoesen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.