Installing AppCivist in your server entails installing each of the following components, as shown in the image below. This guide explains how to download and install the AppCivist Core Platform and the AppCivist database.
![AppCivist alpha prototype simplified architecture](images/Prototype Implementation Architecture.png)
The AppCivist Core Platform provides a RESTful API implemented with the full-stack Playframework. Follow these instructions to download the source code and run it.
- Install activator: install Typesafe Activator and make sure to have its binaries available in your PATH. Alternatively, you can go to step (2) and simply use the compiled activator binary we included in the root folder of this repository.
- Download the source code: clone the source code repository in github
- Prepare configuration files:
- Make a copy of conf/local.sample.conf into conf/local.conf and into conf/local.test.conf.
- Make a copy of conf/local.logback.sample.xml into conf/local.logback.xml.
- Make a copy of conf/play-authenticate/mine.conf.sample into conf/play-authentica/mine.local.conf and replace email address with and email address you own
- Make a copy of conf/play-authenticate/smtp.conf.sample into conf/play-authentica/smpt.local.conf and replace email and passwords with your own.
- In conf/local.conf and conf/local.test.conf, replace the configuration values that start with "${?*" with required credentials for IMGUR, Amazon S3 and MapBox API.
- Change the variable application.baseUrl to point to the url of your deployment (i.e., http://localhost:9000/). Change also the varialbe appcivist.invitations.baseUrl to point to the base URL of the frontend prototype to use.
- Change the variable application.contributionFiles to point to the url of your deployment (i.e., http://localhost:9000/). Change also the varialbe appcivist.invitations.baseUrl to point to the base URL of the frontend prototype to use.
- Make sure you never commit the files in previous steps into the repository.
- Create the database (only for testing, NOT for production): for testing purposes, you can simply use in-memory H2 database already configured by default in the sample configuration file. If you do this, make sure to enable evolutions first (see how below). Otherwise, install postgresql or mysql and configure the platform to use them (see below).
# Enabling Evolutions
# ~~~~~
evolutions {
enabled=true
db {
default {
autoApply=true
}
}
}
-
Create the database (for production): disable Evolutions and install postgresql or mysql. Instead of evolution scripts, use the scripts conf/sql/database-create-XXXX.sql to create the database( XXXX = postgres for for PostgreSQL databases, XXXX = mysql for MySQL databases).
-
Configure the database: if you use H2, skipt this step. If you use something else, replace the driver, database name, username and password you use with the database.
# Example of database configuration for PostgreSQL
db {
default {
driver=org.postgresql.Driver
url="jdbc:postgresql://localhost:5432/appcivistcore"
username=root
password="12345"
}
}
- On a console, access your local copy of appcivist-core source code: cd <PATH_TO_YOUR_LOCAL_REPO>/appcivist-platform
- Run the command activator to enter the typsafe activator console (or if you want to enable debugging from your IDE, use activator -jvm-debug 9999 -D). It will automatically download all the dependencies and setup the play framework.
- OPTIONAL. Follow Play Framework's Get Started guide to learn more about how the project is organized
- Run the server using the following command run -Dconfig.resource=local.conf -Dlogger.file=conf/local.logback.xml
- On your browser, go to http://localhost:9000/api/doc to visit the documentation of the API endpoints and have try them out with real examples.
This file will be packaged with your application, when using activator dist
.
In production settings, ./activator stage
will compile the app and create an executable binary. You can then use this sample to create a proper init.d script