摘要:因為要將平臺和應用化,需要測試并選擇部署工具及方式。頁面部署獨立版相關部署獨立版說明獨立版是指將的集成進來的,據說使用上跟差不多。接下來新建文件夾點擊下載打包好的文件文件中的文件夾分別用于存放要部署的三類文件。
因為要將平臺和應用Docker化,需要測試并選擇部署工具及方式。
頁面部署:
Nginx;Jexus;Jexus獨立版;
.Net相關(MVC、API、exe)部署:
Mono + Nginx;Mono + Jexus;Mono + Jexus獨立版;
說明:Jexus獨立版是指將Mono的RunTime集成進來的Jexus,據說使用上跟Mono + Jexus差不多。
接下來新建文件夾:
sudo mkdir /opt/webapi && cd /opt/webapi
點擊下載打包好的demo文件;
文件中的web mvc api文件夾分別用于存放要部署的三類demo文件。
點擊下載打包好的Dockerfile和腳本文件;
文件中的jexus nginx jexus-mono mono-jexus mono-jexus-mono mono-nginx文件夾分別存放了構建鏡像的Dockerfile文件和一些構建鏡像的腳本以及容器啟停的腳本,以免測試過程中總是重復輸入一些指令或上下翻找這些重復的指令。
注意:這些文件夾要放到同一路徑下,因為容器的啟動腳本中使用了相對路徑,這里我放到了新建的文件夾webapi下面,即/opt/webapi路徑下。web mvc api文件夾下放的都是要部署的demo文件,這里就不貼出來了。
jexus官方網站
Dockerfile
FROM debian:jessie MAINTAINER MongoRUN apt-get update && apt-get -y install wget && cd /usr && wget linuxdot.net/down/jexus-5.8.1.tar.gz && tar -zxvf jexus-5.8.1.tar.gz && ./jexus-5.8.1/install && rm -r jexus-5.8.1.tar.gz jexus-5.8.1 && apt-get -y autoremove --purge wget && rm -rf /var/lib/apt/lists/* EXPOSE 80 WORKDIR /usr/jexus CMD /usr/jexus/jws start && tail -f
build.sh
#!/bin/bash ./stop.sh docker build -t jexus/debian . docker rmi $(docker images | awk "$1 == "" && $2 == " " {print $3}")
start.sh
#!/bin/bash ./stop.sh EXPORT="11110" docker run -d -p $EXPORT:80 --name jexus-web -v $(pwd)/../web:/var/www/default --restart always jexus/debian:latest echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "Please use the browser to access this address => http://"ip[1]":""""$EXPORT"""}" echo
stop.sh
#!/bin/bash docker rm -f jexus-webjexus-mono
Dockerfile
FROM debian:jessie MAINTAINER MongoRUN apt-get update && apt-get -y install wget && cd /usr && wget linuxdot.net/down/jexus-5.8.1-x64.tar.gz && tar -zxvf jexus-5.8.1-x64.tar.gz && rm -r jexus-5.8.1-x64.tar.gz && apt-get -y autoremove --purge wget && rm -rf /var/lib/apt/lists/* EXPOSE 80 WORKDIR /usr/jexus CMD /usr/jexus/jwss
build.sh
#!/bin/bash ./stop.sh docker build -t jexus/mono:debian . docker rmi $(docker images | awk "$1 == "" && $2 == " " {print $3}")
start.sh
#!/bin/bash ./stop.sh webport="11120" mvcport="11122" apiport="11124" docker run -d -p $webport:80 --name jexus-mono-web -v $(pwd)/../web:/var/www/default --restart always jexus/mono:debian docker run -d -p $mvcport:80 --name jexus-mono-mvc -v $(pwd)/../mvc:/var/www/default --restart always jexus/mono:debian docker run -d -p $apiport:80 --name jexus-mono-api -v $(pwd)/../api:/var/www/default --restart always jexus/mono:debian echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "(OK)WEB - Please use the browser to access this address => http://"ip[1]":""""$webport"""}" echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "MVC - Please use the browser to access this address => http://"ip[1]":""""$mvcport"""}" echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "API - Please use the browser to access this address => http://"ip[1]":""""$apiport"""}" echo
stop.sh
#!/bin/bash docker rm -f jexus-mono-web jexus-mono-api jexus-mono-mvcnginx
官方網站 ; Nginx中文文檔 ; nginx官方鏡像及使用說明
Dockerfile(官方)
FROM debian:jessie MAINTAINER NGINX Docker Maintainers "docker-maint@nginx.com" ENV NGINX_VERSION 1.11.1-1~jessie RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base && rm -rf /var/lib/apt/lists/* # forward request and error logs to docker log collector RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log EXPOSE 80 443 CMD ["nginx", "-g", "daemon off;"]
start.sh
#!/bin/bash ./stop.sh webport="11160" # OK docker run -d -p $webport:80 --name nginx-web -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf -v $(pwd)/../web:/usr/share/nginx/html --restart always nginx:latest echo " " ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "(OK)WEB - Please use the browser to access this address => http://"ip[1]":""""$webport"""}"
stop.sh
#!/bin/bash docker rm -f nginx-webmono (official)
官方網站 ; Mono-Wiki ; DockerHub-Mono
Dockerfile(官方)
FROM debian:wheezy MAINTAINER Jo Shields#based on dockerfile by Michael Friis RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF RUN echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/4.4.0.182 main" > /etc/apt/sources.list.d/mono-xamarin.list && apt-get update && apt-get install -y mono-devel ca-certificates-mono fsharp mono-vbnc nuget referenceassemblies-pcl && rm -rf /var/lib/apt/lists/*
start.sh
#!/bin/bash ./stop.sh path="/usr/src/app/source" cmd="mono ./example.exe" cname="mono-official-exe" docker run -d -v $(pwd)/../exe:$path -w $path --name $cname mono:latest $cmd docker logs -f $cname
stop.sh
#!/bin/bash docker rm -f mono-official-exemono (seif/mono)
DockerHub-seif/mono ; 需要說明的是Mono的官方鏡像也是seif在更新維護的,另外他還上傳了其他Mono的相關鏡像:seif/mono-nginx ; seif/docker-mono-fastcgi-nginx (就是下面用到的mono/nginx) ; seif/mono-apache ; seif/mono-runit ;
Dockerfile
FROM debian MAINTAINER Seif AttarRUN apt-get update && apt-get install wget -y --no-install-recommends && echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/4.0.0 main" > /etc/apt/sources.list.d/mono-xamarin.list && wget -qO - http://download.mono-project.com/repo/xamarin.gpg | apt-key add - && apt-get update && apt-get install mono-runtime -y --no-install-recommends && apt-get purge wget -y && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /var/tmp/*
start.sh
#!/bin/bash ./stop.sh path="/usr/src/app/source" cmd="mono ./example.exe" cname="mono-seif-exe" docker run -d -v $(pwd)/../exe:$path -w $path --name $cname mono:latest $cmd docker logs -f $cname
stop.sh
docker rm -f mono-seif-exemono-jexus
Dockerfile
FROM mono:latest MAINTAINER MongoRUN apt-get update && apt-get -y install wget && cd /usr && wget linuxdot.net/down/jexus-5.8.1.tar.gz && tar -zxvf jexus-5.8.1.tar.gz && ./jexus-5.8.1/install && rm -r jexus-5.8.1.tar.gz jexus-5.8.1 && apt-get -y autoremove --purge wget && rm -rf /var/lib/apt/lists/* EXPOSE 80 WORKDIR /usr/jexus CMD /usr/jexus/jws start && tail -f
build.sh
#!/bin/bash ./stop.sh docker build -t mono/jexus . docker rmi $(docker images | awk "$1 == "" && $2 == " " {print $3}")
start.sh
#!/bin/bash ./stop.sh mvcport="11132" apiport="11134" tiport="11136" docker run -d -p $mvcport:80 --name mono-jexus-mvc -v $(pwd)/../mvc:/var/www/default mono/jexus docker run -d -p $apiport:80 --name mono-jexus-api -v $(pwd)/../api:/var/www/default mono/jexus echo " " ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "MVC - Please use the browser to access this address => http://"ip[1]":""""$mvcport"""}" echo " " ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "API - Please use the browser to access this address => http://"ip[1]":""""$apiport"""}" echo " " ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "(OK)MVC-tiMode - Please use the browser to access this address => http://"ip[1]":""""$tiport"""}" echo " " # OK docker run --rm -ti -p $tiport:80 --name jexus-mono-mvc-ti -v $(pwd)/../mvc:/var/www/default mono/jexus
stop.sh
#!/bin/bash docker rm -f mono-jexus-mvc mono-jexus-apimono-jexus-mono
Dockerfile
FROM mono:latest MAINTAINER MongoRUN apt-get update && apt-get -y install wget && cd /usr && wget linuxdot.net/down/jexus-5.8.1-x64.tar.gz && tar -zxvf jexus-5.8.1-x64.tar.gz && apt-get -y autoremove --purge wget && rm -rf jexus-5.8.1-x64.tar.gz /var/lib/apt/lists/* # COPY default /usr/jexus/siteconf/default EXPOSE 80 WORKDIR /usr/jexus CMD /usr/jexus/jwss
build.sh
#!/bin/bash ./stop.sh docker build -t mono/jexus:mono . docker rmi $(docker images | awk "$1 == "" && $2 == " " {print $3}")
start.sh
#!/bin/bash ./stop.sh mvcport="11142" apiport="11144" tiport="11146" docker run -d -p $mvcport:80 --name mono-jexus-mono-mvc -v $(pwd)/../mvc:/var/www/default mono/jexus:mono docker run -d -p $apiport:80 --name mono-jexus-mono-api -v $(pwd)/../api:/var/www/default mono/jexus:mono echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "MVC - Please use the browser to access this address => http://"ip[1]":""""$mvcport"""}" echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "API - Please use the browser to access this address => http://"ip[1]":""""$apiport"""}" echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "tiMode - Please use the browser to access this address => http://"ip[1]":""""$tiport"""}" echo docker run --rm -ti -p $tiport:80 -v $(pwd)/../api:/var/www/default mono/jexus:mono
stop.sh
#!/bin/bash docker rm -f mono-jexus-mono-mvc mono-jexus-mono-apimono-nginx(fastcgi)
Dockerfile
FROM seif/mono MAINTAINER Seif AttarADD service/ /etc/service/ ADD config/runit/1 /etc/runit/1 ADD config/runit/1.d/cleanup-pids /etc/runit/1.d/cleanup-pids ADD config/runit/2 /etc/runit/2 ADD runit_bootstrap /usr/sbin/runit_bootstrap RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list && apt-get update && apt-get install runit nginx mono-fastcgi-server4 -y --no-install-recommends && apt-get clean && rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* && mkdir -p /etc/mono/registry /etc/mono/registry/LocalMachine && find /etc/service/ -name run -exec chmod u+x {} ; && chmod u+x /usr/sbin/runit_bootstrap; ADD config/default /etc/nginx/sites-available/ ADD config/fastcgi_params /etc/nginx/ ADD runit_bootstrap /usr/sbin/runit_bootstrap EXPOSE 80
start.sh
#!/bin/bash ./stop.sh mvcport="11152" apiport="11154" path="/var/www:ro" image="--restart always mono/nginx:latest" cmd="/usr/sbin/runit_bootstrap" docker run -d -p $mvcport:80 -v $(pwd)/../mvc:$path --name mono-nginx-mvc $image $cmd docker run -d -p $apiport:80 -v $(pwd)/../api:$path --name mono-nginx-api $image $cmd echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "MVC - Please use the browser to access this address => http://"ip[1]":""""$mvcport"""}" echo ip addr show eth1 | awk "$1 == "inet" {split($2,ip,"/");print "API - Please use the browser to access this address => http://"ip[1]":""""$apiport"""}" echo
stop.sh
#!/bin/bash docker rm -f mono-nginx-mvc mono-nginx-api測試結果
鏡像大小:
REPOSITORY TAG SIZE DESCRIPTION mono/jexus latest 637.2 MB FROM mono,install jexus jexus/mono debian 170.8 MB FROM debian,install jexus with mono runtime jexus/debian latest 127.2 MB FROM debian,install jexus mono/jexus mono 674.3 MB FROM mono,install jexus with mono runtime nginx latest 182.6 MB FROM debian,install nginx(official) mono/nginx latest 480.9 MB FROM seif/mono,install nginx mono(official) latest 628.6 MB FROM debian:wheezy,install mono 4.4.0.182 mono(seif/mono) latest 153.7 MB FROM debian,install mono 4.0
Web部署及訪問正常的方式:
jexus-mono:debian(-d); nginx:latest(-d);
Exe部署運行正常的方式:
mono(official)(-d) ; mono(seif/mono)(-d);
MVC部署及訪問正常的方式:
mono-jexus:latest(-ti);mono-nginx(fastcgi)(-d);
API部署及訪問正常的方式:
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/26647.html
摘要:因為要將平臺和應用化,需要測試并選擇部署工具及方式。頁面部署獨立版相關部署獨立版說明獨立版是指將的集成進來的,據說使用上跟差不多。接下來新建文件夾點擊下載打包好的文件文件中的文件夾分別用于存放要部署的三類文件。 因為要將平臺和應用Docker化,需要測試并選擇部署工具及方式。 頁面部署:Nginx;Jexus;Jexus獨立版; .Net相關(MVC、API、exe)部署:Mono ...
摘要:我的服務器安裝的是最新版,上面的代碼貼的是參考文章的原文。換成域名或者服務器,測試結果應該為載入頁面時到服務器的連接被重置。火狐此時測試結果應該為默認頁此時測試結果應該為的默認頁,或者是報出的錯誤。個人認為,避免和混用才是上上策。 注:本文只是個人研究以及探索的方法,可能不太嚴謹,如果犯了什么專業性的錯誤,還希望各位看官加以指正,謝謝。(′?ω?`) 特別感謝:闊空晴云(每次遇到什么...
摘要:我的服務器安裝的是最新版,上面的代碼貼的是參考文章的原文。換成域名或者服務器,測試結果應該為載入頁面時到服務器的連接被重置。火狐此時測試結果應該為默認頁此時測試結果應該為的默認頁,或者是報出的錯誤。個人認為,避免和混用才是上上策。 注:本文只是個人研究以及探索的方法,可能不太嚴謹,如果犯了什么專業性的錯誤,還希望各位看官加以指正,謝謝。(′?ω?`) 特別感謝:闊空晴云(每次遇到什么...
摘要:實際上,認為文本文件都是結構化的,它將每一個輸入行定義為一個記錄,行中的每個字符串定義為一個域段,域和域之間使用分割符分割。 看到一篇Docker 技巧:刪除 Docker 容器和鏡像其中提到刪除標簽為none的鏡像的方法,其中用到了awk,就去查了下,下面舉例說明: docker rmi $(docker images | awk $1 == && $2 == {print $3...
摘要:在獨立版出來之前都是需要采用的方式來部署項目。現在只需用獨立版就可以完成部署工作。 在Jexus獨立版出來之前都是需要采用Mono + Jexus的方式來部署Asp.NET MVC項目。現在只需用Jexus獨立版就可以完成部署工作。 Jexus部署Asp.NET需要的文件 Dockerfile FROM ubuntu:latest MAINTAINER Mongo RUN apt...
閱讀 2866·2021-11-11 10:58
閱讀 1920·2021-10-11 10:59
閱讀 3489·2019-08-29 16:23
閱讀 2324·2019-08-29 11:11
閱讀 2785·2019-08-28 17:59
閱讀 3838·2019-08-27 10:56
閱讀 2049·2019-08-23 18:37
閱讀 3111·2019-08-23 16:53