OpenMRS Labs
OpenMRS Labs are publicly viewable instances of OpenMRS, hosted by the kind people at Verio, that can be used to demonstrate and test work in progress.
Contents |
[edit]
Requesting a lab
If you have something to demonstrate or test and could use a public instance of OpenMRS, please contact labs@openmrs.org with the following information:
- Your contact info (name, IRC nick, Skype, e-mail)
- A brief description of how you would use the lab
- Url to your wiki user page
- Url to your wiki project page (if applicable)
- How long you will need the lab
- Your public key (Don't have a public key? See How to make a public key for instructions. (Send the one-liner public key)
[edit]
Current Labs
[edit]
Using Your Lab
- Access your lab with any ssh client (putty, ssh workstation, ssh at command line, etc):
- Use your trac username (or other assigned name) to log in
- Use your generated private ssh key instead of a password
- Your user should be in the "wheel" group, which means it can do anything. Use "sudo ____" to run tasks as root or "sudo su" to switch to the root user
- Your openmrs runtime properties file has the mysql and tomcat credentials
- The file is usually located in /home/tomcat/.Openmrs (or /root/.Openmrs)
- Openmrs can be access at http://lab_.openmrs.org:8080/openmrs
- Tomcat:
- Restart via command line: "sudo /etc/init.d/tomcat restart"
- Web admin can be accessed at http://lab_.openmrs.org:8080/manager/html
- Tomcat's installation directory is: /opt/tomcat
- Mysql:
- To restart via command line: "sudo /etc/init.d/mysql restart"
- Command line access: "mysql -uroot -p"
- (get password from openmrs-runtime.properties file)
- If you see this: "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)", then you need to restart mysql. See the command above.
- To enable module upload via the web, add module.allow_web_admin=true to your openmrs runtime properties and restart tomcat
- DO NOT enable this without changing the default administrator password!!
[edit]
OpenMRS Labs Install Shell Script
The below script installs mysql/tomcat/openmrs onto a Verio lab machine.
(Note: This is usually done by an admin before giving out the machine)
#!/bin/sh
## Create the user
echo -n "New user's username: "
read username
sudo /usr/sbin/useradd -g wheel $username
sudo mkdir /home/$username/.ssh
echo -n "New user's ssh key: "
read sshkey
echo $sshkey | sudo tee -a /home/$username/.ssh/authorized_keys
sudo chown -R $username /home/$username/.ssh
## Download and install the java5 jdk
wget -O jdk-6u4-linux-i586-rpm.bin http://ci.openmrs.org:8080/jdk-6u4-linux-i586-rpm.bin
wait
chmod u+x jdk-6u4-linux-i586-rpm.bin
./jdk-6u4-linux-i586-rpm.bin
wait
## Download and install Tomcat 6
wget -O tomcat-6.0.16-0.noarch.rpm ci.openmrs.org:8080/tomcat-6.0.16-0.noarch.rpm
wait
rpm -i tomcat-6.0.16-0.noarch.rpm
wait
## Download, install, and start MySQL
yum -y install MySQL-server.i386
wait
yum -y install MySQL-client.i386
wait
/etc/init.d/mysql start
## Set up Openmrs MySQL Database with some demo data
wget -O 1.4.0.23-demo-data.zip http://openmrs.org/images/a/a1/Demo-1.4.0.23-mysql.zip
wait
unzip 1.4.0.23-demo-data.zip
wait
echo Executing demo database sql
mysql -uroot -e"create database openmrs default character set utf8;"
mysql -uroot -e"source demo-1.4.0.23-mysql.sql" openmrs
wait
echo Installed the openmrs demo database
### wget -O update-to-1.4.2.sql http://resources.openmrs.org/builds/releases/OpenMRS_1.4.2/update-to-latest-db.mysqldiff.sql
### mysql -uroot -e"source update-to-1.4.2.sql" openmrs
## Create a local user for openmrs to read/write the database
openmrspw=opw-`date +%N`
echo Mysql local user openmrs password is $openmrspw
mysql -uroot -e"CREATE USER 'openmrs'@'localhost' IDENTIFIED BY '$openmrspw'; GRANT ALL ON openmrs.* TO openmrs;"
echo Created local mysql openmrs user
## Create an external mysql user for ci.openmrs.org
cipw=cipassword-`date +%N`
echo Mysql ciuser password is $cipw
mysql -uroot -e"CREATE USER 'ciuser'@'161.58.72.135' IDENTIFIED BY '$cipw'; GRANT ALL ON openmrs.* TO ciuser;"
echo Created mysql user for ci
## Fix the MySQL root user password
rootpw=password-`date +%N`
echo Mysql root password is $rootpw
mysql -uroot -e"UPDATE mysql.user SET Password=PASSWORD('$rootpw') WHERE User='root'; FLUSH PRIVILEGES;"
echo Created password for mysql root user
## Create a tomcat admin user
tomcatpw=tomcatpassword-`date +%N`
echo The tomcatadmin password is $tomcatpw
echo "<?xml version='1.0' encoding='utf-8'?>" > /opt/tomcat/conf/tomcat-users.xml
echo "<tomcat-users>" >> /opt/tomcat/conf/tomcat-users.xml
echo " <role rolename=\"manager\"/>" >> /opt/tomcat/conf/tomcat-users.xml
echo " <user username=\"tomcatadmin\" password=\"$tomcatpw\" roles=\"manager\"/>" >> /opt/tomcat/conf/tomcat-users.xml
echo "</tomcat-users>" >> /opt/tomcat/conf/tomcat-users.xml
echo Created a tomcat user
## Create the tomcat home directory
usermod -d/home/tomcat tomcat
mkdir /home/tomcat
## Create the runtime-properties file
mkdir /home/tomcat/.OpenMRS
echo connection.username=openmrs >> /home/tomcat/.OpenMRS/openmrs-runtime.properties
echo connection.password=$openmrspw >> /home/tomcat/.OpenMRS/openmrs-runtime.properties
echo connection.url=jdbc:mysql://localhost:3306/openmrs?autoReconnect=true >> /home/tomcat/.OpenMRS/openmrs-runtime.properties
echo module.allow_web_admin=true >> /home/tomcat/.OpenMRS/openmrs-runtime.properties
echo "#----" >> /home/tomcat/.OpenMRS/openmrs-runtime.properties
echo "#mysql root password is $rootpw" >> /home/tomcat/.OpenMRS/openmrs-runtime.properties
echo "#mysql 'ciuser' user password is $cipw" >> /home/tomcat/.OpenMRS/openmrs-runtime.properties
echo "#Tomcat :8080/manager/html login is tomcatadmin and password is $tomcatpw" >> /home/tomcat/.OpenMRS/openmrs-runtime.properties
chown -R tomcat /home/tomcat
echo Created the openmrs runtime properties file
## Download and install Openmrs war file
wget -O openmrs-1.4.2.war http://resources.openmrs.org/builds/releases/OpenMRS_1.4.2/openmrs.war
wait
mv openmrs-1.4.2.war /opt/tomcat/webapps/openmrs.war
wait
## (re)Start tomcat
/etc/init.d/tomcat restart
echo "(be sure to edit sudo file with visudo. Type :34, then x, then :wq)"
echo Done!
