Giter Club home page Giter Club logo

roxy's Introduction

Roxy

Table of Contents

Overview

Roxy is a utility for configuring and deploying MarkLogic applications. Using Roxy you can define your app servers, databases, forests, groups, tasks, etc in local configuration files. Roxy can then remotely create, update, and remove those settings from the command line.

Features

Cross Platform

Roxy runs on any platform that runs Ruby. We currently test on Mac, Linux, and Windows.

Multiple Environments

Roxy supports multiple deployment environments. You can define your own or use the default environments: local, dev, and prod. Each environment can have different settings which are specified in properties files or xml config files.

Easily Create and Deploy REST Extensions

Roxy provides scaffolding for creating REST extensions, transforms, etc. Once you have writtern your REST extension Roxy makes deploying to the server a breeze.

Capture Existing MarkLogic Settings

Whether it's a legacy application or you just prefer to configure your application using the Admin UI, Roxy can capture existing MarkLogic settings so that you can use them in your application. This feature is great for backing up Legacy Servers. Once the configurations are in Roxy you can then deploy to other servers.

Backwards Compatible

Roxy works with all supported versions of MarkLogic server out of the box.

Customization

Roxy is written in Ruby. Simply by editing the app_specific.rb file you can enhance, override, or replace the default functionality.

Run as a Java Jar

If you work in an environment where installing Ruby is not an option you can run Roxy as a self contained jar file which embeds JRuby.

Getting Help

To get help with Roxy,

Requirements

Quick Start

This section describes the quickest way to get started using Roxy.

Assumptions

  • You already have one or more MarkLogic Servers running somewhere that you can access from your computer. If not, get it here.*
  • You know the admin logon to your MarkLogic Server(s)

Get Roxy

Use one of these three options to get started.

Using git

You can download Roxy using git $ git clone git://github.com/marklogic-community/roxy.git

Grab a zipped version

If you prefer to grab the archive simply download the latest release from our Releases Page

Install the Shell script or Batch File

Roxy comes with a script that you can put in your path. This file will create new projects for you by by issuing the $ ml new command. Grab one of these files and put it in a folder in your PATH. Note: In order for $ ml new to work you need to have git installed.

Windows

Download the ml.bat file

Mac/Linux

Download the ml file

Configure your application

  1. Open a command prompt in the root folder of Roxy.
  2. Run ml init to create sample configuration files.
    You must specify the --server-version option with a value of 6, 7, or 8.
    You must specify the --app-type with a value or bare, rest, hybrid, or mvc.

$ ml init app-name --server-version=7 --app-type=rest 3. Modify deploy/build.properties with your application's settings.

# Username to authenticate to ML
user=your-ml-admin-username

# password for ML authentication
#
# leave this blank to be prompted for your password
#
password=

# the authentication type for the appserver (digest|basic|application-level)
authentication-method=application-level

# the default user to authenticate with. defaults to nobody
default-user=${app-name}-user

# Specify the server(s) you wish to deploy to here. This tutorial assumes you are using localhost.
local-server=localhost
#dev-server=
#prod-server=

Configure MarkLogic Server

This step is only needed when database configurations have changed or on a fresh install. In most cases you will not need to restart your server.

  1. Open a command prompt in the root folder of Roxy.
    If your server is not configured as local-server in build.properties then substitute your environment here ( local | dev | prod )
  2. $ ml local bootstrap
  3. Depending on what changed you may need to restart MarkLogic in order to proceed. If you see output telling you to restart...
    $ ml local restart

Deploying Code

This step describes how to deploy your Roxy application into your MarkLogic Server modules database. If you have elected to run your code locally out of the filesystem you do not need to do this.

  1. Open a command prompt in the root folder of Roxy
  2. $ ml local deploy modules

Congratulations

Congratulations! You have Roxy running on your server. Now you need to start customizing it.

roxy's People

Contributors

alencruz avatar bradmann avatar divino avatar dmcassel avatar eedeebee avatar ezbc avatar fsnow avatar grtjn avatar hansenmc avatar jamsilvia avatar jmeekhof avatar joemfb avatar kford-oconnors avatar mblakele avatar other-daniel avatar paxtonhare avatar peetkes avatar reecedunn67 avatar robertszkutak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roxy's Issues

Create CRUD Resource controllers via scaffolding

Currently if I want to create a CRUD style resource in Roxy I have to code the controller by hand. Please add a scaffolding command to do this for me.

ml create resource controller-name [format]

This should create all of the following functions and views for each with the specified format. If none is supplied as a format then no views will be created.

declare function c:index()
{
};

declare function c:new()
{
};

declare function c:create()
{
};

declare function c:show()
{
};

declare function c:edit()
{
};

declare function c:update()
{
};

declare function c:destroy()
{
};

Skip standard users, roles during wipe

If any of the standard users or roles (nobody, app-user) are used in the build.properties file, then they are removed during 'wipe', If the definitions for these built-in items haven't been copied into ml-config.xml, then they won't be restored by bootstrap. In addition, any other application that relies on them will be broken until they've been restored.

An enhancement would be to skip over the standard users and roles during wipe.

Add info on open source license

The code modules say that Roxy is licensed under Apache License, Version 2.0. It would be good to make this more prominent by adding this to the readme file and/or as a separate license file.

Sharing content database among multiple Roxy Apps

Hi all,

I would like to file a feature request:

In the scenario of having several applications that offer different views over the same content, it will be extremely handy to be able to "synchronize" somehow the database properties (like range indexes and such).

Some ideas:

  • Add a parameter to build.properties so we can explicitly indicate the ml-config.xml file to use.
  • Add a parameter to ml.rb so we can explicitly indicate the ml-config.xml file to use.
  • Mark application via build.properties as "slave" of certain application (so when deploying it can at least give a warning of why the local ml-config.xml is being ignored).

Regards,
Miguel

P.S: I could create a pull request for the first option if you think it's good enough.

Deploy to a cluster

I'd like to be able to deploy to a cluster, which means specifying the number of forests per host in the cluster. I'd like to configure what I need in the properties file, maybe like this:

cluster-nodes=ml-box-1,ml-box-2,ml-box-3
forests-per-node=2

Rewriter drops HTTP parameters for requests that don't have uri-param elements

If you set up a rewrite element like this:

declare variable $c:ROXY-ROUTES :=
  <routes xmlns="http://marklogic.com/appservices/rest">
    <request uri="^/bug" endpoint="/my/module.xqy"/>
    {
      $def:ROXY-ROUTES/rest:request
    }
  </routes>;

and then hit a URL like this:

/bug?uri=foo.xml

then the rewriter drops the uri parameter.

non root collation created on element range index

if you add a self-closing collation element on a string element range index as follows

    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri></namespace-uri>
      <localname>KeywordEN</localname>
      <collation/>
      <range-value-positions>false</range-value-positions>
    </range-element-index>

then having run ml local bootstrap , the index is created with a unicode codepoint collation (http://marklogic.com/collation/codepoint). Running normal lexicon queries against it will fail saying the required index with the collation http://marklogic.com/collation was not found.

Does is make sense to change Roxy add the above root collation instead of the unicode collation when the collation element is not specified? Might be a safer default.

Allow separate test-modules db

I'm working on a project where some of the configuration information is stored in the modules db, rather than the content db. In order to unit test this code, it is necessary to have a separate test-modules db, to prevent overwriting the configuration data in the production/dev db.

Prompt for Password

In several environments it is against the security policy for a password to be saved in cleartext.

I would suggest a method for Roxy to prompt the user for the password. Also, when invoking recordloader and other child processes, the password should not be passed in where a "ps -ef" will show the password.

Set up a scheduled task using the deployer

Modify the deployer so that bootstrap will set up a scheduled task.

Note: I'm not sure whether it will work to have this as part of bootstrap, since the source code might not be deployed yet. If that doesn't work, then it might need to be a different command (ml {env} deploy tasks), but hopefully it can be part of bootstrap.

Default URL rewriting doesn't support changing the default controller function

I want to set my default controller and function to /customresearch/search
But when I overwrite the default controller in config.xqy with "customresearch" I notice that using http://localhost:8040 doesn't work .. The reason being that the function is defaulting to main() which is fine for app builder but not for my case..

When I overwrite that as follows

config.xqy:

(: the default function that the URL http://server:port/ maps to :)
declare variable $DEFAULT-FUNCTION := "search";

/roxy/rewrite.xqy

<rest:request uri="^/([\w\d_\-]*)/?([\w\d_\-]*)\.?(\w*)/?$" endpoint="/roxy/query-router.xqy">
  <rest:uri-param name="controller" default="{$config:DEFAULT-CONTROLLER}">$1</rest:uri-param>
  <rest:uri-param name="func" default="{$config:DEFAULT-FUNCTION}">$2</rest:uri-param>
  <rest:uri-param name="format">$3</rest:uri-param>
  <rest:http method="GET"/>
  <rest:http method="HEAD"/>
</rest:request>

Then all works fine. It might be an idea to build this into the default deployment and set DEFAULT-FUNCTION to main() so that appbuilder still works out of the box.

ml env restart only restarts target host, not the cluster

Fully removing app servers from MarkLogic requires a restart. If you do "ml {env} wipe" followed by "ml {env} bootstrap", you're told that a restart is necessary. You can then to "ml {env} restart". However, this only restarts the target box, not the cluster, so other servers in the cluster may still be in a funky state. Update the restart command to restart the cluster. Update documentation accordingly.

show handy error message for SEC-PRIV

Much like we do for missing controllers we should show a handy, dandy error message for SEC-PRIV that directs the Roxy user where to add the missing privileges.

Can't add element word lexicons via of Roxy...

I was trying to setup a element word lexicon to use with search:suggest and I tried adding the following which seemed to make sense:

http://www.stratml.net/PerformancePlanOrReport Description http://marklogic.com/collation/

Though this didn't work. Can we get this added to the roxy deployer?

Thanks,

Andy...

I want to use the deploy tool to capture an existing configuration

Something like: "ml local capture", which would use the application name, servers, and ports, look at the target server, and build deploy/ml-config.xml. It would probably make sense for this to capture particular features (db settings, range indexes) rather than the whole config, so that the substitutions could remain in place.

Use-View (router.xqy) issue/bug?

A MISSING-VIEW (XDMP-MODNOTFOUND) error is thrown, when trying to use:
ch:use-view("welcome")

from a controller method.

WORKAROUND: This does work when you specify the controller in the use-view method as shown below:

ch:use-view("controller/welcome")

Add Command to Pull Latest Code from Repository

Some shops will want to automate the source code repository retrieval process.

Can you please add a new command to retrieve the latest code from an SVN and VSS repository?

Example:

ml local getsvn
ml local getvss

Example build.properties for SVN:

svn-url=svn+ssh://[email protected]/project
svn-user=guest
svn-passwd=password

Example build.properties for VSS:

vss-dir=\\avalon\VSS\VSS_LSP
vss-user=guest
vss-passwd=password

Default settings for database configuration

It will be quite handy that during setup:apply-database-settings at xquery/setup.xqy, instead of doing nothing whenever a value it's not set, it would default to some other value.

Like this, we would make sure that the database configuration and the configuration are perfectly aligned after a bootstrap.

Example:

let $value := setup:get-setting-from-database-config-as-string($database-config, "directory-creation")
let $admin-config :=
   if ($value) then
       admin:database-set-directory-creation($admin-config, $database, $value)
  else
       admin:database-set-directory-creation($admin-config, $database, "manual")

After a bootstrap it won't matter if somebody changed the setting manually or somebody removed the line from the config file. The setting will default to Manual and automatic directory creation will be disabled.

Thanks!

Again: I could send a pull request if you think it's interesting for everybody else.

Element indexes collation type root/unicode doesn't work for both unit testing & app

In a Roxy application I've create an element range index with the default collation (root collation -> http://marklogic.com/collation/) this resulted to the following:

  • the unit tests were working just fine
  • the application itself was giving the error that the element range index can not be found.

Switched the collation type of the index to unicode codepoint (http://marklogic.com/collation/codepoint):

  • the application was working fine
    • the unit tests were giving the error that the element range index can not be found.

I've tested the application using the test DB, this won't happen in the feature, but it would be very uncomfortable to have two DB configs to maintain - one for the test DB and one for the app DB and just keep on changing the index collations.

Thank you!
Silvia

Force init not working

dcassel@madison:roxy $ ml init my-app --force
ERROR: Init has already been run. Use --force to rerun it.

ERROR: Missing environment for --force

Ignore system path

When inserting documents into the modules database (and potentially the content database also), ignore the filesystem's path, and just place the files under "src" into the database.

/Users/pmcgowan/Documents/workspace/marklogic-roxy//custom/config/datasource-config.xqy

should be

/custom/config/datasource-config.xqy

ml env bootstrap doesn't complain on error

On "ml local bootstrap", the script responds with "Bootstrap Complete" with no error message, even if there was an error. The error can be seen with "ml local bootstrap -v". Having an error in deploy/ml-config.xml (for instance, a mismatched closing tag) will trigger the problem.

Privileges sometimes get dropped from roles

When bootstrapping, the setup script looks for any privileges referred to by deploy/ml-config.xml. For any it finds, it first deletes them, then recreates them based on the specification in deploy/ml-config.xml. I think the motivation for this is to avoid accidentally having a definition of an execute privilege that doesn't match what's in your config file. The problem is that if I have a role X with privilege A, and then I bootstrap a project that creates role Y with privilege A, then because A gets deleted and recreated, role X no longer has it. A couple possible solutions come to mind:

  1. Don't delete then recreate. If a privilege exists, just leave it alone.
    -- Possible side effect: if the name of a privilege in my project conflicts with the name of another project's privilege, my project will accidentally end up using the one defined by the other project. This would solve the problem of standard privileges getting removed from roles. Encouraging a naming convention for project-specific privileges might be enough here.
  2. As part of setup:create-privilege(), first record which roles have the privilege, then restore when the privilege gets recreated.
    -- Side effects possible here. Suppose my project has a privilege with some URI and another project uses the same name but a different URI. The URI associated with the name will depend on which project has bootstrapped more recently. Again, this would solve the problem for standard privileges.
  3. Change the config to explicitly define the privileges you want, then just refer to them by name when assigning them to roles. So you might have /configuration/sec:privileges/sec:privilege to define an app-specific privilege, then in /configuration/sec:roles/sec:role/sec:privileges, you'd only have a sec:privilege-name, not the action or type.
    -- Conflicts with other project-specific privileges would still be possible, but at least the standard privileges would be left alone. We should encourage naming conventions to avoid project-specific privilege name collisions.

I'm thinking #1 would be sufficient. Comments?

Support geospatial-element-child-index

Adding a geospatial-element-child-index to deploy/ml-config.xml does not let "ml {env} bootstrap" create that index

  • Set up the deploy script so that it will build the index if provided
  • Add a sample index comment in the deploy/ml-config.xml file

Support geospatial-element-index

Adding a geospatial-element-index to deploy/ml-config.xml does not let "ml {env} bootstrap" create that index

  • Set up the deploy script so that it will build the index if provided
  • Add a sample index comment in the deploy/ml-config.xml file

Add ability to clear/load CA's

Clearing out the pre-installed CA's takes twice as long as it takes to install MarkLogic. Would be nice to have the ability to clear the default CA's, and also load a group of CA's from a text file, similar to the functionality provided using the import feature on the ML CA admin page.

Support multiple group deployment

It would be very useful to have the bootstrap process be able to create groups and assign hosts to those groups. The configuration would need to allow you to specify which group or groups you want your application installed on.

Views question

It's not clear how you can call a view from a view.
ch:use-layout((), "xml"),
ch:use-layout("...", "html")
a bit more information how to use those helpers in Single page websites

Fix Documentation on Controller-Helpers Page

declare function c:register() as item()*
{
ch:use-view("welcome", ("html")),
lib:something-useful()
};
This says that when a client requests /user/register.html, use the view at /src/views/register.html.xqy.


This should use the view at: /src/views/welcome.html.xqy

More error logging in bootstrap code would be nice

Some of the catch clauses in deploy/lib/xquery/setup.xqy log the exception, but many do not. It would be very helpful to log at least some of these that are not currently logged. The two in particular that would have saved me some time are in setup:apply-database-settings() and setup:configure-http-server(). In general, I would think any failure that would cause a significant portion of the configuration not to succeed (like configuring a database or app server) should be logged.

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.