|
1 |
| -# sample-server-extension |
2 |
| -Site visible in demo.oskari.org |
| 1 | +# Sample server-extension for Oskari |
| 2 | + |
| 3 | +This is a template for extending oskari-server functionality using Maven. |
| 4 | +This application is running used in demo.oskari.org and dev.oskari.org. |
| 5 | + |
| 6 | +Modify oskari-ext.properties: |
| 7 | + |
| 8 | + db.additional.modules=myplaces, userlayer, example |
| 9 | + |
| 10 | + # default view is the first appsetup |
| 11 | + view.default=1 |
| 12 | + |
| 13 | + # publish template is the second appsetup |
| 14 | + view.template.publish=2 |
| 15 | + |
| 16 | + # make myplaces etc baselayers have the correct projection for initial setup: |
| 17 | + oskari.native.srs=EPSG:3857 |
| 18 | + |
| 19 | +To enable end-user registration configure these (more information at http://oskari.org/documentation/features/usermanagement): |
| 20 | + |
| 21 | + allow.registration=true |
| 22 | + oskari.email.sender=<[email protected]> |
| 23 | + oskari.email.host=<smtp.domain.com> |
| 24 | + |
| 25 | +## Modifying the initial application setup: |
| 26 | + |
| 27 | +1) You will need a Java migration to run your setup file like this: |
| 28 | + |
| 29 | + app-resources/src/main/java/flyway/example/V1_0_0__initial_db_content.java |
| 30 | + |
| 31 | +Or you can run these as individual flyway migrations. |
| 32 | + |
| 33 | +*Note!* All database tables are created with the core migration. |
| 34 | + |
| 35 | +2) Your setup should add application specific content like layers, users, appsetups. |
| 36 | + |
| 37 | +You can reference sql files under oskari-server/content-resources like adding inspire-themes: |
| 38 | + |
| 39 | + app-resources/src/main/resources/setup/app-example.json |
| 40 | + |
| 41 | +You can modify data providers and users as this is just another example overriding the sample setup: |
| 42 | + |
| 43 | + app-resources/src/main/resources/sql |
| 44 | + |
| 45 | +For example if you would like to have a non-admin user you can add these lines to app-resources/src/main/resources/sql/initial-users.sql: |
| 46 | + |
| 47 | + -- add user; |
| 48 | + INSERT INTO oskari_users(user_name, first_name, last_name, uuid) VALUES('user', 'Oskari', 'Olematon', 'fdsa-fdsa-fdsa-fdsa-fdsa'); |
| 49 | + |
| 50 | + -- add role to user; |
| 51 | + INSERT INTO oskari_role_oskari_user(user_id, role_id) VALUES((SELECT id FROM oskari_users WHERE user_name = 'user'), (SELECT id FROM oskari_roles WHERE name = 'User')); |
| 52 | + |
| 53 | + -- add credentials user/user for non-admin user (You can use for example https://www.browserling.com/tools/bcrypt to create a password); |
| 54 | + INSERT INTO oskari_jaas_users(login, password) VALUES('user', '$2a$10$0VHUAhiInPL77O12guO3lOaCdxd/Hfhz4L8qA3Jb4FAw.u8Y.3cMG'); |
| 55 | + |
| 56 | +Layers can be configured in json: |
| 57 | + |
| 58 | + app-resources/src/main/resources/json/layers |
| 59 | + |
| 60 | +And referenced in app setups like this: |
| 61 | + |
| 62 | + app-resources/src/main/resources/json/views/geoportal-3857.json |
| 63 | + |
| 64 | +Compile with: |
| 65 | + |
| 66 | + mvn clean install |
| 67 | + |
| 68 | +Replace oskari-map.war under {jetty.home}/webapps/ with the one created under webapp-map/target |
| 69 | + |
| 70 | +# Reporting issues |
| 71 | + |
| 72 | +All Oskari-related issues should be reported here: https://github.com/oskariorg/oskari-docs/issues |
0 commit comments