Git Product home page Git Product logo

mf-geoadmin3's Introduction

mf-geoadmin3

Build Status Greenkeeper badge


Freezed version map.geo.admin.ch

mf-geoadmin-3 will not be developed further (bug fix only). map.geo.admin.ch will only be developed in the new experience web-mapviewer. Follow our transition in 2021 either on the forum or in web-mapviewer


Getting started

Checkout the source code:

$ git clone https://github.com/geoadmin/mf-geoadmin3.git

or when you're using ssh key (see https://help.github.com/articles/generating-ssh-keys):

$ git clone [email protected]:geoadmin/mf-geoadmin3.git

There's no need to create a user specific source file. Simply use the following build command:

$ make user

Variables have sensible default values for development. Anyhow, they can be set as make macros or envvars in a customized source file. E.G. you can copy the rc_user file and adapt it to your needs. They you can lauch:

$ source rc_customized && make all

Use make help to know about the possible make targets and the currently set variables:

$ make help

Use make translate to import directly translations from the Google spreadsheet. Don't forget to set up first these 2 following environment parameter:

export DRIVE_USER=your_login
export DRIVE_PWD=your_password

For builds on test (rc_dev), integration (rc_int) and production (rc_prod), you should source the corresponding rc file.

On vpc-mf1-dev1, create an Apache configuration file for your environment. Ex:

$ cat /var/www/vhosts/mf-geoadmin3/conf/ltxxx.conf
Include /home/ltxxx/mf-geoadmin3/apache/*.conf

Dependencies

The GeoAdmin team development servers all contain the necessary dependencies to develop mf-geoadmin3. Even if development of the project outside of the GeoAdmin infrastructure is not fully supported (e.g. you would need to setup your own web server with correct configurations), you should still be able to build the project on a different, Linux based infrastructure. For this to work, you need to make sure to install the following dependencies:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install make gcc+ git unzip openjdk-7-jre openjdk-7-jdk g++ npm python-virtualenv

Caveats

You might get an error similar to: /usr/bin/env: node: No such file or directory This can be fixed by running: sudo ln -s /usr/bin/nodejs /usr/bin/node #see nodejs/node-v0.x-archive#3911

Update to the last OpenLayers/Cesium/OL-Cesium Version

Use make olcesium to update the olcesium.js and olcesium-debug.js files.

Add the correct version tag

https://github.com/geoadmin/mf-geoadmin3/blob/master/Makefile#20

You can also use an argument to test a new version of OpenLayers, for instance you can do:

make OL_VERSION=627abaf1a71d48627163eb00ea6a0b6fb8dede14 \
OL_CESIUM_VERSION=10c5fcf1565ffdb484c4ef4e42835142f8f45e67 \
CESIUM_VERSION=3e3cf938786ee48b4b376ed932904541d798671d olcesium

Remember to update the API and API doc at the same time to keep coherency.

Automated tests

Unit tests

We use Karma to configure our unit tests and PhantomJS to run them in. They are defined in test/specs. They are run as part of the standard build.

Ideally, each component is fully tested with unit tests.

Saucelab cross-browser tests with saucelabs.com

In your .bashrc please make sure you have the variables SAUCELABS_USER and SAUCELABS_KEY set.

In order to lauch only some of the tests, you can use the following command:

make saucelabs SAUCELABS_TESTS=kml,search

Per default all tests are launched.

If you only want to launch sauclab tests on a single platform/browser, you can use the following command

make saucelabssingle

Cross-browser end-to-end tests with browserstack.com

To run the e2e browserstack tests, a few things need to be set up in your environment. You need to have the BROWSERSTACK_USER and BROWSERSTACK_KEY variables set. As they are sensitive, they should not be accessible in public (don't add them to github). Recommended way is via a protected file on your system (readable only by you):

echo "export BROWSERSTACK_USER=***" >> ~/.browserstack
echo "export BROWSERSTACK_KEY=***" >> ~/.browserstack
chmod 600 ~/.browserstack

Then add source ~/.browserstack to your .bashrc file. The infos can be found here: https://www.browserstack.com/accounts/automate . Please use the credentials in our keypass file to log in.

Run it using make:

make teste2e

This uses the BROWSERSTACK_TARGET environment variable (part of rc_* files) to determine which URL to test.

Run it manually:

node test/selenium/tests.js -t https://map.geo.admin.ch

This runs it with the given target URL.

These tests are not part of the normal build. They need to be launched manually.

Deploying project and branches

Building and deploying to AWS S3

Since March 2018, all branches are deployed by the CI to all three S3 staging bucket (dev, int and prod).

To manually build the current branch and upload it to AWS S3 int, use:

make s3deploy DEPLOY_TARGET=int DEPLOY_GIT_BRANCH=<my branch>

After the first clone, dev dependencies are not removed when uploading a branch to S3. If you want to also remove the dev depedencies, use:

make s3deploy DEEP_CLEAN=true

If the project builds and the tests are passing, then, files will be uploaded to a directory:

<DEPLOY_GIT_BRANCH>/<DEPLOY_GIT_HASH>/<EPOCH_BUILD>

For instance:

mom_layersconfig_lang/1468688399/index.html

and for source:

mom_layersconfig_lang/1468688399/src/index.html

Metadata to a build are available next to the index.html, as info.json

Deploying the project to dev, int and prod

Deploying to dev

make s3deploy DEPLOY_TARGET=dev

will create a snapshot and activate it. a link to the deployed branch will be in the output.

Deploying to int

make s3deploy DEPLOY_TARGET=int

will create a snapshot and activate it, a link to the deployed branch will be in the output.

Deploying to prod

The CI is responsible for uploading to prod. The only required step is to activate a version, i.e. copying from its directory to the root. To get the EPOCH_BUILD, you'll have to look at the CI logs for the last build on master.

make s3activateprod S3_VERSION_PATH=<DEPLOY_GIT_BRANCH>/<EPOCH_BUILD>

Deleting a build on AWS S3

To list all the builds: make s3listint or make s3listprod

To get more information about a build: make s3infoint S3_VERSION_PATH=<DEPLOY_GIT_BRANCH>/<DEPLOY_GIT_HASH>/<EPOCH_BUILD>

To delete a given build: make s3deleteint S3_VERSION_PATH=<DEPLOY_GIT_BRANCH>/<DEPLOY_GIT_HASH>/<EPOCH_BUILD>

To delete a named branch:

make s3deleteint S3_VERSION_PATH=<DEPLOY_GIT_BRANCH>

Get correct link the API

Per default, the API used in the main instance of mf-chsdi3. If you want to target a specific branch of mf-chsdi3, please adapt the API_URL variable in the rc_branch.mako file on your branch

Flushing AWS CloudFront

The AWS bucket from int and prod staging are behing AWS CloudFront distribution. You will need to know the AWS Cloudfront Distrubtion ID to be able to flush it. The command then look like this :

aws cloudfront create-invalidation --distribution-id <DISTRIBUTION_ID> --path <PATH_YOU_WANT_TO_FLUSH>

Point to a target env for all services

Add env=(dev|int|prod)

Use a custom backend and WMS server via permalink parameters

Add api_url=//theNameOfAnAPIServer

Add config_url=//theNameOfAnConfigServerOrUrl

Add alti_url=//theNameOfAnAltiServer

Add wms_url=//theNameOfAWMSServer

Add print_url=//theNameOfAPrintServer

Add shop_url=//theNameOfAShopServer

Add mapproxy_url=//theNameOfAMapProxyServer

Add public_url=//theNameOfAPublicServer

Add wmts_url=//theNameOfAWmtsService

Examples of usage

National :

Regional :

mf-geoadmin3's People

Contributors

afoletti avatar alcapat avatar ariadnigaki avatar bbinet avatar boecklic avatar cedricmoullet avatar davidoesch avatar dkottmann avatar elemoine avatar fgravin avatar fredj avatar gberaudo avatar gjn avatar greenkeeper[bot] avatar jenselme avatar kandre avatar loicgasser avatar ltclm avatar ltkum avatar ltshb avatar mariavkou avatar nadine-piveteau avatar oterral avatar otruffer avatar pakb avatar pfanguin avatar procrastinatio avatar rebert avatar sbrunner avatar tonio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mf-geoadmin3's Issues

Tests run twice on Travis CI

Since 87081cd the tests are run twice on Travis. make all run them, and Travis does npm test, which runs them again. make all should probably be what we want to do on Travis - make is our entry point.

Examples do not work in IE9

The existing examples don't work on IE9. @oterral found out it's because of <base href="../../../"> in the head tag of the html page. IE9 does not support relative pathes here.

Geolocation issue in prod mode

All in the title with this JS error
Uncaught TypeError: Object # has no method 'getResolutionForExtent'
But it works in src mode

6.2.11 Geolocation active: not possible to pan

1: VISTA IE9
2: Steps to reproduce
http://mf-geoadmin3.bgdi.admin.ch/main/prod/
Activate geolocation
let app zoom to your location
try to pan with left mouse hold
3: Result
no panning but zooming! (zoombar does not work neither)
4: Expected Result
panning works as defined
5: if possible: workaround
none
and even after deactivation of geolocationthe app is not usable anymore. Seems to be an issue: pan with left mouseclick impossible, scrollwheel starts panning as well-> complete reload needed

Generate permalinks

PR #6 provided a way to parse the query string to set the application's initial states. Now we need to do the reverse, that is create links from the application's current states.

One way to do it is to simply update the URL in the address bar. Angular's $location service supports that, based on the HTML5 History API. This service has a fallback mechanism for browsers that don't support the History API (IE9 in our case), but I haven't tested it yet.

Here's a demo: http://mf-geoadmin30t.bgdi.admin.ch/elemoine. The URL in the address bar should change as the map view changes. (I introduced a 1 second delay for performance reasons).

The commit that implements this is here: 097d863.

Import WMS: Replace thumb by a button

The tumb in the result list is useless and the zoomToExtent on mouse over/out is disturbing.

So we should remove the thumb column amd replace it by a zoomToExtent column.

Arrow keys don't work in edit fields / text boxes

The arrow keys don't work there anymore because they are captured by the map for panning.

This can be seen in share panel (in the embed text area or in the edit box), but also in dialogs like kml import.

I don't think that's the desired behaviour.

Create broadcast when language changes

Some components (gaLayers service and the users of this service) should act if the language changes (loading new layers.json, loading new catalog, etc). Therefore, we should broadcast a message when the language changes.

Make updateol fails on mf1lt

The plovr version used to build the openlayers build is not compatible with the java version installed on mf1lt. We have version 6 installed, and we need 7 for plovr.

Private method from OL3

In ImportWMS and Geolocation directives we need the view2D.getResolutionForExtent function.

Where can we put this stuff to avoid duplicate code.

Same question can be asked for code copied from Angular (URL_REG_EXP ...).

6.2.9_ loading application: technical translation appear on load

1: VISTA IE9
2: Steps to reproduce
Cold load application http://mf-geoadmin3.bgdi.admin.ch/main/prod/
3: Result
non translated technical names appear on load in container
4: Expected Result
Application does show correct language on load.
Otherwise user thinks application is slow. This can especially observed on older mobile and slow connections... I know it is picky, but it is the first thing the user sees fomr the new app ... I think jeiziner observed the same thing

5: if possible: workaround
WAIT!
6: link to file : attache it to github

map keyboard control listen «too large»

←, ↑, →, ↓, +, - are unusable in every field as they are catched to control the map.

They shouldn’t be catched (at least) when a link/button/input/select/textarea is focused.

6.2.11 geolocation fly to toooooo slow

1: VISTA IE9
2: Steps to reproduce
http://mf-geoadmin3.bgdi.admin.ch/main/prod/
zoom to http://mf-geoadmin3.bgdi.admin.ch/main/prod/?topic=inspire&lang=de&bgLayer=ch.swisstopo.pixelkarte-farbe&X=176450.93&Y=861536.08&zoom=13
activate Geolocation
3: Result
Takes forever to fly to the location or app even crashes (amdin.ch is not responding due to a long-running script))
4: Expected Result
as smooth as in ffirefox
5: if possible: workaround
none

In general the fly to is too slow on VISTA (tested with safri,chrome ff)

Makefile: src and prod

In the Makefile, we have a few sections that are absolutely similar but the 'mode=prod'. Maybe we can improve that to avoid errors and follow the DRY principle more closely.

As an example, compare target prod/index.htmland src/index.html

Unable to update openlayer on mf1t

make updateol
cd .build-artefacts/ol3; git fetch origin; git merge --ff origin/master; git show; ../python-venv/bin/python build.py build/ol.js build/ol-simple.js build/ol-whitespace.js
Already up-to-date.
2013-07-25 10:50:45,177 build/ol.js: java -jar build/plovr-2013-rc3.jar build buildcfg/ol.json
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/plovr/cli/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.plovr.cli.Main. Program will exit.
Traceback (most recent call last):
File "build.py", line 747, in
main()
File "/home/sbrunner/mf-geoadmin3/.build-artefacts/ol3/pake.py", line 339, in main
target.build(dry_run=options.dry_run)
File "/home/sbrunner/mf-geoadmin3/.build-artefacts/ol3/pake.py", line 107, in build
self.action(self)
File "build.py", line 191, in build_ol_js
t.output('%(JAVA)s', '-jar', PLOVR_JAR, 'build', 'buildcfg/ol.json')
File "/home/sbrunner/mf-geoadmin3/.build-artefacts/ol3/pake.py", line 190, in output
output = check_output(args, *kwargs)
File "/home/sbrunner/mf-geoadmin3/.build-artefacts/ol3/pake.py", line 38, in check_output
raise subprocess.CalledProcessError(retcode, cmd, output=output)
TypeError: init() got an unexpected keyword argument 'output'
make: *
* [updateol] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.