System setup - Paperight/website GitHub Wiki
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
Property | Value |
---|---|
base.url | The base URL for the server e.g. http://localhost:8090/server |
rest.username | Username for REST authentication |
rest.password | Password for REST authentication |
pdf.file.folder | The PDF files folder e.g. C:\Paperight\Resources\data\pdfs |
pdf.download.licence.file.folder | Location for downloaded licence invoices |
pdf.download.earning.file.folder | Location for downloaded publisher earning invoices |
licenced.pdf.file.folder | The licences folder e.g. C:\Paperight\Resources\data\pdfs\licences |
jacket.image.file.folder | The jacket images file folder e.g. C:\Paperight\Resources\data\jacket_images |
product.file.upload.folder | The product file uploads folder e.g. C:\Paperight\Resources\data\product_file_uploads |
product.file.upload.staged.folder | Product file upload staged folder |
bulk.product.data.folder | Bulk product data folder |
converted.bulk.product.data.folder | Converted bulk product data folder |
bulk.default.css.file | Bulk default CSS file path |
lucene.index.folder | The Lucene search index folder e.g. C:\Paperight\Resources\data\lucene_indexes |
ip2country.lookup.data.filename | The GeoIP country lookup location e.g. C:\Paperight\Resources\data\geoip\GeoIP.dat |
html.pdf.css.folder | The PDF css location e.g. C:\Paperight\Resources\css |
html.folder | The HTML source location e.g. C:\Paperight\Resources\html |
wkhtmltopdf.executable.location | The wkhtmltopdf executable location e.g. C:\Program Files (x86)\wkhtmltopdf1\wkhtmltopdf.exe |
princepdf.executable.location | The prince PDF executable location e.g. C:\DevTools\Prince\Engine\bin\prince.exe |
email.username | The SMTP email username |
email.password | The SMTP email password |
email.host | The SMTP email host e.g. root |
email.port | The SMTP email port e.g. 25 |
email.from.default | The default ‘from’ email address |
email.from.default | The default ‘from’ name |
email.to.default | The default ‘to’ email address |
bitly.username | Bitly username |
bitly.api.key | Bitly API key |
amazon.access.key.id | Amazon access key ID |
amazon.secret.key | Amazon secret key |
amazon.associate.id | Amazon associate ID |
docraptor.api.url | Docraptor API URL e.g. http://docraptor.com/docs |
docraptor.api.key | Docraptor API key |
Website
Property | Value |
---|---|
base.url | The base URL for the website e.g. http://localhost:8080/website |
server.rest.host | The base URL for the server e.g. http://localhost:8090/server |
server.rest.username | Username for server REST authentication |
server.rest.password | Password for server REST authentication |
lucene.index.folder | The Lucene search index folder e.g. C:\Paperight\Resources\data\lucene_indexes |
email.username | The SMTP email username |
email.password | The SMTP email password |
email.host | The SMTP email host e.g. root |
email.port | The SMTP email port e.g. 25 |
email.from.default | The default ‘from’ email address |
email.from.default.name | The default ‘from’ name |
email.to.default | The default ‘to’ email address |
paypal.api.sandbox | true or false. Set to true for local environment |
paypal.api.user | The PayPal API username |
paypal.api.password | The PayPal API password |
paypal.api.signature | The PayPal API signature |
ip2country.lookup.data.filename | The GeoIP country lookup location e.g. C:\Paperight\Resources\data\geoip\GeoIP.dat |
pdf.file.folder | The PDF files folder e.g. C:\Paperight\Resources\data\pdfs |
licenced.pdf.file.folder | The licences folder e.g. C:\Paperight\Resources\data\pdfs\licences |
jacket.image.file.folder | The jacket images file folder e.g. C:\Paperight\Resources\data\jacket_images |
princepdf.executable.location | The prince PDF executable location e.g. C:\DevTools\Prince\Engine\bin\prince.exe |
database.properties
Server
Property | Value |
---|---|
jdbc.driver.className | com.mysql.jdbc.Driver |
jdbc.url | The URL to the local database e.g. jdbc:mysql://localhost/paperight |
jdbc.username | The database username |
jdbc.password | The database password |
Website
Property | Value |
---|---|
jdbc.driver.className | com.mysql.jdbc.Driver |
jdbc.url | The URL to the local database e.g. jdbc:mysql://localhost/paperight |
jdbc.username | The database username |
jdbc.password | The database password |
batch.properties
Server
Property | Value |
---|---|
jdbc.driver.className | com.mysql.jdbc.Driver |
jdbc.url | The URL to the local database e.g. jdbc:mysql://localhost/paperight |
jdbc.username | The database username |
jdbc.password | The database password |
batch.jdbc.testWhileIdle | true or false |
batch.jdbc.validationQuery | Query for validation e.g. SELECT 1 |
batch.schema.script | classpath:/org/springframework/batch/core/schema-mysql.sql |
batch.drop.script | classpath*:/org/springframework/batch/core/schema-drop-mysql.sql |
batch.business.schema.script | Blank |
batch.database.incrementer.class | org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer |
batch.data.source.init | true or false |
batch.remote.base.url | The 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.