rashadkm / webgrass

Other
1 stars 3 forks source link

Allow to provide GRASS init parameters as options at server start #25

Open ninsbl opened 8 years ago

ninsbl commented 8 years ago

Currently the initialization parameters for WebGRASS have to be edited two (or actually 3) places:

The Server process however represents the user who started it. But, the person who installs WebGRASS and the one who runs it are not necessarily the same.

Instead of having redundant configuration files it would be useful to be able to specify the initialization options at run time, like e.g. rgrass7 does. There is this function available (taken from the wiki): initGRASS(gisBase = "/home/veroandreo/software/grass-7.0.svn/dist.x86_64-unknown-linux-gnu", home = tempdir(), gisDbase = "/home/veroandreo/grassdata/", location = "nc_spm_08_grass7", mapset = "user1", SG="elevation", override = TRUE)

For WebGRASS I would love to have something like this in place:

./wgrass.wt --http-address=0.0.0.0 --http-port=8080 --docroot .. -c ../auth.xml --gisDbase="/home/veroandreo/grassdata/" --gisBase="/home/veroandreo/software/grass-7.0.svn/dist.x86_64-unknown-linux-gnu"

That would be much more flexible and convenient compared to the current implementation...

mayank33 commented 8 years ago

You dont have to change anything in the .webgrass/rc. As I said earlier, if your data is in "grassdata" folder in your "home". It will work properly. Can you paste the screenshot of your first page showing the GRASS DATA DIR.

rkanavath commented 8 years ago

@mayank33 , he was not talking about grass data dir, it is about gisdbase?

@ninsbl i will see if i can add a enhancement for that when i get back home.

you can also test cl_module branch where i pushed some changes to fix module ui layout. git clone --branch=cl_module https://github.com/rashadkm/webgrass

ninsbl commented 8 years ago

Just tested the cl_module branch. On my Ubuntu 14.04 LTS box it says: (...) In file included from /usr/include/Wt/WSignal:17:0, from /usr/include/Wt/WWidget:14, from /usr/include/Wt/WWebWidget:14, from /usr/include/Wt/WBreak:10, from /usr/include/Wt/WCssStyleSheet:14, from /usr/include/Wt/WApplication:26, from /data/src/webgrass_cl/src/Utils.h:7, from /data/src/webgrass_cl/src/Utils.cpp:3: /usr/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]

warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING."

^

/data/src/webgrass_cl/src/Utils.cpp: In function ?const string Utils::checkFileExists(const string&)?: /data/src/webgrass_cl/src/Utils.cpp:15:33: error: no matching function for call to ?std::basic_ifstream::basic_ifstream(const string&)? std::ifstream stream(fname);
^ /data/src/webgrass_cl/src/Utils.cpp:15:33: note: candidates are: In file included from /data/src/webgrass_cl/src/Utils.cpp:1:0: /usr/include/c++/4.8/fstream:467:7: note: std::basic_ifstream<_CharT, _Traits>::basicifstream(const char, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::ios_base::openmode = std::_Ios_Openmode] basicifstream(const char s, ios_base::openmode __mode = ios_base::in) ^ /usr/include/c++/4.8/fstream:467:7: note: no known conversion for argument 1 from ?const string {aka const std::basicstring}? to ?const char? /usr/include/c++/4.8/fstream:453:7: note: std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char; _Traits = std::char_traits] basic_ifstream() : istream_type(), _M_filebuf() ^ /usr/include/c++/4.8/fstream:453:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/4.8/fstream:427:11: note: std::basic_ifstream::basic_ifstream(const std::basic_ifstream&) class basic_ifstream : public basic_istream<_CharT, _Traits> ^ /usr/include/c++/4.8/fstream:427:11: note: no known conversion for argument 1 from ?const string {aka const std::basic_string}? to ?const std::basic_ifstream&? /data/src/webgrass_cl/src/Utils.cpp:16:64: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default] return std::string(std::istreambufiterator(stream), {}); ^ make[2]: ** [CMakeFiles/wgrass.wt.dir/src/Utils.cpp.o] Error 1 make[1]: * [CMakeFiles/wgrass.wt.dir/all] Error 2 make: * [all] Error 2

rashadkm commented 8 years ago

pushed a fix for compilation problem

configure using cmake -DGRASS_INSTALL_DIR=/path/to/grass/installation -DGRASS_DATA_DIR=/path/to/grassdata (default is $HOME/grassdata)

To compile: make

to run

./start_webgrass.sh

start_webgrass.sh a script auto-configured into build directory

On Wed, Aug 31, 2016 at 10:56 PM, Stefan Blumentrath < notifications@github.com> wrote:

Just tested the cl_module branch. On my Ubuntu 14.04 LTS box it says: (...) In file included from /usr/include/Wt/WSignal:17:0, from /usr/include/Wt/WWidget:14, from /usr/include/Wt/WWebWidget:14, from /usr/include/Wt/WBreak:10, from /usr/include/Wt/WCssStyleSheet:14, from /usr/include/Wt/WApplication:26, from /data/src/webgrass_cl/src/Utils.h:7, from /data/src/webgrass_cl/src/Utils.cpp:3: /usr/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]

warning "Boost.Signals is no longer being maintained and is now

deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." ^ /data/src/webgrass_cl/src/Utils.cpp: In function ?const string Utils::checkFileExists(const string&)?: /data/src/webgrass_cl/src/Utils.cpp:15:33: error: no matching function for call to ?std::basic_ifstream::basic_ifstream(const string&)? std::ifstream stream(fname);

^ /data/src/webgrass_cl/src/Utils.cpp:15:33: note: candidates are: In file included from /data/src/webgrass_cl/src/Utils.cpp:1:0: /usr/include/c++/4.8/fstream:467:7: note: std::basic_ifstream<_CharT, _Traits>::basicifstream(const char , std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::ios_base::openmode = std::_Ios_Openmode] basicifstream(const char __s, ios_base::openmode __mode = ios_base::in) ^ /usr/include/c++/4.8/fstream:467:7: note: no known conversion for argument 1 from ?const string {aka const std::basic_string}? to ?const char

_? /usr/include/c++/4.8/fstream:453:7: note: std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char; _Traits = std::char_traits] basic_ifstream() : __istream_type(), _M_filebuf() ^ /usr/include/c++/4.8/fstream:453:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/4.8/fstream:427:11: note: std::basic_ifstream::basic_ifstream(const std::basic_ifstream&) class basic_ifstream : public basic_istream<_CharT, _Traits> ^ /usr/include/c++/4.8/fstream:427:11: note: no known conversion for argument 1 from ?const string {aka const std::basic_string}? to ?const std::basic_ifstream&? /data/src/webgrass_cl/src/Utils.cpp:16:64: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default] return std::string(std::istreambufiterator(stream), {}); ^ make[2]: ** [CMakeFiles/wgrass.wt.dir/src/Utils.cpp.o] Error 1 make[1]: * [CMakeFiles/wgrass.wt.dir/all] Error 2 make: * [all] Error 2

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rashadkm/webgrass/issues/25#issuecomment-243898769, or mute the thread https://github.com/notifications/unsubscribe-auth/ACSNO-Eenf839c2W9USWH--GrFqNlnDQks5qlep2gaJpZM4JxkOe .

Regards, Rashad

ninsbl commented 8 years ago

THanks for the quick fix. Now we are almost there:

[ 81%] Building CXX object CMakeFiles/wgrass.wt.dir/src/Module.cpp.o In file included from /usr/include/Wt/WSignal:17:0, from /usr/include/Wt/WWidget:14, from /usr/include/Wt/WWebWidget:14, from /usr/include/Wt/WInteractWidget:10, from /usr/include/Wt/WContainerWidget:10, from /data/src/webgrass_cl/src/Module.h:12, from /data/src/webgrass_cl/src/Module.cpp:5: /usr/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]

warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING."

^

/data/src/webgrass_cl/src/Module.cpp: In member function ?bool Module::createAllTabs(const string&)?: /data/src/webgrass_cl/src/Module.cpp:182:39: error: ?class pugi::xml_document? has no member named ?load_string? pugi::xml_parse_result result = doc.load_string( xml_string.c_str() ); ^ make[2]: * [CMakeFiles/wgrass.wt.dir/src/Module.cpp.o] Error 1 make[1]: * [CMakeFiles/wgrass.wt.dir/all] Error 2 make: *\ [all] Error 2

rkanavath commented 8 years ago

looks like you are using an old version of libs. wt, pugixml. I am not sure the correct version at server.

maybe @epifanio can help.

rkanavath commented 8 years ago

btw, i am close to fixing multi-user support

ninsbl commented 8 years ago

I am on Ubuntu 14.04 LTS, with latest libwt and libwtext-dev... Maybe I have to move to Ubuntu 16 or compile from source...

multi-user support would be great!

rashadkm commented 8 years ago

can tell the version of libwt?

i have pugixml 1.7 package installed. can you check your version?

ubuntu 14.04 LTS is a good enough to build webgrass.

you can also compile pugixml from source; https://github.com/zeux/pugixml/blob/master/src/pugixml.hpp

rashadkm commented 8 years ago

if this branch is working properly for you, i can merge the multi-user support

ninsbl commented 8 years ago

Seems like Ubuntu 14.04 is shipping libpugixml version 1.2.2. libpugixml > version 1.7 is first available in Ubuntu 16.04. http://packages.ubuntu.com/de/trusty/libpugixml-dev

As soon as I have migrated to 16.04 I will test the branch again.

rashadkm commented 8 years ago

you simple install libpugixml from source without migration. installation is straightforward

On Fri, Sep 2, 2016 at 9:21 AM, Stefan Blumentrath <notifications@github.com

wrote:

Seems like Ubuntu 14.04 is shipping libpugixml version 1.2.2. libpugixml > version 1.7 is first available in Ubuntu 16.04. http://packages.ubuntu.com/de/trusty/libpugixml-dev

As soon as I have migrated to 16.04 I will test the branch again.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rashadkm/webgrass/issues/25#issuecomment-244302022, or mute the thread https://github.com/notifications/unsubscribe-auth/ACSNO49Oop47IKCIdTvKBOyC2n-ec0_Rks5ql85igaJpZM4JxkOe .

Regards, Rashad

ninsbl commented 8 years ago

OK, tanks for the hint. Now I instaled libpugixml-dev from source and ./start_webgrass.sh myhost 8080 Works nicely, including multiple module windows. Commands work fine too (meaning I get output). I still have to use the resources from @mayank33 `s dropbox in order to make the GUI look nice, and the fix for ordering of locations and mapsets, which @mayank33 added earlier does not seem to be part of this branch...

Is it otherwise necessary to compile WebGRASS against a GRASS data directory (and a specific GRASS installation)? If not, it would be really cool to have those as options in the start_webgrass.sh too. Sure, having grassdata in $HOME (e.g. mounted from NFS) is pretty common, however in praxis completely up to the user... So, this would nice to have as a startup option too.

Personally, I have different GRASS installations in parallel, e.g. for testing or accessing specific new features in the development branch. If I could choose at server start which installation to use (or if I could start two installations in parallel (without installing also WebGRASS twice) would be convenient. But that would be less important than beeing able to choose the GRASS data directory at server start...

ninsbl commented 8 years ago

BTW, as mentioned I used the resources from @mayank33 `s dropbox. In this branch it seems that all buttons have been removed from the UI. I guess that is on purpose.?

rashadkm commented 8 years ago

glad to see that it is working. the resources problem could be fixed. the resources directory comes with wt installation and should be removed fom webgrass source. it was easy that way when I started, I mean asking massimo and mayank to use same wt version. But ofcourse, we can add a fix for that.

he problem of grassdata is connected to multi-user support. one thing is to fix the data directory for based on user $HOME/user1/grassdata $HOME/user2/grassdata is a good option i think

and if a user has already some data on server /data/myprivate/server he do set that when doing registration?

registration: username: myuser password: my pass grassdata location: <$HOME/myuser/grassdata> (default)

@epifanio, what do you think ?

rashadkm commented 8 years ago

@ninsbl , yes some buttons are "hidden" to not have 'this-dont-work' problem. there are still more to do.. but let's find running modules and mult-user support first.

thanks a lot of testing this. We really appreciate it

epifanio commented 8 years ago

@rashadkm the multi-user approach described above, eg.: every real unix user on the machine will have his own GISDBASE directory in his own HOME is the way to go.

Of course such application is for trusted users who fully access to a server is granted.

In the future we can think of spawn dockers container with instances of webgrass single-user... But for now the focus is to have a single-user webgrass and then work on a multi-user interface.

The multi-user interface will run n- a single-user instance behind a proxy, so to provide a single entry point (domain:port) for all the users.