2

A core requirement of my application is the ability to automatically deploy ArangoDB with all collections, graphs, data, and APIs. The HTTP API and the various wrappers have been sufficient for this so far, but I haven't been able to find an API for deploying Foxx services. Is there any way to create and deploy a Foxx service via RESTful API or through one of the wrappers? So far, the only way I know to create a Foxx service is through the web interface.

I found this question which leads me to believe it's possible, but I don't know how to specify the Git location of the Foxx service. Could you provide instructions for creating a Foxx service without the web UI and list the possible parameters?

Community
  • 1
  • 1
Nate Gardner
  • 1,577
  • 1
  • 16
  • 37
  • Is the Foxx manager an option? `foxx-manager install option1=value1` – CodeManX Oct 10 '16 at 16:14
  • I would prefer something that could be implemented RESTfully or via Python without dependency on ArangoSH. My team works cross-platform and not everyone has ArangoSH installed, thus CLIs aren't ideal. Everything is scripted, and it's very difficult to get scripts to work properly cross-platform when they need to call a CLI, since accessing bash and accessing cmd are pretty different from Python. – Nate Gardner Oct 10 '16 at 19:51
  • You can have a look to my project https://foxx-framework.com I use a script to deploy all my services using foxx-manager – solisoft Oct 12 '16 at 15:29
  • Is there a RESTful backend to Foxx manager? Or can it be installed via npm? I'm trying to limit dependencies on ArangoSH. – Nate Gardner Oct 18 '16 at 19:08

1 Answers1

3

To install a Foxx service via the REST API, you can use the endpoint HTTP PUT /_admin/foxx/install.

It will require a JSON body to be sent, with attributes named mount and appInfo. mount needs to contain the mountpoint (needs to start with a forward slash). appInfo is the application to be mounted. It can contain the filename as previously returned by the server from the call to /_api/upload, e.g.

{ 
    "appInfo" : "uploads/tmp-30573-2010894858", 
    "mount" : "/my-mount-point" 
}

install from remote URL

You can also install a Foxx service from a zip file available via HTTP(S) from an external server. You can include the username and password for HTTP Basic Auth as necessary:

{ 
    "appInfo" : "https://user:password@example.com/my-service.zip", 
    "mount" : "/my-mount-point" 
}

install from GitHub

You can also install a Foxx service from a GitHub repository, if the repository is public accessible, e.g.

{ 
    "appInfo" : "git:arangodb-foxx/demo-hello-foxx:master", 
    "mount" : "/my-mount-point" 
}

Behind the scenes, ArangoDB will translate the request into a regular URL for the zip bundle GitHub provides.

install from local file system

You can also install a Foxx service from a zip file or directory on the local filesystem:

{ 
    "appInfo" : "/path/to/foxx-service.zip", 
    "mount" : "/my-mount-point" 
}

This also works with directory, but ArangoDB will create a temporary zip file for you in this case.

Alan Plum
  • 10,814
  • 4
  • 40
  • 57
mpv89
  • 1,891
  • 9
  • 10
  • Great start! Thanks! Specifically, how can I specify that the service should come from a git repository? – Nate Gardner Oct 11 '16 at 20:48
  • Is there a way to make this work with Git SSH or HTTPS? The repository is in a self-hosted, secured GitLab. – Nate Gardner Oct 12 '16 at 20:35
  • No, this is https only. Its utilizing the github packaging features. – dothebart Oct 13 '16 at 13:33
  • @NateGardner if you want to install from an external location the cleanest solution is probably to download the zip bundle locally and install it via upload. – Alan Plum Oct 18 '16 at 12:23
  • @NateGardner to clarify, there is no way to install from git. You can install from GitHub but that just fetches the zip bundle GitHub provides, it doesn't clone the repository. – Alan Plum Oct 18 '16 at 12:24
  • Ah. Is that hard-coded into ArangoDB for GitHub only, or can I point it to any git URL that resolves to a zip download? Does this only work for public GitHub projects? GitLab does provide a download zip feature as well. I need the ability to install many Foxx services automatically when deploying my app. Thus upload from repository is ideal. Upload from local file also works, but I need to know how to, via REST, upload and install a Foxx service that is version controlled. – Nate Gardner Oct 18 '16 at 18:50
  • @mpv1989, My question is partially answered. I'm still wondering if there's any way to upload Foxx services completely RESTfully, preferably via a local git repository on the server. – Nate Gardner Oct 18 '16 at 19:05
  • @NateGardner Sorry, I lied. It should be possible to install from arbitrary URLs or local file paths. I've updated the answer. – Alan Plum Oct 19 '16 at 10:54
  • The updated answer is what I was looking for! Thank you! – Nate Gardner Oct 20 '16 at 00:10