Commit 9095bcf4 authored by Mohamad Bashar Desoki's avatar Mohamad Bashar Desoki

add haproxy cfg

parent c675e93f
<component name="ArtifactManager">
<artifact type="jar" name="simpleWebApp:jar">
<output-path>$PROJECT_DIR$/out/artifacts/simpleWebApp_jar</output-path>
<root id="archive" name="simpleWebApp.jar">
<element id="module-output" name="simpleWebApp" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jsoup/jsoup/1.12.1/jsoup-1.12.1.jar" path-in-jar="/" />
</root>
</artifact>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="simpleWebApp:jar" />
</artifacts-to-build>
</component>
<component name="AutoImportSettings"> <component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="ad904d3c-917a-41ec-8997-0c459fd2925c" name="Changes" comment=""> <list default="true" id="ad904d3c-917a-41ec-8997-0c459fd2925c" name="Changes" comment="simple web app">
<change afterPath="$PROJECT_DIR$/src/main/java/org/ds/WebServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/org/ds/WebServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/ds/WebServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/ds/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/ds/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/index.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/resources/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/index.html" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -35,13 +38,16 @@ ...@@ -35,13 +38,16 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;git-widget-placeholder&quot;: &quot;master&quot;, "git-widget-placeholder": "master",
&quot;kotlin-language-version-configured&quot;: &quot;true&quot; "kotlin-language-version-configured": "true",
"project.structure.last.edited": "Artifacts",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2850575"
} }
}</component> }]]></component>
<component name="RunManager"> <component name="RunManager">
<configuration default="true" type="JetRunConfigurationType"> <configuration default="true" type="JetRunConfigurationType">
<module name="simple-web-app" /> <module name="simple-web-app" />
...@@ -66,6 +72,15 @@ ...@@ -66,6 +72,15 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1740306614046</updated> <updated>1740306614046</updated>
</task> </task>
<task id="LOCAL-00001" summary="simple web app">
<option name="closed" value="true" />
<created>1740307109999</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1740307109999</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
...@@ -79,4 +94,8 @@ ...@@ -79,4 +94,8 @@
</map> </map>
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration">
<MESSAGE value="simple web app" />
<option name="LAST_COMMIT_MESSAGE" value="simple web app" />
</component>
</project> </project>
\ No newline at end of file
FROM haproxy:1.7
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
ENTRYPOINT ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
global
maxconn 500
defaults
mode http
timeout connect 10s
timeout client 50s
timeout server 50s
frontend http-in
bind *:80
default_backend application_nodes
backend application_nodes
balance roundrobin
option httpchk GET /status
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
listen stats
bind *:83
stats enable
stats uri /
global
defaults
mode http
timeout connect 5000
timeout client 50000
timeout server 50000
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
backend even_servers
balance roundrobin
server server02 127.0.0.1:9001/time check
backend odd_servers
balance roundrobin
server server01 127.0.0.1:9000/time check
server server03 127.0.0.1:9002/time check
global
defaults
mode tcp
timeout connect 5000
timeout client 50000
timeout server 50000
frontend http-in
bind *:80
default_backend application_nodes
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
...@@ -16,7 +16,7 @@ public class WebServer { ...@@ -16,7 +16,7 @@ public class WebServer {
private static final String STATUS_ENDPOINT = "/status"; private static final String STATUS_ENDPOINT = "/status";
private static final String HOME_PAGE_ENDPOINT = "/"; private static final String HOME_PAGE_ENDPOINT = "/";
private static final String HTML_PAGE = "index.html"; private static final String HTML_PAGE = "/index.html";
private final int port; private final int port;
private HttpServer server; private HttpServer server;
......
Manifest-Version: 1.0
Main-Class: org.ds.Main
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment