solita / kuntalaisaloite

Kuntalaisaloite.fi / Invånarinitiativ.fi - www.kuntalaisaloite.fi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is no longer the official repository and active development doesn't happen in this fork

What and why

Kuntalaisaloite.fi / Invånarinitiativ.fi is a web service for launching municipal citizen's initiatives and gathering participants for these initiatives. The web service has been implemented by the Ministry of Justice Finland together with Solita Oy.

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 kuntalaisaloite.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 via setting spring.profiles.active to 'dev'. Also 'disableSecureCookie' can be used when running application locally or without ssl. Setting profile to 'dev'

    • Enables test-data-generation on path /fi/testdata
    • Enables vetuma-mock-controller which can be used to for fake vetuma logins
  • Setting up database

    • Use muninitdb-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 municipalityinitiative 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.municipalityinitiative.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.municipalityinitiative.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

About

Kuntalaisaloite.fi / Invånarinitiativ.fi - www.kuntalaisaloite.fi

License:Apache License 2.0


Languages

Language:Java 46.9%Language:JavaScript 27.3%Language:FreeMarker 13.2%Language:CSS 9.7%Language:HTML 2.9%Language:Shell 0.1%