Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
D
Docker-HAProxy-LoadBalancer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
areej.mohammad
Docker-HAProxy-LoadBalancer
Commits
5574d3fb
Commit
5574d3fb
authored
Mar 02, 2026
by
AreejMh57
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parent
362bdc13
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
188 additions
and
36 deletions
+188
-36
vcs.xml
.idea/vcs.xml
+6
-0
workspace.xml
.idea/workspace.xml
+90
-2
dockerfile
WebApp/dockerfile
+20
-13
pom.xml
WebApp/pom.xml
+25
-2
dockerfile
haproxy/dockerfile
+7
-3
haproxy.cfg
haproxy/haproxy.cfg
+1
-1
haproxy_routing.cfg
haproxy/haproxy_routing.cfg
+27
-9
haproxy_tcp_mode.cfg
haproxy/haproxy_tcp_mode.cfg
+12
-6
No files found.
.idea/vcs.xml
0 → 100644
View file @
5574d3fb
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
""
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
.idea/workspace.xml
View file @
5574d3fb
...
...
@@ -11,7 +11,12 @@
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"ad904d3c-917a-41ec-8997-0c459fd2925c"
name=
"Changes"
comment=
"restructure and add docker compose file"
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/docker-compose.yml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/docker-compose.yml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/WebApp/dockerfile"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/WebApp/dockerfile"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/WebApp/pom.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/WebApp/pom.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/haproxy/dockerfile"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/haproxy/dockerfile"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/haproxy/haproxy.cfg"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/haproxy/haproxy.cfg"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/haproxy/haproxy_routing.cfg"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/haproxy/haproxy_routing.cfg"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/haproxy/haproxy_tcp_mode.cfg"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/haproxy/haproxy_tcp_mode.cfg"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -39,6 +44,11 @@
</component>
<component
name=
"PropertiesComponent"
>
{
"
keyToString
"
: {
"
Docker.docker-compose.yml.app1: Compose Deployment.executor
"
:
"
Run
"
,
"
Docker.docker-compose.yml.app2: Compose Deployment.executor
"
:
"
Run
"
,
"
Docker.docker-compose.yml.app3: Compose Deployment.executor
"
:
"
Run
"
,
"
Docker.docker-compose.yml.haproxy: Compose Deployment.executor
"
:
"
Run
"
,
"
Docker.docker-compose.yml: Compose Deployment.executor
"
:
"
Run
"
,
"
RunOnceActivity.ShowReadmeOnStart
"
:
"
true
"
,
"
SHARE_PROJECT_CONFIGURATION_FILES
"
:
"
true
"
,
"
git-widget-placeholder
"
:
"
master
"
,
...
...
@@ -46,7 +56,8 @@
"
last_opened_file_path
"
:
"
D:/HIAST Library/Teaching/ADS/2025/HAProxy/New folder/simple-web-app/src/haproxy
"
,
"
project.structure.last.edited
"
:
"
Artifacts
"
,
"
project.structure.proportion
"
:
"
0.15
"
,
"
project.structure.side.proportion
"
:
"
0.2850575
"
"
project.structure.side.proportion
"
:
"
0.2850575
"
,
"
settings.editor.selected.configurable
"
:
"
Docker
"
}
}
</component>
<component
name=
"RecentsManager"
>
...
...
@@ -54,6 +65,83 @@
<recent
name=
"D:\HIAST Library\Teaching\ADS\2025\HAProxy\New folder\simple-web-app\src\haproxy"
/>
</key>
</component>
<component
name=
"RunManager"
selected=
"Docker.docker-compose.yml.app1: Compose Deployment"
>
<configuration
default=
"true"
type=
"docker-deploy"
factoryName=
"docker-compose.yml"
temporary=
"true"
>
<deployment
type=
"docker-compose.yml"
>
<settings
/>
</deployment>
<method
v=
"2"
/>
</configuration>
<configuration
name=
"docker-compose.yml: Compose Deployment"
type=
"docker-deploy"
factoryName=
"docker-compose.yml"
temporary=
"true"
server-name=
"Docker"
>
<deployment
type=
"docker-compose.yml"
>
<settings>
<option
name=
"sourceFilePath"
value=
"docker-compose.yml"
/>
</settings>
</deployment>
<method
v=
"2"
/>
</configuration>
<configuration
name=
"docker-compose.yml.app1: Compose Deployment"
type=
"docker-deploy"
factoryName=
"docker-compose.yml"
temporary=
"true"
server-name=
"Docker"
>
<deployment
type=
"docker-compose.yml"
>
<settings>
<option
name=
"services"
>
<list>
<option
value=
"app1"
/>
</list>
</option>
<option
name=
"sourceFilePath"
value=
"docker-compose.yml"
/>
</settings>
</deployment>
<method
v=
"2"
/>
</configuration>
<configuration
name=
"docker-compose.yml.app2: Compose Deployment"
type=
"docker-deploy"
factoryName=
"docker-compose.yml"
temporary=
"true"
server-name=
"Docker"
>
<deployment
type=
"docker-compose.yml"
>
<settings>
<option
name=
"services"
>
<list>
<option
value=
"app2"
/>
</list>
</option>
<option
name=
"sourceFilePath"
value=
"docker-compose.yml"
/>
</settings>
</deployment>
<method
v=
"2"
/>
</configuration>
<configuration
name=
"docker-compose.yml.app3: Compose Deployment"
type=
"docker-deploy"
factoryName=
"docker-compose.yml"
temporary=
"true"
server-name=
"Docker"
>
<deployment
type=
"docker-compose.yml"
>
<settings>
<option
name=
"services"
>
<list>
<option
value=
"app3"
/>
</list>
</option>
<option
name=
"sourceFilePath"
value=
"docker-compose.yml"
/>
</settings>
</deployment>
<method
v=
"2"
/>
</configuration>
<configuration
name=
"docker-compose.yml.haproxy: Compose Deployment"
type=
"docker-deploy"
factoryName=
"docker-compose.yml"
temporary=
"true"
server-name=
"Docker"
>
<deployment
type=
"docker-compose.yml"
>
<settings>
<option
name=
"services"
>
<list>
<option
value=
"haproxy"
/>
</list>
</option>
<option
name=
"sourceFilePath"
value=
"docker-compose.yml"
/>
</settings>
</deployment>
<method
v=
"2"
/>
</configuration>
<recent_temporary>
<list>
<item
itemvalue=
"Docker.docker-compose.yml.app1: Compose Deployment"
/>
<item
itemvalue=
"Docker.docker-compose.yml.haproxy: Compose Deployment"
/>
<item
itemvalue=
"Docker.docker-compose.yml.app3: Compose Deployment"
/>
<item
itemvalue=
"Docker.docker-compose.yml.app2: Compose Deployment"
/>
<item
itemvalue=
"Docker.docker-compose.yml: Compose Deployment"
/>
</list>
</recent_temporary>
</component>
<component
name=
"SpellCheckerSettings"
RuntimeDictionaries=
"0"
Folders=
"0"
CustomDictionaries=
"0"
DefaultDictionary=
"application-level"
UseSingleDictionary=
"true"
transferred=
"true"
/>
<component
name=
"TaskManager"
>
<task
active=
"true"
id=
"Default"
summary=
"Default task"
>
...
...
WebApp/dockerfile
View file @
5574d3fb
FROM
maven:3.6.1-jdk-11 AS MAVEN_TOOL_CHAIN_CONTAINER
RUN
mkdir
src
COPY
src /tmp/src
COPY
./pom.xml /tmp/
WORKDIR
/tmp/
RUN
mvn package
RUN
ls
-la
/tmp
FROM
openjdk:11
COPY
--from=MAVEN_TOOL_CHAIN_CONTAINER /tmp/target/webapp-1.0-SNAPSHOT-jar-with-dependencies.jar /tmp/
WORKDIR
/tmp/
ENTRYPOINT
["java","-jar", "webapp-1.0-SNAPSHOT-jar-with-dependencies.jar"]
CMD
["80", "Server Name"]
\ No newline at end of file
# 1. تغيير الإصدار من 11 إلى 17 في مرحلة البناء
FROM
maven:3.8.5-openjdk-17 AS build_stage
WORKDIR
/app
# نسخ ملف pom.xml أولاً (للاستفادة من الـ Cache)
COPY
pom.xml .
RUN
mvn dependency:go-offline
# نسخ الكود المصدري وبناء المشروع
COPY
src ./src
RUN
mvn clean package
-DskipTests
# 2. تغيير الإصدار من 11 إلى 17 في مرحلة التشغيل
FROM
eclipse-temurin:17-jre
WORKDIR
/tmp
# نسخ ملف الـ JAR الناتج (استخدام النجمة * يضمن العثور على الملف مهما كان اسمه)
COPY
--from=build_stage /app/target/*.jar /tmp/app.jar
ENTRYPOINT
["java", "-jar", "app.jar"]
\ No newline at end of file
WebApp/pom.xml
View file @
5574d3fb
...
...
@@ -15,12 +15,35 @@
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>
org.jsoup
</groupId>
<artifactId>
jsoup
</artifactId>
<version>
1.12.1
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-shade-plugin
</artifactId>
<version>
3.2.4
</version>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
shade
</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<mainClass>
org.ds.Main
</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
haproxy/dockerfile
View file @
5574d3fb
FROM
haproxy:1.7
COPY
haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
ENTRYPOINT
["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
FROM
haproxy:2.8
COPY
haproxy_tcp_mode.cfg /usr/local/etc/haproxy/haproxy.cfg
CMD
["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
\ No newline at end of file
haproxy/haproxy.cfg
View file @
5574d3fb
...
...
@@ -17,7 +17,7 @@ backend application_nodes
http-check expect string "Server is alive"
server server01 app1:9001 check inter 1s
server server02 app2:9002 check inter 2s
server server03 app3:9003 check inter 2s
server server03 app3:9003
weight 2
check inter 2s
listen stats
bind *:83
...
...
haproxy/haproxy_routing.cfg
View file @
5574d3fb
global
maxconn 500
defaults
mode http
timeout connect 5000
timeout client 50000
timeout server 50000
timeout connect 5s
timeout client 50s
timeout server 50s
frontend http-in
bind *:80
acl even_cluster path_end -i /even
acl odd_cluster path_end -i /odd
use_backend even_servers if even_cluster
use_backend odd_servers if odd_cluster
default_backend all_servers
# even
backend even_servers
balance roundrobin
server server02 127.0.0.1:9001/time check
server server02 app2:9002 check
# odd server
backend odd_servers
balance roundrobin
server server01 127.0.0.1:9000/time check
server server03 127.0.0.1:9002/time check
server server01 app1:9001 check
server server03 app3:9003 check
backend all_servers
balance roundrobin
server server01 app1:9001 check
server server02 app2:9002 check
server server03 app3:9003 weight 2 check
#
haproxy/haproxy_tcp_mode.cfg
View file @
5574d3fb
global
maxconn 500
defaults
mode tcp
timeout connect 5
000
timeout client 50
000
timeout server 50
000
timeout connect 5
s
timeout client 50
s
timeout server 50
s
frontend http-in
bind *:80
...
...
@@ -12,6 +13,11 @@ frontend http-in
backend application_nodes
balance roundrobin
server server01 127.0.0.1:9000 check
server server02 127.0.0.1:9001 check
server server03 127.0.0.1:9002 check
server server01 app1:9001 check
server server02 app2:9002 check
server server03 app3:9003 check
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment