Coder Social home page Coder Social logo

marklogic / ml-app-deployer Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 20.0 3.3 MB

Java client for the MarkLogic REST Management API

License: Other

Java 99.65% XQuery 0.05% Makefile 0.15% C++ 0.15% JavaScript 0.01%
java java-library marklogic resttemplate

ml-app-deployer's People

Contributors

billfarber avatar cskeefer avatar dependabot[bot] avatar hansenmc avatar paxtonhare avatar peetkes avatar rjrudin avatar ryanjdew avatar sameerapriyathamtadikonda avatar sastafford avatar tammyhale avatar ucal avatar

Stargazers

 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

ml-app-deployer's Issues

Get amp ID based on all fields

Just using local-name won't work when two amps have the same local-name but reference different modules databases. Will need to do a GET on all those fields to get the system ID for the amp.

Create HTTP server with certificate template

Need a way to create a certificate template and then refer to it by ID in the JSON/XML for a server.

That means whenever a resource is created, we want to save in CommandContext - possibly in AppConfig's map of tokens - the name of the created resource and the ID that was generated for it. That won't apply for all resources, but we should do it for the ones it applies for.

For a template named "sample-app-template", the server file could then have the following in it:

"ssl-certificate-template": "%%certificate-template-id:sample-app-template%%"

Manage CPF via REST API

As a ML developer
I want to TITLE
So that I don't have to set it up manually or define Gradle tasks for each domain and pipeline

  • Subdirectories of cpf-configs, domains, and pipelines
  • CpfManager

Load config from multiple directories

Needed for a project where a dependency needs to contribute its own config. I think AppConfig will need a List, and commands will need to figure out what to do with that list.

In general, we'll want to load the dependency config first. The content database is different - we'll still do a merge there.

Support custom tokens

DefaultTokenReplacer should allow for a Properties object to be passed in so it's easy for e.g. a Gradle user to support custom tokens and values.

Load assets via XCC from any directory

As an ML developer
I want to TITLE
So that my project can have multiple directories with modules in them, similar to how Roxy has a /src directory and a /rest-api directory

Update content database using multiple JSON files

As an ML developer
I want to TITLE
So that I can split my database configuration across multiple JSON files, as I don't always want to include all of them based on what I'm doing

  • e.g. a library has normal config, and then for its own JUnit tests, it may add additional config that it wouldn't want to be part of its distributed config

Create triggers database via app config property

As an ML developer
I want to TITLE
So that I don't have to stub out a triggers database file that will probably only ever have the database name in it

  • e.g. appConfig.setCreateTriggersDatabase(boolean)
  • I think this should default to true, since a triggers database is a useful thing to have for most apps
  • ml-gradle can then check for e.g. mlCreateTriggersDatabase as a way of setting this piece of config

Clear content database

As an ML developer
I want to TITLE
So that I can get this done via the command line instead of having to click through the admin tool

  • Will be used by ml-gradle's mlClearContentDatabase task

Generate project scaffold

As an ML developer
I want to TITLE
So that I don't have to manually stub out the config and modules directories, and I also want basic implementations of common config files like for a REST API server and for a content database

Wait for server restart

As an ML developer
I want to TITLE
So that my build script can delete multiple servers successfully

  • Can use /admin/v1/timestamp

Load modules during app deployment

As an ML developer
I want to TITLE
So that I don't have to do this manually, and so I can also ensure this happens at the right time between all the other deployment steps

Load assets via XCC by default

As an ML developer
I want to TITLE
So that I get the quicker performance of XCC vs HTTP

  • With port 8000 in ML8, there's almost no reason to use /v1/ext for loading modules
  • This may be more of a mod to ml-javaclient-util so that ml-junit benefits as well. DefaultModulesLoader can default to using 8000, which means it will then handle updating the last-loaded timestamp for the module as well.

Delete REST API

As an ML developer
I want to TITLE
So that I have a reliable way for completely removing the app server, modules database, and content database created by /v1/rest-apis

  • the XQuery script I've used has never been 100% reliable
  • a DELETE on /v1/rest-apis/(name) seems to be the way to go for the appserver/modules/content dbs

Create bootstrap roles and users as admin user

Ideally, nothing is done as the admin user except for creating some initial roles and users for an app. The rest of a deployment is then done as an app-specific user with the necessary roles and privileges.

Ingest XQuery workspaces to MarkLogic

As a user
I want to TITLE
So that I can share Query Console workspaces with other developers

Routinely, I want to share a bunch of xquery snippets with customers and have that show up automatically in a qc workspace. This would be a really neat feature for starters.

/project
/src
/test
/xqy
/qconsole
/
query1.xqy
query2.js
:

Manage temporal config via Mgmt API

As an ML developer
I want to TITLE
So that I don't have to manually configure bitemporal features in an application

  • I think an AxesManager that extends AbstractResourceManager would work for the /axes endpoints, as those URL patterns fit the assumptions that AbstractResourceManager makes.
  • I don't think a CollectionsManager can extend AbstractResourceManager, because the URL pattern - which requires a collection param on the querystring - fits the assumptions made by AbstractResourceManager.
  • Looks like the LSQT stuff needs separate public methods as well

Create database with forests

Need this ability to allow for the /v1/rest-apis call to use an existing database that has forests configured in a specific manner.

Create triggers database for project

As an ML developer
I want to TITLE
So that I don't have to manually setup a triggers database for my project

  • The ProjectManager (now called ConfigManager, should be renamed) should automatically check for this after creating the REST API, which creates the content database
  • The triggers database would be created, and then the content database would be updated to point to the triggers database

Manage users via REST API and config files

As a ML developer
I want to TITLE
So that I don't have to create users manually or define a task for each one

Manage database rebalancer config via Mgmt API

https://docs.marklogic.com/REST/management/database-rebalancer

Manage = provide support for creating and updating partitions. Should require the following new classes:

  • PartitionManager
  • DeployPartitionsCommand

We'll need a directory structure that allows for associating a payload with a database, as the payload itself cannot specify the database. I think this should do the trick:

ml-config/partitions/(name-of-database)/partition1.json
ml-config/partitions/(name-of-database)/partition2.json

The rebalancer endpoints are out of scope for this ticket, just need support for creating and updating partitions.

Clear modules database

As an ML developer
I want to TITLE
So that I can easily ensure that any modules that have been deleted from version control are no longer in my modules database

Configure tests via Spring and system properties

The tests for ml-app-deployer currently assume a username/password combo of admin/admin. This won't always be the case, and so we should first read in config from gradle.properties using ml-junit, and then we should allow for an optional, non-version-controlled file to be read in to override what's in gradle.properties.

Wait for restart in more robust fashion

AdminManager currently has a very simple impl that just calls /admin/v1/timestamp until it doesn't catch an error. A more robust impl would care about the last restart timestamp being updated and handle exceptions more gracefully.

Some code I had written before on this, but it wasn't quite working - it needs to at least catch a ResourceAccessException that is thrown by RestTemplate when ML isn't available - i.e. when no HTTP response is returned:

public void waitForRestart(String lastRestartTimestamp) {
logger.info("Ignore any HTTP client logging about socket exceptions and retries, those are expected while waiting for MarkLogic to restart");
try {
while (true) {
sleepUntilNextRestartCheck();
try {
String restart = getLastRestartTimestamp();
if (restart != null && !restart.equals(lastRestartTimestamp)) {
logger.info(String
.format("MarkLogic has successfully restarted; new restart timestamp [%s] is greater than last restart timestamp [%s]",
restart, lastRestartTimestamp));
break;
}
} catch (HttpServerErrorException hsee) {
if (HttpStatus.SERVICE_UNAVAILABLE.equals(hsee.getStatusCode())) {
logger.warn("Waiting for restart, service unavailable, will keep waiting");
} else {
throw hsee;
}
}
}
} catch (Exception e) {
String message = "Caught exception while waiting for MarkLogic to restart: " + e.getMessage();
if (logger.isDebugEnabled()) {
logger.warn(message, e);
} else {
logger.warn(message);
}
}
}

Predefined search options need to be loaded into the http-test appserver

I'm writing some unit tests using the QueryManager and predefined search options. Apparently, the namespace uri contains the name of the appserver.

/Default//rest-api/options/default.xml

If I run the QueryManager Java Client API class against the test app server, then it is going to look for the following uri.

/Default/-test/rest-api/options/default.xml

The options are executed against the app server and not the test app server.

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.