Skip to content
This repository was archived by the owner on Oct 2, 2020. It is now read-only.

System setup

Arthur Attwell edited this page Mar 27, 2015 · 3 revisions

This is guidance for developers on how to set up a Paperight server instance.

Introduction

The Paperight website turns print shops into print-on-demand bookstores. This is a guide to set up and run the Paperight enterprise system on Windows locally.

Ensure you have Java 1.7 installed, and that it is added to the system environment variables. This system does not currently work with Java 8.

Ensure you have Tomcat 6 or later installed and running.

Checkout from Github

Check out the source code from the Github repository to local disk:

https://github.com/Paperight/website

The source code is split into the website and the server, with the common and common-web-elements used in both systems.

Installation

IDE

The following section discusses the IntelliJ IDE installation and setup. You can follow a similar process if you use a different IDE.

Setup

Download the latest Intellij IDEA:

https://www.jetbrains.com/idea/download/

(You can download the latest Spring Tool Suite (STS), if you prefer to use Eclipse-based IDE, from this location: http://spring.io/tools/sts/all).

Follow setup instructions to install the IDE.

Import

Once IntelliJ is installed, open the IDE and go to File -> Import Project…, and navigate to the source code location. Select the project and follow instructions to open the project.

(For STS, open STS, go to File -> Import -> General -> Existing Projects into Workspace, and select the root directory of the source code).

Once the project is open, update the maven dependencies, so that missing libraries and downloaded and added to project.

Tomcat Servers

Create two Tomcat servers, one for the website, and one for the server.

On the toolbar at the top of IntelliJ, click the down arrow just to the left of the Run and Debug icons. There will be an option to Edit Configurations. In the resulting popup, click the Add icon, then click Tomcat and Local.

From that dialog, you will need to click the Configure... button next to Application Server to tell IntelliJ where Tomcat is installed.

In STS, open the Servers view by navigating to Window -> Show View – Servers.

Right-click anywhere in the view, and select New -> Server. Once a pop-up appears, select Apache -> Tomcat v6.0 Server or later and setup your server. Repeat for the website as well.

Prince PDF

Download and install the latest Prince PDF:

http://www.princexml.com/download/

This will be required to generate PDFs.

Setup Database

The system uses a MySQL database. You need to create a local MySQL database. Once the database is created, you need to run a Spring-Batch-Core scripts against it.

In the Spring-Batch-Core library’s root folder from the Maven dependencies, locate the schema-mysql.sql file, and run it against your database.

Configure System Properties

application.properties

Server

PropertyValue
base.urlThe base URL for the server e.g. http://localhost:8090/server
rest.usernameUsername for REST authentication
rest.passwordPassword for REST authentication
pdf.file.folderThe PDF files folder e.g. C:\Paperight\Resources\data\pdfs
pdf.download.licence.file.folderLocation for downloaded licence invoices
pdf.download.earning.file.folderLocation for downloaded publisher earning invoices
licenced.pdf.file.folderThe licences folder e.g. C:\Paperight\Resources\data\pdfs\licences
jacket.image.file.folderThe jacket images file folder e.g. C:\Paperight\Resources\data\jacket_images
product.file.upload.folderThe product file uploads folder e.g. C:\Paperight\Resources\data\product_file_uploads
product.file.upload.staged.folderProduct file upload staged folder
bulk.product.data.folderBulk product data folder
converted.bulk.product.data.folderConverted bulk product data folder
bulk.default.css.fileBulk default CSS file path
lucene.index.folderThe Lucene search index folder e.g. C:\Paperight\Resources\data\lucene_indexes
ip2country.lookup.data.filenameThe GeoIP country lookup location e.g. C:\Paperight\Resources\data\geoip\GeoIP.dat
html.pdf.css.folderThe PDF css location e.g. C:\Paperight\Resources\css
html.folderThe HTML source location e.g. C:\Paperight\Resources\html
wkhtmltopdf.executable.locationThe wkhtmltopdf executable location e.g. C:\Program Files (x86)\wkhtmltopdf1\wkhtmltopdf.exe
princepdf.executable.locationThe prince PDF executable location e.g. C:\DevTools\Prince\Engine\bin\prince.exe
email.usernameThe SMTP email username
email.passwordThe SMTP email password
email.hostThe SMTP email host e.g. root
email.portThe SMTP email port e.g. 25
email.from.defaultThe default ‘from’ email address
email.from.defaultThe default ‘from’ name
email.to.defaultThe default ‘to’ email address
bitly.usernameBitly username
bitly.api.keyBitly API key
amazon.access.key.idAmazon access key ID
amazon.secret.keyAmazon secret key
amazon.associate.idAmazon associate ID
docraptor.api.urlDocraptor API URL e.g. http://docraptor.com/docs
docraptor.api.keyDocraptor API key

Website

PropertyValue
base.urlThe base URL for the website e.g. http://localhost:8080/website
server.rest.hostThe base URL for the server e.g. http://localhost:8090/server
server.rest.usernameUsername for server REST authentication
server.rest.passwordPassword for server REST authentication
lucene.index.folderThe Lucene search index folder e.g. C:\Paperight\Resources\data\lucene_indexes
email.usernameThe SMTP email username
email.passwordThe SMTP email password
email.hostThe SMTP email host e.g. root
email.portThe SMTP email port e.g. 25
email.from.defaultThe default ‘from’ email address
email.from.default.nameThe default ‘from’ name
email.to.defaultThe default ‘to’ email address
paypal.api.sandboxtrue or false. Set to true for local environment
paypal.api.userThe PayPal API username
paypal.api.passwordThe PayPal API password
paypal.api.signatureThe PayPal API signature
ip2country.lookup.data.filenameThe GeoIP country lookup location e.g. C:\Paperight\Resources\data\geoip\GeoIP.dat
pdf.file.folderThe PDF files folder e.g. C:\Paperight\Resources\data\pdfs
licenced.pdf.file.folderThe licences folder e.g. C:\Paperight\Resources\data\pdfs\licences
jacket.image.file.folderThe jacket images file folder e.g. C:\Paperight\Resources\data\jacket_images
princepdf.executable.locationThe prince PDF executable location e.g. C:\DevTools\Prince\Engine\bin\prince.exe

database.properties

Server

PropertyValue
jdbc.driver.classNamecom.mysql.jdbc.Driver
jdbc.urlThe URL to the local database e.g. jdbc:mysql://localhost/paperight
jdbc.usernameThe database username
jdbc.passwordThe database password

Website

PropertyValue
jdbc.driver.classNamecom.mysql.jdbc.Driver
jdbc.urlThe URL to the local database e.g. jdbc:mysql://localhost/paperight
jdbc.usernameThe database username
jdbc.passwordThe database password

batch.properties

Server

PropertyValue
jdbc.driver.classNamecom.mysql.jdbc.Driver
jdbc.urlThe URL to the local database e.g. jdbc:mysql://localhost/paperight
jdbc.usernameThe database username
jdbc.passwordThe database password
batch.jdbc.testWhileIdletrue or false
batch.jdbc.validationQueryQuery for validation e.g. SELECT 1
batch.schema.scriptclasspath:/org/springframework/batch/core/schema-mysql.sql
batch.drop.scriptclasspath*:/org/springframework/batch/core/schema-drop-mysql.sql
batch.business.schema.scriptBlank
batch.database.incrementer.classorg.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer
batch.data.source.inittrue or false
batch.remote.base.urlThe base URL for batch server e.g. http://localhost:8090/server/batch

Running the System

Select a Tomcat server configuration that you wish to run, and click ‘Run’ to start the application.

Alternatively, in an IDE such as Eclipse, right-click on the project and select Run As -> Run on Server to start the application.

Clone this wiki locally