From 42b435b8085329c75f1bc92f19b96310bf990d27 Mon Sep 17 00:00:00 2001 From: gnaegi <none@none> Date: Thu, 29 Dec 2011 22:24:51 +0100 Subject: [PATCH] OO-13 improve install readme, database section, removed unnecesary properties from sample config --- INSTALL.README.HEAD | 57 +++++++++++++++++--------- olat.local.properties.sample | 78 +++++++++++++++++------------------- scripts/dbAndUserSetup.sh | 16 ++++---- 3 files changed, 82 insertions(+), 69 deletions(-) mode change 100644 => 100755 scripts/dbAndUserSetup.sh diff --git a/INSTALL.README.HEAD b/INSTALL.README.HEAD index f3540ee6abc..1aab775b328 100644 --- a/INSTALL.README.HEAD +++ b/INSTALL.README.HEAD @@ -1,7 +1,8 @@ Setting up latest OpenOLAT version on Eclipse ------------------------------------------------------------------------- -o As the latest development is often ahead of the current documentation you will always find an up to date install guide here. +o As the latest development is often ahead of the current documentation you will always find an up to date + install guide here. o There a two different arts to install a development environment for OpenOLAT. Choose the one you prefer. @@ -15,7 +16,8 @@ Preconditions: o MySQL 5.1 or greater or PostreSQL 8.4 1. In Eclipse: create a Mercurial repository location (http://hg.openolat.org/openolat) and clone the repo. - 1.1 Do not add a password and make sure you uncheck the init Mercurial repo checkbox at the end. Right click to clone repo into your workspace. + 1.1 Do not add a password and make sure you uncheck the init Mercurial repo checkbox at the end. Right + click to clone repo into your workspace. 2. In Terminal: create eclipse project settings and create .classpath file by running mvn eclipse:clean eclipse:eclipse @@ -23,16 +25,26 @@ Preconditions: 3. In Eclipse: refresh the project 4. Create an olat.local.properties file somewhere - 4.1 Right click on olat.local.properties in our eclipse project (src/main/java) and link it to your own olat.local.properties. You can customized - your configuration whit this file. You can find an example in root of your eclipse project: olat.local.properties.sample + 4.1 Copy the olat.local.properties.sample to olat.local.properties in the project root folder + 4.2 Adjust the file to match your setup. See the comments in the file header for more configuration options. + 4.3 Right click on the file src/main/java/olat.local.properties in our eclipse project to open the file + properties and link it to your own olat.local.properties you created in step 4.1. + 4.4 Right now the same has to be done for the src/test/java/olat.local.properties: link it to a properties + file, otherwise the project will not build. Use an empty properties file if you don't want to run the + tests. -5. In MySQL create a user 'olat' and a database 'olat' - CREATE DATABASE IF NOT EXISTS olat; - GRANT ALL PRIVILEGES ON olat.* TO 'olat' IDENTIFIED BY 'olat'; - UPDATE mysql.user SET HOST='localhost' WHERE USER='olat' AND HOST='%'; +5. Prepare database permissions and initialize the database + 5.1.a. In MySQL create a user 'openolat' and a database 'openolat' + CREATE DATABASE IF NOT EXISTS openolat; + GRANT ALL PRIVILEGES ON openolat.* TO 'openolat' IDENTIFIED BY 'openolat'; + UPDATE mysql.user SET HOST='localhost' WHERE USER='openolat' AND HOST='%'; FLUSH PRIVILEGES; - - mysql -u olat -p olattest < src/main/resources/database/mysql/setupDatabase.sql + 5.1.b. Alternatively you can use a helper script to create the MySQL database user and the empty database: + scripts/dbAndUserSetup.sh + 5.2 Write the OpenOLAT database schema to the OpenOLAT database + mysql -u openolat -p openolat < src/main/resources/database/mysql/setupDatabase.sql + 5.3 Optional: if you want to run the jUnit tests, make sure you also create and initialize the test database + that you configured in src/test/java/olat.local.properties 6. In Eclipse: setup tomcat server by clicking on olat->Run As->"Run on Server". 6.1 The Run on Server wizard will pop up and check: manually define a new server @@ -53,25 +65,30 @@ Preconditions: Troubleshooting ******************************* -A. OutOfMemoryException: in Eclipse: setup VM arguments by clicking on Run > Run Configurations > Arguments > VM Arguments and pasting: +A. OutOfMemoryException: in Eclipse: setup VM arguments by clicking on + Run > Run Configurations > Arguments > VM Arguments and pasting: -Xmx384m -Xms128m -XX:MaxPermSize=128m -Djava.awt.headless=true -B. (optional) Create an empty olat.local.properties and save it to /yourTomcatDir/lib (OLAT searches for this file on the classpath and /tomcat/lib is part of it). - But OLAT should start with just the default config! +B. (optional) Create an empty olat.local.properties and save it to /yourTomcatDir/lib (OLAT searches for + this file on the classpath and /tomcat/lib is part of it). But OLAT should start with just the default config! -D. Usually you will get a timeout exception when you start a new OLAT. After double clicking on the server entry you can increase the timeout for the startup. +D. Usually you will get a timeout exception when you start a new OLAT. After double clicking on the server entry + you can increase the timeout for the startup. -E. If your tomcat starts very quickly but you cannot access OLAT it might be that tomcat did not find the OLAT context. - Right click the server entry and click publish to inform eclipse about a new or updated context. +E. If your tomcat starts very quickly but you cannot access OLAT it might be that tomcat did not find the OLAT + context. Right click the server entry and click publish to inform eclipse about a new or updated context. -F. If you run into problems with classes or resources not found e.g. "ClassNotFoundException" right click your server config and run the "Clean..." Task to republish - all resources. Problems comes mostly when switching from eclipse to console and back with command like mvn clean, or eclipse clean and such. You will always get a clean and working environment when you do the following: Eclipse clean, create eclipse settings with launch, Server publish resources and restart OLAT. +F. If you run into problems with classes or resources not found e.g. "ClassNotFoundException" right click your + server config and run the "Clean..." Task to republish all resources. Problems comes mostly when switching + from eclipse to console and back with command like mvn clean, or eclipse clean and such. You will always get + a clean and working environment when you do the following: Eclipse clean, create eclipse settings with launch, + Server publish resources and restart OLAT. Background (optional for further interest) ------------------------------------------------------------------ -o There is only one spring context for the whole OpenOLAT which you can access via CoreSpringFactory. The context is configured with - the files serviceconfig/olat.properies and can be overwritten with olat.local.properties. +o There is only one spring context for the whole OpenOLAT which you can access via CoreSpringFactory. The context + is configured with the files serviceconfig/olat.properies and can be overwritten with olat.local.properties. changes in olat.local.properties are reflected upon each restart of Tomcat. diff --git a/olat.local.properties.sample b/olat.local.properties.sample index c4ec191bd0a..5498380a4bb 100644 --- a/olat.local.properties.sample +++ b/olat.local.properties.sample @@ -1,28 +1,37 @@ ########## # -# when you start OLAT with an empty olat.local.properties file it will start with an embedded hsqldb and -# the userdata dir will be java.io.tmpdir. -# # To start, copy this file to olat.local.properties and modify it to fit your needs. Please have a look -# at the file src/main/resources/serviceconfig/olat.properties to the the full list of configuration +# at the file src/main/resources/serviceconfig/olat.properties to get the full list of configuration # options. # ########## -tomcat.id=2 -node.id=2 -generate.index.at.startup=false -build.identifier=openolat8-devLocal +######################################################################## +# Application data directory. +######################################################################## -guidemo.enabled=true +# runtime application data directory. Tomcat user needs R/W permissions here +userdata.dir=/opt/openolat/olatdata -# runtime application data directory -userdata.dir=/home/roman/olatdata/openolat -# name of the repository root -folder.root=${userdata.dir}/bcroot -# temporary workspace for the running application -temp.dir=${userdata.dir}/tmp +######################################################################## +# Database settings +######################################################################## + +# supported vendors currently include "mysql" and "postgresql" +db.vendor=mysql +db.hibernate.ddl.auto=validate +#db.hibernate.ddl.auto=update +auto.upgrade.database=false + +# the name of the application database +db.name=openolat +# the name of the OLAT database user +db.user=openolat +# the password of the OLAT database user +db.pass=openolat +# JDBC options (e.g., to set character channel behavior etc.) +db.jdbc.options=useUnicode=true&characterEncoding=UTF-8 ######################################################################## # Web application container (e.g., Tomcat) settings @@ -55,45 +64,32 @@ supportemail=${adminemail} # OLAT identity settings ######################################################################## -# OLAT instance ID (effects a unqiue namesapce for addressable items) +# OLAT instance ID (effects a unique namespace for addressable items) # ID should be no longer than 10 characters! This needs to be unique # amongst nodes within a cluster, if you are not clustering then you # can leave this value as is. instance.id=myopenolat +# some cluster settings +tomcat.id=2 +node.id=2 ######################################################################## -# Database settings +# Misc / Developer settings ######################################################################## -# supported vendors currently include "mysql" and "postgresql" -db.vendor=mysql -db.hibernate.ddl.auto=validate -#db.hibernate.ddl.auto=update -auto.upgrade.database=false - -# the name of the application database -db.name=openolat -# the name of the OLAT database user -db.user=openolat -# the password of the OLAT database user -db.pass=openolat -# JDBC options (e.g., to set character channel behaviour etc.) -db.jdbc.options=useUnicode=true&characterEncoding=UTF-8 - - -# only set this if you do not want unit tests to be performed during the build -skip.unit.tests=true -# set to false if you do not require special fonts -unpack.fonts=false # for developers set to true - velocity pages are NOT cached olatcore.debug=true # for developers set to false - i18n files are not cached localization.cache=false user.generateTestUsers=false -# When running in eclipse use "INFO, syslog, A1", for production use "INFO, syslog" -log.rootCategory = INFO, syslog, A1 - +# disable full text indexer at startup for development environment +generate.index.at.startup=false +# only set this if you do not want unit tests to be performed during the build +skip.unit.tests=true +# set to false if you do not require special fonts +unpack.fonts=false +# when running in eclipse use "INFO, syslog, A1", for production use "INFO, syslog" +log.rootCategory = INFO, syslog, A1 # if enabled then the IM Server must be running before OLAT is started! instantMessaging.enable=false - diff --git a/scripts/dbAndUserSetup.sh b/scripts/dbAndUserSetup.sh old mode 100644 new mode 100755 index 4e835110b61..3ff2ebb4d3f --- a/scripts/dbAndUserSetup.sh +++ b/scripts/dbAndUserSetup.sh @@ -1,10 +1,10 @@ #!/bin/bash -############################################################################# -# Initial database setup script: will generate db user and an olat database # -# 11. July 2004 Florian Gnaegi # -############################################################################# +################################################################################# +# Initial database setup script: will generate db user and an openolat database # +# 11. July 2004 Florian Gnaegi # +################################################################################# -echo "This script will create a database user and a database for OLAT on your MySQL server. Do you want to continue? (y|n)" +echo "This script will create a database user and a database for OpenOLAT on your MySQL server. Do you want to continue? (y|n)" read Y if [ "$Y" != "y" ]; then echo byby @@ -12,9 +12,9 @@ if [ "$Y" != "y" ]; then fi # collect user dbname, username, password -echo Enter your OLAT database name: +echo Enter your OpenOLAT database name: read OLATDB -echo Enter your OLAT database user: +echo Enter your OpenOLAT database user: read OLATUSER echo Enter the password for database user $OLATUSER: read OLATPWD @@ -23,7 +23,7 @@ read OLATPWD QUERY="CREATE DATABASE $OLATDB; GRANT ALL PRIVILEGES ON $OLATDB.* TO '$OLATUSER'@'localhost' IDENTIFIED BY '$OLATPWD';" # executing query -echo Generating now the OLAT database user $OLATUSER with the password $OLATDB that has access to the database $OLATDB +echo Generating now the OpenOLAT database user $OLATUSER with the password $OLATDB that has access to the database $OLATDB echo You must now enter the MySQL root user password: mysql -u root -p mysql -e "$QUERY" echo "User generated. Try login now with 'mysql -u $OLATUSER -p $OLATDB'" -- GitLab