Kansalaisaloite.fi / Medborgarinitiativ.fi
Java JavaScript FreeMarker CSS Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
etc
src
.gitignore
COPYING.md
Gruntfile.js
LICENSE.md
README.md
initdb-mac.sh
initdb-win.sh
keystore
package.json
pom.xml

README.md

What and why

Kansalaisaloite.fi / Medborgarinitiativ.fi is a web service for launching citizens’ initiatives and collecting statements of support for these initiatives. If an initiative gets 50000 statements of support the initiative’s organizer may submit the initiative to the Parliament for consideration.

The web service has been implemented by the Ministry of Justice Finland together with Solita Oy. The service went online on December 1st, 2012.

The Ministry of Justice decided to publish the source code for the software together with Solita Oy after the service has been in use for one year. Commit history prior to the source code publication is not provided, but future commits will be viewable.

Solita Oy is responsible for the future development of the software. Any pull-requests or suggestions for improvement to the source code are considered separately between the Ministry of Justice and Solita Oy. Reports for possible issues in the code might be rewarded by Solita. The Ministry of Justice will handle all the feedback sent to kansalaisaloite.om@om.fi.

LICENSE

Apache License 2.0, see COPYING and LICENSE

Installation

  • Application is packaged as standalone jar with embedded jetty server. Following command-line parameters must be used when starting the application

    • -Djetty.port
    • -Djetty.thread.pool
    • -Dspring.profiles.active
  • Some dev-related stuff can be enabled with spring.profiles.active

    • 'dev' enables simple dev-login-implementation
    • 'vetumamock' enables fake-vetuma-login
    • 'prod' should be used in production
    • 'disableSecureCookie' can be used when running application locally or without ssl.
  • Setting up database

    • Use initdb-xxx.sh to create local test and local production-like PostgreSQL-databases
    • Create production DB in etc-folder using sh ./createdb.sh <locale> <application user password>
    • Note that <locale> is system dependent. In Mac it's fi_FI.utf-8.
    • Script creates initiative user with password <application user password>
    • DB-creation-scripts mentioned above are responsible for executing pre-flyway-time migrations to database.
    • For Flyway, Superuser must be created with createuser -s -P flyway_user. Application migrates database on startup if necessary when 'flyway.password' for flyway_user is overriden properly in app.properties
  • Overriding configurations in different environments

    • Default configuration properties are in src/main/resources/default.properties
    • You can override the parameters in different environments by creating config/app.properties with the overriding parameters
    • Logging config can be overriden with config/log4j.properties
    • Override BoneCP configuration by adding your custom bonecp-config.xml into config/bonecp-config.xml
  • Encrypting secret properties with EncryptablePropertiesConfigurer

    • Encryption key must be located as text file in ~/.initpass
    • Encrypt passwords and secrets with maven: mvn exec:java -Dexec.mainClass="fi.om.initiative.conf.EncryptablePropertiesConfigurer" -Dexec.args="encrypt <message-to-be-encrypted>"
    • Encrypted values are defined in app.properties like this: property.key = ENC(Okbz86n6+NnffnKmAPhedp8DIi51zSVZa1Jx88ZthVI=) properties will be decrypted runtime when needed via EncryptablePropertiesConfigurer

Development

  • Create local database and flyway-user as told above. Encryptions are optional.

  • Start application with IDE: fi.om.initiative.StartJetty.main

  • When DB schema is changed,

    • New sql-increments must be saved in src/main/resources/db/migration. If flyway information is set up correctly to app.properties, application will migrate itself on startup
    • Update Querydsl model by running ExportQTypes (src/test) when changes to schema are made
    • Postgresql enum columns need to be configured in JdbcConfiguration.querydslConfiguration()
    • Querydsl model generated by ExportQTypes is in src/main/java/fi/om/initiative/sql