Selasa, 21 November 2017

Openmaint Wind10

How to setup openMAINT on localHost (Win 10 PC) Part 1





http://blog.astra0.com/2017/09/06/setup-openmaint-localhost-win-10-pc-win-server-later-blog/


 You can go to this site to demo the reports in a working instance of openMAINT
  How to setup openMAINT on localHost (own PC) and on Remote Server (in a later blog) from someone who had quite a few false starts.
This blog starts with the basic setup and hopefully it will develop to the extra parts that make it so interesting. This is based on OM version 1.1 (core 2.4.3) on a Win 10 computer
My main objective is to document the process and also alter the setup to suit the dataset that I have. The Dataset is from SPM Asset Management and their data structure is slightly different.
From the base setup in OpenMaint, a whole lot of other fields need to be created. I do not wish to mirror the SPM dataset but build an AM/FM tool that is practical. So some musings on methods, eg Condition.
In OpenMaint their conditions go from Good/Fair/Poor , in SPM from C1 to C5. I quite like the numeric as its easier to filter in Excel in a sort Ascending/descending. And you are trying to monitor your conditions to see what needs repairing.

OpenMaint
On its web page:
http://www.openmaint.org/en/project/project
The programme is described thusly:
openMAINT is an open source solution for the Property & Facility Management.
openMAINT is an application for the management of buildings, installations, movable assets and related maintaining activities.
openMAINT helps the managing authority to know, organize and update those data related to the asset inventory, in order to support their decision and operative procedures.
READY-TO-USE SOLUTION
openMAINT is a complete ready-to-use solution, i.e. it is configured with all necessary base files, processes, reports and dashboards.
openMAINT has been customized in order to shape over the environment where it operates, usually made up of procedures, documents, roles and responsibilities, technical restrictions, textual data and georeferences, external systems to interact, etc.
Complying with the rule, it can also be gradually activated with successive extensions.
The video’s that demonstrate what it can do are quite impressive. See:
openMAINT: Space and Asset inventory
Background
I was exploring the web and came across this programme about a year and a half ago. I had it running on a PC where I had the demo operating . I liked the programme but had a great deal of difficulty setting it up. Mainly due to my poor understanding of servers etc.
I showed demo’s of the programme to a few people who were interested in it but only from a distance.
Matt, a designer I had worked with, had his team fire up a copy and get it running on a local host server and on a Linux VPS. So I thought I would revisit setting it up.
I had been tinkering around the edge of VPS’s (Virtual Private Servers) as a next step from shared web hosting , as a learning process and used the free Amazon Web Service to play around with. I ended up paying some small fees for the learning. I tried using it a number of times but never got that confident with linking remotely to it.
So with a bit of a motley background I decided to write a blog about setting it up.
I must note that finding documentation for setting it up a couple of years ago was quite hard, there is a little more out there now. Another reason to document process is if I put it down and pick it up again, at least I will have somewhere to get the information.
Local setup on PC.
Why would you bother. A couple of reasons.
1. A sandpit to play in. If you are testing things and you break something then your main server is not having to be rebuit.
2. Quicker. You are doing everything on your PC so its faster, you are not reliant on your connection speed to the server.
3. Cheaper. You do not have to pay for the VPS service.
Support and Service
I did make enquiries about support for the product, as it is open source, Tecnotea administer and update it.
If you have support for OpenMaint a cost quote that was given to me was:
Silver (email Help-desk, remote connection, 3 working days ticket analysis, 5 working days ticket level 1 resolution, 10 working days alert for new versions and upgrades) is about $4,200 US/yearbased on a SMALL instance below:
Instance complexity
The parameters used to value the complexity of a openMAINT instance are as follows:
openMAINT instance   Small        Medium          Large          Very Large
Buildings/Units             <=5           <=20            <=200            >200
Assets                             <=6000   <=24000       <=120000   >120000
Users *                           <=10        <=20                <=50             >50
Connectors                    IFC only   <=2                  <=4               >4
In my opinion this is a very expensive support for maintaining less than 6000 assets.
I do get irritated when companies are not upfront with their pricing but you have to go looking for the information. I suppose it is a way to generate leads for their sales team, but that is not a method that is going to entice me to buy.
.
Getting the programmes, the correct versions
Download OpenMaint from here, (note- you will be redirected to SourceForge)  :
http://www.openmaint.org/en/download
The documentation has a few levels.
  1. OpenMaint Overview-A simple overview : http://www.openmaint.org/files/manual
  2.  A how to install, the initial bit is quite annoying, but the  later info is helpful:      http://www.openmaint.org/en/documentation/FAQ/technical-faq/how-to-installl-openmaint
  3. Since OpenMaint  is build on open source CMDBuild IT management tool, for the guts of the setup you need to really have the reference information for the CMDBuild docs. These are found: http://www.cmdbuild.org/file/manuali/technical-manual-in-english
  4. and also Administrator Manual : http://www.cmdbuild.org/file/manuali/administrator-manual-in-english
Armed with the basic information we look at the how to install and the first thing is the database & Tomcat.
VERSIONS ARE VERY IMPORTANT for thee software
OpenMain Install instructions. First get your programmes.
So, which versions and where do you get them? Look to: http://www.openmaint.org/en/download/download and you will see this:

I will be looking at installing the first 5 items. I am currently playing around with Alfresco, butbeware, do not download the standard community edition, you actually want a different version that does not have its own DB.
As a lot of these software versions are not the latest, you do have to go fossiking for them sometimes. I would recommend you head the versioning as its a pain to uninstall & reinstall when nothing works (which I have done on a number of occasions) .
OS. I am using windows 10. NOTE: I am running a 64 bit OS so will download the 64 bit version of software. Check what your system is before choosing what to download.
note. For the linux systems they do not download .exe or .zip files but .tr and .tar.gz files, so be wary following instructions for one system if you are running another.
PostGreSQL 9.3 here : https://www.postgresql.org/download/windows/
PostGIS 2.2 here: http://winnie.postgis.net/download/windows/pg93/buildbot/osm2pgrouting-pg93-binaries-2.2.0w64gcc48.zip
Warning– The PostGIS has a 2.2 version for different PostGreSQL 9 versions 9.2,9.3,9.4, 9.5 etc, so make sure you get the correct one. Read here: http://postgis.net/windows_downloads/
Tomcat v7 : https://tomcat.apache.org/download-70.cgi   choose the win 64 bit . Note, I think I setup my Localhost with Tomcat 7 and my VPS with 8. They both seem to be fine. I think the later version may be the better one to go with, which can be found here: https://tomcat.apache.org/download-80.cgi
And of course the JDK files. Only the 1.8 version supported. Go here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Setting up the Database
Fire up the PostGreSQL 9.3  and follow instructions. I used the C:\PostgreSQL directory that it suggested. A bit messy but its only a test environment and can be blown away later. The directory location is important as you will need to copy the PostGIS files into it later.
Setup your password & use either the web browser PgAdmin4 or PgDevOps or else the PgAdmin3.exe to look at the data structure in the Database setup.
You need to do a few things here, 1. Create a new database, 2. Configure the “gis” schema (this has something to do with relations between elements) & 3, Restore the openMaint Database into that named database.
First off though, we will load up PostGIS 2.2 into the PostGreSQL 9.3 directory.  First unzip theosm2pgrouting-pg93-binaries-2.2.0w64gcc48.zip file and read the README.txt file. It tells you how to copy the files into the  C:\PostgreSQL\pg93 . The directory structure of the PostGIS 2.2 is the same, so when you copy across you have to allow the copy to merge the directories.
There is also a nice  makepostgisdb_using_extensions.bat file, that if you edit, will build the postGIS database too.
The next part is to fire up either PgDevOps or PgAdmin3.exe ( which is easiest and found here C:\PostgreSQL\pgadmin3\bin\PgAdmin3.exe). Create a new database, in this case 123 by Right button clicking on  Databases and selecting New Database- follow on as  below.
Use the postgres as the owner, hit ok , database created.
Next is setting up the GIS schema (refer to page 8 of CMDBuild_TechnicalManual which can be downloaded HERE.
On a blog this is the instructions that seem to work:
If after you create the empty CMDBuild database, and before performing the restore, the following commands are executed (either shell or SQL-like):
cmdbuild=# CREATE SCHEMA gis;
cmdbuild=# SET SEARCH_PATH TO gis, public, shark;
cmdbuild=# \i ${POSTGIS_DIR}/postgis.sql
cmdbuild=# \i ${POSTGIS_DIR}/spatial_ref_sys.sql
cmdbuild=# \i ${POSTGIS_DIR}/legacy.sql (if you use PostGIS 2.0)
cmdbuild=# ALTER DATABASE your_database_name_here SET search_path=”$user”, public, shark,  gis;
This needs to be imputted in the PSQL Console.
(Note: postgis.sql seems to be in 2 directories, use the one in the directory with the other 2 files spatial_ref_sys.sql and legacy.sql )
Next, restore the openmaint database.
Unzip the openMaint download and there is a database directory, there are 3 databases in there to select. 1. A demo, 2, an empty DB and 3 an empty DB with GIS.
I loaded empty DB with GIS and this seemed to blow away the gis schema I had just set up above, so I found the basic empty DB was the best to upload.
(If there are problems and you need to reset the installation, stop Tomcat, delete the Database, create new database and start again. Delete the openmaint & shark directories in the tomcat/webapps directory and then restore them with the war files procedure) .
So, thats the database ready.
JDK setup next, as its the Java environment. Fire it up and remember where it is installed. Again, make sure 32 or 64 bit and it will go into Program Files or Program Files(x86).
Next is Tomcat. I think some do JDK, then Tomcat then Database. In someways Tomcat after JDK is good because if you have problems with Tomcat, then nothing else will be of any relevance. You have to have that going. Its just i am comfortable with Databases but not so comfortable with virtual servers, so easy stuff first.
I setup Tomcat in c:\tomcat  . Put the file structure as is there.
Now to set up some elements:
Go to control panel, to Control Panel\System and Security\System and click on

Set environment variables
The CATALINA_HOME environment variable should be set to the location of the root directory of the “binary” distribution of Tomcat.
CATALINA_HOME C:\tomcat
The JRE_HOME variable is used to specify location of a JRE. The JAVA_HOME variable is used to specify location of a JDK.
You can now start and stop Tomcat from the command line:
%CATALINA_HOME%\bin\startup.bat
%CATALINA_HOME%\bin\shutdown.bat
Although I go into the Explorer to directory c:\tomcat\bin\startup.bat     or to stop  c:\tomcat\bin\shutdown.bat
So you can now fire up Tomcat and it should look like this:
The command prompt window will run lots of streaming lines and you have to wait until SERVER STARTUP and xxxxxxxms  appears, this means the virtual server is up and running. Leave this screen open. It shows you how the later programmes are loading.

Then go to web browser and type in :         localhost:8080
This should bring you to this screen:
Before clicking onto the server status button, go and edit the following file: C:\tomcat\conf\tomcat-users.xml and add/chage:
<role rolename=”manager-gui”/>
<user username=”tomcat” password=”s3cret” roles=”manager-gui”/>
Put this in before last line , I will change user and password to something else that you remember
Then, with that files saved, if you hit the server button
After clicking on server status button you get the LH Screen, click on List Applications and you get the RH Screen. This tells you what services are running.
So now we need to get the OpenMaint & Shark war files up and running, and copy some files to the tomcat\lib directory.
The war files seem to be a combination of zip and compile files. If you have your command prompt screen open and you move a war file to the tomcat\webapp folder, you see it being unpacked and loaded and you can see if there are any errors. You can then check to see if the service is running in the Tomcat screen to the right by refreshing the page.
Openmaint & Shark war files
First off from the \OpenMaint\extras\tomcat-libs\6.0 or higher folder copy the files to c:\tomcat\lib folder
Next, the     \OpenMaint\  openmaint-1.1-2.4.3.war file, rename it  openmaint.war
Also \OpenMaint\  openmaint-shark-server-1.1-2.4.3.war   file, rename it  shark.war
copy these files openmaint.war & shark.war to c:\tomcat\webapps\ folder and then watch ther command prompt screen.You will see these files being unpacked and fired up (slowly), you need to wait until the command prompt screen until SERVER STARTUP and xxxxxxxms  appears, then you know these tow progreammes have started.
Go to the tomcat screen    http://localhost:8080/manager/html/list (RH screen) and refresh to see if the openmaint & shark servers are running. If they are then we are almost there.
  • start openmaint in the browser      http://localhost:8080/openmaint
    • CMDBuild Database Type: Existing   ( I put in EMPTY and it would not let me log in, I messed around with this for quite a while, be warned)
    • CMDBuild Database name: 123    (in this demo case)
Host: localhost
Port: 5432
Login:  postgres
Password: whatever you chose
TEST the Connection
If OK hit the next button in bottom RH side
  • log in the application using one of the provided sample
    • users user with administrator privileges Username: admin – Password: admin
    • user without administrator privileges – Username: demouser – Password: demo
  • go to Administration -> Setup -> Workflow and set “Enabled” = true and fill the “Server URL” field with the URL of shark (e.g. http://localhost:8080/shark)
  • stop the Tomcat application server
  • go to webapps and remove the files openmaint.war and shark.war
  • go to weapps/shark/META-INF/context.xml and change the database name from ${cmdbuild} to the name that you gave to your database
  • go to weapps/shark/conf/Shark.conf and set the parameter “org.cmdbuild.ws.url” with the url of your openmaint application (e.g. http://localhost:8080/openmaint)
  • restart the Tomcat application server
And that should be that . I hope you get it up and running.

Tidak ada komentar:

Posting Komentar