Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Deployment with containerize database #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/target
*/*/target
182 changes: 182 additions & 0 deletions Deploy-With-Informix-Container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Deploy TC-Website With TC-Informix Container
## System Requirement
This setup run on this environment:
- Ubuntu 16.04
- Oracle Jdk 8
- Jboss-4.0.4
- Informix 11.5
- docker 1.13
_Setup on different platform require platform specific adjusment_

## Preparing system
- Install required software.
```
sudo apt-get update
sudo apt-get install build-essential git
```

- Install Apache httpd 2.2.15
```
wget https://archive.apache.org/dist/httpd/httpd-2.2.15.tar.gz
tar xvfz httpd-2.2.15.tar.gz
cd httpd-2.2.15
./configure
make
sudo make install
```
Apache httpd will be installed under ```/usr/local/apache2```

- Install tomcat connector
```
wget http://www-eu.apache.org/dist/tomcat/tomcat-connectors/jktomcat-connectors-1.2.42-src/tomcat-connectors-1.2.42-src.tar.gz
tar xvfz tomcat-connectors-1.2.42-src.tar.gz
cd tomcat-connectors-1.2.42-src
./configure -with-apxs=/usr/local/apache2/bin/apxs
make
sudo make install
```

- Install docker
Please follow this official step:
https://docs.docker.com/engine/installation/linux/ubuntu/

- Install JDK-8
Download JDK8 from here:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html. Extract the downloaded file and move jdk directory to ```/opt```. The result jdk will point to something like ```/opt/jdk1.8.0_121```

- Install Apache Maven
Download from here http://apache-mirror.rbc.ru/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
Extract the downloaded file and move maven directory to ```/opt```. And Apache maven will sit on ```/opt/apache-maven-3.3.9```

- Install Jboss-4.0.4-GA
Download from here https://sourceforge.net/projects/jboss/files/JBoss/JBoss-4.0.4.GA/ And extract the dowloaded file.

- Clone ```tc1-tcnode``` repo:
```
git clone https://github.com/appirio-tech/tc1-tcnode.git
```

## Configuring
> Note for *Windows* environment:
>
> - Use *forward slash (/)* to point path for variable ```PROJECT_HOME``` and ```JBOSS_HOME```.
> > Example for setting up enviroment variable: ```SET PROJECT_HOME="C:/Users/me/project/tc1-tcnode```
>
> - Use *forward slash (/)* to point path on apache ```httpd.conf``` and ```tc-ears/main/src/main/resources/ApplicationServer.properties```
>
> - Environment variable should be surrounded by ```%```
> > Example: ```mvn clean package -Pmain -Dproject-path=%PROJECT_HOME%```

- Configuring environment variables
Add these line at the bottom of ```$HOME/.bashrc```
*NOTE. You need to adjust it with your environment*
```
export JAVA_HOME=/opt/jdk1.8.0_121
export PATH=$JAVA_HOME/bin:/opt/apache-maven-3.3.9/bin:/usr/local/apache2/bin:$PATH
```

Apply it by executing:
```
source ~/.bashrc
```
- (Optional) Set these enviroment variables by executing
```
export PROJECT_HOME=<full path to tc1-tcnode>
export JBOSS_HOME=<full path to jboss installation>
```
- Edit ```$PROJECT_HOME/src/main/resources/apache/httpd.conf```
```
<VirtualHost *:80>
...
DocumentRoot <full-path-to_$PROJECT_HOME/tc-wars/static/src/main/webapp>
```

copy ```src/main/resources/apache/*.conf``` to ```/usr/local/apache2/conf```

```
sudo cp $PROJECT_HOME/src/main/resources/apache/*.conf /usr/local/apache2/conf
```

- Edit ```$JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/conf/web.xml```
Uncomment these lines:
```
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.5</param-value>
</init-param>

```
- Delete following files from local JBoss server installation:
```$JBOSS_HOME/server/all/lib/hibernate3.jar```

- Edit ```$PROJECT_HOME/tc-ears/main/src/main/resources/ApplicationServer.properties```. You may need to change the following fields:
```
SERVER_NAME - A domain name or IP-address for host running the JBoss server
instance
BASE_DIR - An absolute path to $PROJECT_HOME/src/main directory
DISTRIBUTED_UI_SERVER_NAME - same as SERVER_NAME
```

- (Optional) Edit ```$PROJECT_HOME/tc-ears/main/src/main/resources/cache.properties```
If you want run caching (i.e with redis backend).

- (Optional) Edit ```$PROJECT_HOME/tc-ears/main/src/main/resources/EmailEngineConfig.properties``` and ```$PROJECT_HOME/tc-ears/main/src/main/resources/com/topcoder/message/email/EmailEngine.xml```
If you have smtpd running.

- Edit ```/etc/hosts``` Add these lines
```
127.0.0.1 local.topcoder.com
127.0.0.1 local.cloud.topcoder.com
127.0.0.1 local.tc.cloud.topcoder.com
127.0.0.1 local.studio.cloud.topcoder.com
127.0.0.1 local.env.cloud.topcoder.com
<tc-informix contaner ip addr> env.topcoder.com
127.0.0.1 local.cockpit.cloud.topcoder.com
127.0.0.1 local.tcs.cloud.topcoder.com
```

> NOTE
> use ```docker inspect tc-informix ``` after tc-informix running to find its ip addresss
## Build And Deploy
Under $PROJECT_HOME
```
#build
mvn clean package -Pmain -Dproject-path=$PROJECT_HOME
#copy resource to jboss
mvn resources:copy-resources -Pdeploy -Djboss-home=$JBOSS_HOME
#copy informix driver to jboss
mvn resources:copy-resources -Pinit -Djboss-home=$JBOSS_HOME
#deploy
mvn jboss:hard-deploy -Pdeploy -Djboss-home=$JBOSS_HOME
```
## Run
- Run tc-informix container
```
docker run -d -p 2021:2021 --name tc-informix appiriodevops/informix:cbbd0fa
```

- (Optional) Run redis container
```
docker run -d -p 6379:6379 --name redis redis
```

- Start Apache
```
sudo apachectl -k start
```
- Run jboss
```
cd $JBOSS_HOME/bin
./run.sh -c all
```

## Verification

see ```Verification.pdf``` for detail.







2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
<outputDirectory>${jboss-home}/server/all/lib</outputDirectory>
<resources>
<resource>
<directory>tc-maven\com\informix\jdbc\com.informix.jdbc\1.0.0</directory>
<directory>tc-maven/com/informix/jdbc/com.informix.jdbc/1.0.0</directory>
<includes>
<include>com.informix.jdbc-1.0.0.jar</include>
</includes>
Expand Down
56 changes: 28 additions & 28 deletions src/main/resources/apache/httpd.conf
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
ServerRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2"
ServerRoot "/usr/local/apache2"
Listen 80

LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule alias_module modules/mod_alias.so
#LoadModule asis_module modules/mod_asis.so
#LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule authn_default_module modules/mod_authn_default.so
#LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authz_default_module modules/mod_authz_default.so
#LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
#LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cgi_module modules/mod_cgi.so
#LoadModule dir_module modules/mod_dir.so
#LoadModule env_module modules/mod_env.so
#LoadModule include_module modules/mod_include.so
#LoadModule isapi_module modules/mod_isapi.so
#LoadModule log_config_module modules/mod_log_config.so
#LoadModule mime_module modules/mod_mime.so
#LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule setenvif_module modules/mod_setenvif.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
Expand All @@ -33,7 +33,7 @@ ServerAdmin [email protected]

ServerName local.tc.cloud.topcoder.com:80

DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
DocumentRoot "/usr/local/apache2/htdocs"

<Directory />
Options FollowSymLinks
Expand All @@ -43,7 +43,7 @@ DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs
Allow from all
</Directory>

<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
<Directory "/usr/local/apache/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Expand Down Expand Up @@ -76,13 +76,13 @@ LogLevel warn
</IfModule>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/"
ScriptAlias /cgi-bin/ "/usr/local/apache/htdocs/cgi-bin/"
</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
<Directory "/usr/local/apache/htdocs/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Expand Down Expand Up @@ -114,8 +114,8 @@ LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule php5_module modules/libphp5.so

NameVirtualHost *:80
Expand All @@ -127,7 +127,7 @@ NameVirtualHost *:80
LogLevel warn
CustomLog logs/tc_access_log combined
ServerSignature Off
DocumentRoot "G:/TopCoder/Assembly/TopCoder/MoveToGitHub/TopCoderSiteMaven/tc-wars/static/src/main/webapp"
DocumentRoot "/work/tc1-tcnode/tc-wars/static/src/main/webapp"

AddHandler server-parsed shtml
DirectoryIndex index.shtml
Expand Down
18 changes: 18 additions & 0 deletions tc-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,23 @@
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.topcoder</groupId>
<artifactId>tc_cache</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Loading