|
2 | 2 |
|
3 | 3 | README for Version 1.0.0-ea2 |
4 | 4 |
|
5 | | -A demonstration of using MarkLogic in a three-tier application architecture. |
6 | | - |
7 | | -The application implements a "Question and Answer" Scenario. |
| 5 | +Samplestack is a demo "Question and Answer" web application that shows you how to integrate MarkLogic into a three-tier application architecture (browser, application server, and database). |
8 | 6 |
|
9 | 7 | This release features a middle tier for the Java Enterprise Developer, implemented using Java, Spring, and Gradle. |
10 | 8 |
|
11 | | -## Usage |
| 9 | +The project includes the following major components: |
| 10 | +* Web/browser front end based on Angular.js |
| 11 | +* Middle appserver tier implemented in Java/Spring |
| 12 | +* Database tier hosted on MarkLogic |
| 13 | +* Gradle framework to drive build and configuration of the appserver and database tiers |
| 14 | +* Unit tests |
| 15 | + |
| 16 | +This README covers the following topics: |
| 17 | +* [Prerequisites](#prerequisites) |
| 18 | +* [Getting Started](#getting-started) |
| 19 | +* [Additional Information](#additional-information) |
| 20 | +* [License](#license) |
| 21 | + |
| 22 | +## Prerequisites |
| 23 | +To configure and use this application, you need the following software: |
| 24 | +* Java JDK 1.7 |
| 25 | +* MarkLogic 8 EA2 (see instructions [below](#getting-started)) |
| 26 | +* Node.js, version 0.10 or later. See [nodejs.org](http://nodejs.org). |
| 27 | +* A global installation of the Node.js components [bower](http://bower.io) and [gulp](https://github.com/gulpjs/gulp). For details, see [Global Utilities](browser/README.md#global-utilities) in the [browser README](browser/README.md). |
| 28 | + |
| 29 | +The setup instructions assume you have the `git`, `javac`, `node`, `bower`, and `gulp` commands on your path. |
| 30 | + |
| 31 | +The setup procedure may install additional software, such as Gradle and Angular. |
| 32 | + |
| 33 | +## Getting Started |
| 34 | +Follow this procedure to set up samplestack in your environment. |
| 35 | + |
| 36 | +1. Install MarkLogic 8 Early Access. See http://ea.marklogic.com/download. |
| 37 | + |
| 38 | +2. Start MarkLogic. For details, see the [MarkLogic Installation Guide](http://docs.marklogic.com/guide/installation/procedures#id_92457). |
12 | 39 |
|
13 | | -### Prerequisites |
| 40 | +3. Clone this repository. For example, run the following command: |
| 41 | + |
| 42 | + ``` |
| 43 | + git clone https://github.com/marklogic/marklogic-samplestack |
| 44 | + ``` |
| 45 | +4. [Set up the middle and database tiers](#setting-up-the-middle-and-database-tiers). |
| 46 | +
|
| 47 | +5. [Set up the browser tier](#setting-up-the-browser-tier). |
| 48 | +
|
| 49 | +
|
| 50 | +### Setting Up the Middle and Database Tiers |
| 51 | +The setup assume you have MarkLogic Server running on your localhost and that your Admin user credentials are admin:admin. To change this, modify `appserver/java-spring/gradle.properties`. |
| 52 | +
|
| 53 | +To install required software, configure, and build the Java middle tier and database tier of samplestack, run the following commands from the root of your cloned repository: |
14 | 54 |
|
15 | | -* install MarkLogic and start it: http://ea.marklogic.com/download |
16 | | -* clone this repository: |
17 | 55 | ```bash |
18 | | -git clone https://github.com/marklogic/marklogic-samplestack |
| 56 | +cd appserver/java-spring |
| 57 | +./gradlew appserver |
19 | 58 | ``` |
20 | 59 |
|
21 | | -### Java/Spring implementation |
| 60 | +If the command fails such that you need to run it again, run the following command first to reset the database state: |
22 | 61 |
|
23 | | -*See the [README in appserver/java-spring directory](appserver/java-spring/README.md)* |
| 62 | +```bash |
| 63 | +./gradlew dbteardown |
| 64 | +``` |
24 | 65 |
|
25 | | -* `cd appserver/java-spring` |
26 | | -* `./gradlew appserver` |
| 66 | +This command will not return. When you see output of the following form, the mi ddle tier is running, and you can proceed with the browser tier setup: |
| 67 | +``` |
| 68 | +Started Application in X seconds... |
| 69 | +>Building 85% > :bootRun |
| 70 | +``` |
| 71 | + |
| 72 | +Successfully completing this step does the following: |
| 73 | +* Bootstraps the middle tier. |
| 74 | +* Builds the Java middle tier components. |
| 75 | +* Loads the database with sample data. |
| 76 | +* Starts up the middle tier and MarkLogic application services. |
| 77 | + |
| 78 | +The middle tier App Server runs on port 8090 by default. Visit http://localhost:8001 if you need to administer the database. |
| 79 | + |
| 80 | +*For details, see the [README in the appserver/java-spring directory](appserver/java-spring/README.md)* |
| 81 | + |
| 82 | +### Setting Up the Browser Tier |
| 83 | +Use the following procedure To install required software and bootstrap the samplestack browser tier. You should already have the middle and database tiers running. |
| 84 | + |
| 85 | +For detailed instructions and troubleshooting, see the [README in the browser directory](browser/README.md). |
| 86 | + |
| 87 | +**NOTE:** If you are on Windows, you must use a Windows command shell, not Cygwin. |
| 88 | + |
| 89 | +1. Go to the browser subdirectory of the project: |
27 | 90 |
|
28 | | -See README.md in appserver/java-spring for further information on the samplestack-java |
| 91 | + ```bash |
| 92 | + cd browser |
| 93 | + ``` |
| 94 | +2. Install the browser application. |
29 | 95 |
|
30 | | -### Browser/Web Application |
| 96 | + ```bash |
| 97 | + npm install |
| 98 | + bower install |
| 99 | + ``` |
| 100 | +3. Run the following command to build the web application, run its unit tests, and bring up the required execution environment: |
| 101 | + |
| 102 | + ```bash |
| 103 | + gulp run |
| 104 | + ``` |
| 105 | + |
| 106 | +When the setup successfully completes, you should see information about the available web servers running the application. The `gulp run` command does not return. |
| 107 | + |
| 108 | +### Running the Application |
| 109 | +Once you have the database, appserver, and browser tiers of the application configured and running, navigate to the following URL in your browser to explore the application: |
| 110 | + |
| 111 | +`http://localhost:3000/` |
| 112 | + |
| 113 | +To restart the middle tier App Server and browser tier web servers in the future, run the following commands: |
| 114 | +```bash |
| 115 | +cd appserver/java-spring |
| 116 | +./gradlew bootrun |
| 117 | +cd ../../browser |
| 118 | +gulp run |
| 119 | +``` |
31 | 120 |
|
32 | | -*See the [README in the browser directory](browser/README.md)* |
| 121 | +### Next Steps |
| 122 | +* Explore the application running at http://localhost:3000. |
| 123 | +* Explore the README in the database, appserver and browser directories for details on each tier. |
| 124 | +* View the database configuration by visiting http://localhost:8001. |
| 125 | +* Explore the database contents using Query Console. Go to http://localhost:8000/qconsole, select the samplestack database, and click Explore. |
| 126 | + |
| 127 | +## Additional Information |
| 128 | +For more information, see the following: |
| 129 | +* README for the [database](database/README.md), [appserver](appserver/java-spring/README.md), and [browser](browser/README.md) tier. |
| 130 | +* [Samplestack wiki](wiki). |
| 131 | +* [MarkLogic product documentation](http://docs-ea.marklogic.com). The credentials are available on the MarkLogic EA download page. |
33 | 132 |
|
34 | 133 | ## License |
35 | 134 |
|
|
0 commit comments