-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from conwetlab/develop
Bug fixing
- Loading branch information
Showing
13 changed files
with
204 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<rdf:RDF | ||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > | ||
</rdf:RDF> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Utilities | ||
|
||
This folder contains utilities that can be used to install WMarket in a easier | ||
way. To install WMarket, you can use these to scripts: | ||
|
||
* `install.sh`: | ||
* Ready for Ubuntu 14.04 LTS & CentOS 7 | ||
* It installs all the required dependencies | ||
* It requires interaction to set the following parameters: | ||
* **Database**: user name and password | ||
* **Index**: path to Store Lucene indexes | ||
* **Media**: path to Store media files and the maximum size of these files | ||
* **Autoupdate period**: period to upload the descriptions and retrieve new | ||
offerings | ||
* **OAuth2**: enable or disable OAuth2. If OAuth2 is enabled, some parameters | ||
will be required (IdM URL, client ID, client secret, machine IP...) | ||
* `autoinstall.sh`: | ||
* Ready for Ubuntu 14.04 LTS | ||
* It installs all the required dependencies | ||
* It does not require interaction. Parameters are set with default values: | ||
* **Database**: | ||
* User: `root` | ||
* Password: `admin` | ||
* **Index**: `/opt/index` | ||
* **Media**: | ||
* Path: `/opt/media` | ||
* Max Size: 3145728 (3 MB) | ||
* **Autoupdate period**: 43200 (1 day) | ||
* **OAuth2**: No | ||
|
||
Additionally, you can use the `test.sh` script to check if the service is | ||
properly running. The script needs to know the IP where the service is running. | ||
You can specify it by setting the `IP` environment variable. For example, if | ||
your instance is running on `localhost`, you can run the script by executing the | ||
following commands: | ||
|
||
``` | ||
export IP=127.0.0.1 | ||
./test.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/bin/bash | ||
|
||
export MYSQL_PASS=root | ||
export WEBAPPS_PATH=/var/lib/tomcat7/webapps | ||
|
||
# Avoid interactivity (e.g. ask for a root password when installing MySQL) | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
# Exit on failure | ||
set -e | ||
|
||
|
||
################################################# | ||
#################### GET WAR #################### | ||
################################################# | ||
|
||
# Use GitHub API to get latest release | ||
# 1.- Check GitHub API | ||
# 2.- Get browser_download_url | ||
# 3.- Remove json field, quotes, colons and white spaces | ||
export URL_DOWNLOAD_LATEST=`curl https://api.github.com/repos/conwetlab/WMarket/releases/latest 2>/dev/null | grep browser_download_url | sed 's/.*"browser_download_url": "\(.*\)".*/\1/'` | ||
wget $URL_DOWNLOAD_LATEST | ||
|
||
|
||
################################################# | ||
########### DEPENDENCIES INSTALLATION ########### | ||
################################################# | ||
|
||
# Install | ||
sudo apt-get update -q | ||
sudo apt-get install -q -y unzip | ||
|
||
# Install MySQL | ||
# Avoid installation script to ask for a password | ||
sudo -E apt-get install -q -y mysql-server mysql-client | ||
# Set root password | ||
sudo mysqladmin -u root password $MYSQL_PASS | ||
|
||
# Install Java | ||
sudo apt-get install -q -y openjdk-7-jdk | ||
|
||
# Install Tomcat | ||
sudo apt-get install -y -q tomcat7 tomcat7-docs tomcat7-admin | ||
|
||
# Start up | ||
sudo service mysql restart | ||
sudo service tomcat7 stop | ||
|
||
|
||
################################################# | ||
################# CONFIGURATION ################# | ||
################################################# | ||
|
||
# Create Marketplace Database | ||
mysqladmin -u root -p$MYSQL_PASS create marketplace | ||
|
||
# Unzip WMarket | ||
unzip -q WMarket.war -d WMarket | ||
|
||
# Configure Marketplace | ||
sed -i "s|^jdbc.username.*$|jdbc.username=root|g" WMarket/WEB-INF/classes/properties/database.properties | ||
sed -i "s|^jdbc.password.*$|jdbc.password=$MYSQL_PASS|g" WMarket/WEB-INF/classes/properties/database.properties | ||
|
||
# Index | ||
export PATH_INDEX=/opt/index | ||
|
||
sed -i "s|lucene.IndexPath=.*$|lucene.IndexPath=$PATH_INDEX|g" WMarket/WEB-INF/classes/properties/marketplace.properties | ||
|
||
sudo mkdir $PATH_INDEX | ||
sudo chmod a+rw $PATH_INDEX | ||
|
||
# Media Files | ||
export PATH_MEDIA=/opt/media | ||
# 3 MB | ||
export MAX_SIZE_MEDIA_FILES=3145728 | ||
|
||
sed -i "s|^media.folder.*$|media.folder=$PATH_MEDIA|g" WMarket/WEB-INF/classes/properties/marketplace.properties | ||
sed -i "s|^media.maxSize.*$|media.maxSize=$MAX_SIZE_MEDIA_FILES|g" WMarket/WEB-INF/classes/properties/marketplace.properties | ||
|
||
sudo mkdir $PATH_MEDIA | ||
sudo chmod a+rw $PATH_MEDIA | ||
|
||
# Descriptions Autoupdate (24 hours) | ||
export PERIOD_UPDATE_DESCRIPTIONS=43200 | ||
|
||
sed -i "s|^descriptions.updatePeriod.*$|descriptions.updatePeriod=$PERIOD_UPDATE_DESCRIPTIONS|g" WMarket/WEB-INF/classes/properties/marketplace.properties | ||
|
||
# Update war file | ||
cd WMarket | ||
sudo jar uf ../WMarket.war WEB-INF/classes/properties/database.properties WEB-INF/classes/properties/marketplace.properties WEB-INF/classes/spring/config/BeanLocations.xml | ||
cd .. | ||
|
||
|
||
################################################# | ||
################### DEPLOYMENT ################## | ||
################################################# | ||
|
||
sudo chmod a+r WMarket.war | ||
sudo cp -p WMarket.war $WEBAPPS_PATH/WMarket.war | ||
sudo service tomcat7 start | ||
|
||
|
||
################################################# | ||
################## WAIT TOMCAT ################## | ||
################################################# | ||
|
||
tail -f /var/log/tomcat7/catalina.out | while read LOGLINE | ||
do | ||
[[ "${LOGLINE}" == *"Server startup"* ]] && pkill -P $$ tail | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# The script is aborted if any command fails. If it is OK that a comand fails, | ||
# use ./mycomand || true | ||
set -e | ||
|
||
# Checks that the service is up and running. | ||
# If the service has not been deployed, the server will return 404 and the command will fail | ||
# If the server cannot connect with the DB, the server will return 500 and the command will fail | ||
wget http://$IP:8080/WMarket/api/v2/user -o /dev/null |