Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 16 13:14

    ZakarFin on develop

    Moved from Travis to GH actions (compare)

  • Sep 16 13:13

    ZakarFin on develop

    Moved from Travis to GH actions (compare)

  • Sep 16 09:31

    ZakarFin on master

    Update doc to match code Merge pull request #254 from Za… (compare)

  • Sep 16 09:31
    ZakarFin closed #254
  • Sep 16 09:31

    ZakarFin on develop

    Separate line and area linejoin… Fix comment to match doc Merge pull request #1642 from Z… (compare)

  • Sep 16 09:31
    ZakarFin closed #1642
  • Sep 16 09:31
    ZakarFin milestoned #1642
  • Sep 15 15:23
    ZakarFin synchronize #1642
  • Sep 15 15:19
    ZakarFin edited #254
  • Sep 15 15:19
    ZakarFin opened #254
  • Sep 15 15:05
    ZakarFin opened #1642
  • Sep 15 15:02

    ZakarFin on develop

    Refactoring for cleaner code Keep preview icon centered base… Fix centering for line and area and 2 more (compare)

  • Sep 15 15:02
    ZakarFin closed #1641
  • Sep 15 14:56
    ZakarFin milestoned #1641
  • Sep 15 14:49
    ZakarFin opened #1641
  • Sep 13 14:56

    ZakarFin on develop

    Add selection info for automate… Merge pull request #1640 from Z… (compare)

  • Sep 13 14:56
    ZakarFin closed #1640
  • Sep 13 14:53
    ZakarFin milestoned #1640
  • Sep 13 14:53
    ZakarFin opened #1640
  • Sep 13 13:13
    ZakarFin closed #1639
amilcar-capsus
@amilcar-capsus
I want to back up the user_layer, user_layer_data and oskari_users tables in particular, as well as some others from my own server extension
Sami Mäkinen
@ZakarFin
Sure
amilcar-capsus
@amilcar-capsus
What do you recommend in this case? I was thinking of doing a clean installation and restoring those tables, but I'm unsure of how well that would go
Sami Mäkinen
@ZakarFin
There's the options column that was added to user_layer so that might cause a problem but since your error was that it wasn't there so the migration wasn't run and as such it could work properly when restored on a new db (you can check that the columns on the newly created table matches the old db). I don't remember any changes for oskari_users
I would just configure a new db and recreate it from scratch with the app and then try moving in the existing content from the current db
amilcar-capsus
@amilcar-capsus
I also tried deploying a war file on 2.x, but I get a different message on the logs:
2021-06-03 07:13:12,580 WARN  AUDIT - {"msg":"\n### Error querying database.  Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'options' from result set.  Cause: java.lang.NullPointerException\n### The error may exist in org/oskari/myplaces/service/mybatis/MyPlaceCategoryMapper.java (best guess)\n### The error may involve org.oskari.myplaces.service.mybatis.MyPlaceCategoryMapper.getByUserId\n### The error occurred while handling results\n### SQL: SELECT id, uuid, \"default\", publisher_name, category_name, options FROM categories WHERE uuid = ?\n### Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'options' from result set.  Cause: java.lang.NullPointerException","op":"ERROR","resource":"GENERIC","ip":"127.0.0.1","params":{"action_route":["MyPlacesLayers"],"_":["1622722391320"]},"user":"implan"} 
[DEBUG] fi.nls.oskari.util.IOHelper: Opening connection to http://localhost:8082/geoserver/oskari/ows? 
2021-06-03 07:13:12,637 ERROR org.oskari.map.userlayer.service.UserLayerDbServiceMybatisImpl - Failed to get userLayer with uuid: 76ede2a3-db5c-471f-b00f-629c0a036000 
org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'options' from result set.  Cause: java.lang.NullPointerException
### The error may exist in org/oskari/map/userlayer/service/UserLayerMapper.xml
### The error may involve org.oskari.map.userlayer.service.UserLayerMapper.findUserLayerByUuid
### The error occurred while handling results
### SQL: select           id,         uuid,         layer_name,         layer_desc,         layer_source,         fields,         publisher_name,         wkt,         options         from          user_layer         where uuid = ?
### Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'options' from result set.  Cause: java.lang.NullPointerException
Sami Mäkinen
@ZakarFin
Yes, as it says you don't have the options column
Probably there's some other message on the startup that tells why it isn't added on startup
amilcar-capsus
@amilcar-capsus
I see the options column on the table description
But let me restart the app
Sami Mäkinen
@ZakarFin
Then I'm not sure what happens
maybe try inserting an empty json object to it if the value is null
Or check what is in there
select id, uuid, layer_name, layer_desc, layer_source, fields, publisher_name, wkt, options from user_layer where uuid = '76ede2a3-db5c-471f-b00f-629c0a036000 '
^That's what the code is trying to run
amilcar-capsus
@amilcar-capsus
Ah, I think it's because of a sql file on that server-extension
2021-06-03 07:17:00,066 ERROR fi.nls.oskari.servlet.WebappHelper - DB migration for module example failed! 
org.flywaydb.core.api.FlywayException: Found more than one migration with version 1.1.3
Offenders:
-> /tmp/jetty-0.0.0.0-8080-oskari-map.war-_-any-4856569831198561382.dir/webapp/WEB-INF/lib/app-resources-1.5.0.jar (JDBC)
Sami Mäkinen
@ZakarFin
ok, it's an easy fix. You just need to rename that version to a non-conflicting version number
amilcar-capsus
@amilcar-capsus
I also saw some errors on migration due to the column already existing
Should I drop it and restart the app after doing that fix?
Sami Mäkinen
@ZakarFin
I would just start the app by pointing it to a different db to create it from scratch. Then shovel in from the current db what you want to preserve and check if those columns still match
Then rename the db to the one it was before. Or rename the current and create a new one in it's place
that's probably easier
amilcar-capsus
@amilcar-capsus
Ok, I got the instance working again after inserting empty json objects to the options column in categories
Thanks!
Mikko Karvonen
@MikkoKarvonen
Hello. Is there any way to easily calculate the left, right, top and bottom lon lat for different zoom levels? For instance if I have the getMapBbox and getMapPosition for zoom level 10, is there any way I could calculate the mapBbox values for zooms 9,8 and 7 without zooming out and running getMapBbox for every single one of those zooms? Can I use the scale value from mapPosition for this?
osqq
@osqq
So apparently there is an issue with Java 16 and the CSW tests 'GetRecordsTest'. Still works on Java 15.
Sami Mäkinen
@ZakarFin
Ok, haven't really tried anything above 11
osqq
@osqq
Actually nvm, I guess my old computer still pulls java 8 even tho java_home is 15, as switching to the same version on new computer didn't do the trick.
But yes, Java after 11 doesn't seem to work, I had some issue with 11 too but didn't have time to investigate further so I just switched to Java 8. The CSW test checks if Java version is 8 or 11 and doesn't seem to accept other ones.
Sami Mäkinen
@ZakarFin
PRs are compiled with 8 and 11 so 11 should work. Running with newer is probably ok. For compiling we still use 8
osqq
@osqq
Hi, couldn't get Rocket chat to work on new computer yet so putting this here! I have been tasked to apply authentication for download basket to get it to work with AWS. We also needed to add TLS/SSL encryption. Basically we need to add these lines to SendDownloadDetailsToEmailThread and DownloadServices (if I'm not mistaken):
email.setStartTLSEnabled(true);
            email.setStartTLSRequired(true);
            email.setSSLCheckServerIdentity(false);

            String username = System.getenv(PropertyUtil.get("oskari.wfs.download.smtp.username.env", "wfs.download.smtp.username")) != null ? System.getenv(PropertyUtil.get("oskari.wfs.download.smtp.username.env", "wfs.download.smtp.username")) : PropertyUtil.get("oskari.wfs.download.smtp.username", null);
            String password = System.getenv(PropertyUtil.get("oskari.wfs.download.smtp.password.env", "wfs.download.smtp.password")) != null ? System.getenv(PropertyUtil.get("oskari.wfs.download.smtp.password.env", "wfs.download.smtp.password")) : PropertyUtil.get("oskari.wfs.download.smtp.password", null);

            if (username != null && password != null) {
                email.setAuthentication(username, password);
            }
Also it was apparently required to pull the username and password from env variables instead of properties. But the actual question is, do we want to add all these to Oskari core (guessing no), and which ones? Also if f.ex. the TSL stuff is not wanted/needed, what would be the easiest way to get these changes just for us in the server-extension?
osqq
@osqq
Also all the other community members can give a shout if they have projects that might need these additions now or in the future.
tmiosmauli
@tmiosmauli
Hi @osqq ! It's good to post questions here so everyone can see and comment :) I'm pretty sure Sami is able to comment when he has the chance. Ofc others are welcome to comment as well!
osqq
@osqq
My only concern about these are that the download-basket is going to have a billion rows in oskari-ext.properties, as the TLS things are going to have to be added there as well I think. Unless there's some other way to do it that I haven't thought of.
Sami Mäkinen
@ZakarFin
What would these billion rows include?
I see only 2 rows concerning properties added in the code above. Is there more?
Though those two lines look a bit intimidating for sure :)
Sami Mäkinen
@ZakarFin
Is it your purpose that one could configure the env variable name in oskari-ext.properties? But if the env variable doesn't have a value then you fallback to get the username/pass from oskari-ext.properties?
I think it's pretty safe to assume that one instance would only have a single smtp in use so you could simplify the propertynames a bit to just smtp.user/smtp.password. Things like "require TLS"=true or "check identity"=false should be configurable
Also you can do something like PropertyUtil.get('smtp.user, System.getEnv('smtp.user')) so if properties doesn't have a configuration it uses the env variable
Sami Mäkinen
@ZakarFin
If you want to have the env override a property then it will be a bit messier and I would move the code to it's own method instead of single-lining the logic. I agree it probably should be that way around (env before props). Then again I would approach this by having PropertyUtil return the env value if there is one before a properties value so it's abstracted from the code getting the variables so you don't have to repeat this everywhere. Also reconsider if you really need to make the env variable name configurable
Sami Mäkinen
@ZakarFin
So in here: https://github.com/oskariorg/oskari-server/blob/2.4.0/service-base/src/main/java/fi/nls/oskari/util/PropertyUtil.java#L192
the first thing in the method do something like:
String envVar = System.getEnv(propertyName);
if (envVar != null) {
    return envVar;
}
The you can have clean code while using the props (PropertyUtil.getOptional("smtp.user")) and env variables will override any properties you might have in oskari-ext.properties
Sami Mäkinen
@ZakarFin
Or if you really want to make the env name configurable: PropertyUtil.getOptional(PropertyUtil.getOptional("smtp.user.envvarname" "smtp.user")); but I'd favor the simpler option instead of a more complex one if complexity is not required
osqq
@osqq
Yes it was on purpose that if env variable is not found, the properties are a fallback. I thought it would be good that the env variable name would be configurable and not hard-coded just in case. Although I guess variable name like "OSKARI_SMTP_USER" would be sufficient to ensure that there will be no problems. I think we have more things incoming later that would also need to be configured in the properties, so the download basket will have like total +30 possible rows in properties but I guess that's fine and unavoidable, just felt bit intimidating at first compared to other configurations :D
Sami Mäkinen
@ZakarFin
Obviously you should have sane defaults so the configurations aren't required :)
so you don't need to have that 30 rows configured most of the times
I'd still rather have that as PropertyUtil.get("oskari.smtp.user") and have propertyutil do . -> _ conversion and uppercasing to make it easier to define the env variables without escaping dots etc