반응형

RabbitMQ 설치  RabbitMQ설치가 아직 안되어있다면 해당 링크를 통해 설치해주시기 바랍니다.

환경
  • 개발 Window10 / 배포 Window2008 
  • Visual Studio 2019
  • Git
  • IIS
  • Github
  • Jenkins
  • Nuget4.9
  • MSBuilder
  • RabbitMQ 3.9.12
  • Erlang 24.2
설정

1.  클러스터 설정할 서버들의 RabbitMQ Conmmand Prompt 를 실행 후 rabbitmqctl cluster_status 명령어를 실행하여,각 서버의 HOST NAME을 확인해줍니다. (필자는 이미 클러스터를 설정하여 2개로 보이나,  처음 설정시 1개만 보임)

 

 

 

2. Windows\System32\drivers\etc\host.txt 파일에 

아이피 Hostname으로 등록해줍니다.

 

3. 클러스터의 메인이 될 서버에서 

C:\Windows\System32\config\systemprofile\.erlang.cookie 파일을 복사아혀

클러스터될 각 서버들의C:\Windows\System32\config\systemprofile 와 C:\Users\user (각각 다를 수 있음 사용자의 사용자) 경로에 붙여넣기 해줍니다.

※ 혹시모르니 각 서버들의 Rabbit 서비스 중지 후 작업합니다.

 

4. 클러스터로 들어갈 서버에서 RabbitMQ Conmmand Prompt 를 실행 시킨 후 해당 명령어를 순서대로 실행시켜줍니다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 노드 중지
> rabbitmqctl stop_app
 
# 노드 다시 세팅
> rabbitmqctl reset
 
# 클러스터 조인
> rabbitmqctl join_cluster rabbit@dev-rabbit001
 
# 노드 시작
> rabbitmqctl start_app
 
# 클러스터 상태 확인
? rabbitmqctl cluster_status
cs

이것으로 RabbitMQ 클러스터 설정이이 끝났습니다.

 

감사합니다.

 

 

 

반응형

'라이브러리' 카테고리의 다른 글

윈도우 Jenkins 설치 [3]  (0) 2020.06.14
윈도우 Jenkins 설치 [2]  (0) 2020.06.14
윈도우 Jenkins 설치  (0) 2020.06.11
[RabbitMQ] 사용자 추가  (0) 2018.09.06
RabbitMQ설치  (0) 2018.09.06
반응형

안녕하세요. 지난 포스팅에 이어서 Git프로젝트와 Jenkins와 연동하여 빌드&배포하는 방법을 포스팅 하도록하겠습니다.

 

윈도우 Jenkins설치[2]  기억이 안나시면 왼쪽 링크 참조하시기 바랍니다.

 

Github

환경

  • 개발 Window10 / 배포 Window2008 
  • Visual Studio 2019
  • Git
  • IIS
  • Github
  • Jenkins
  • Nuget4.9
  • MSBuilder

설정

먼저, GitHub에 테스트용 프로젝트를 생성하고 진행 하시기 바랍니다.

 

JenKins 메인화면에서 New Item 혹은 새로운 Item 메뉴를 클릭합니다.

 

 

 

아이템명을 입력하고 FreeStyle Project를 선택한 후 OK버튼을 누릅니다.

 

 

GitHub Project에 체크를하고 Project Url에 프로젝트의 URL을 입력합니다.

https://github.com/유저명/프로젝트명

 

 

 

소스 코드 관리 탭에서 Git을 체크 하고 Repository URL에 clone에 쓰이는 url을 입력 합니다. 

 

GitHub 프로젝트에 clone or download 에서 주소를 복사할 수 있습니다.

 

 

Git-Bash를 실행하여 해당 명령어로 키를 생성합니다.

 

passphrase 를 입력하라고 하면 그냥 엔터 누르시면 됩니다.

 

그럼  확장자없는 파일 하나, .pub 확장자를 가진 파일 하나가 생성됩니다.

 

확장자없는 파일에는 개인키가 들어있고 .pub 파일에는 공개키가 들어있습니다

ssh-keygen -t rsa -f 파일명

 

Repository URL 아래 Credentials에 Add를 누릅니다.

 

 

Kind를 SSH Username with private key 로 설정하시고 아래에 개인키를 메모장으로 열어서 begin -end 사이를  복사하여 붙여넣으세요.

 

개인키가 등록되었으면 github 프로젝트로 들어가 프로젝트의 Settings - Deploy Keys 에서 Add deploy key 를 선택합니다.

 

제목을 입력하고, Key 부분에는 아까 생성한 공개키 (.pub 파일) 을 메모장으로 열어 내용을 복붙합니다.

 

Allow write access 체크는 푸시고, Add key 하세요. 

 

저장이 되었으면, 이제 jenkins로 github 프로젝트 코드를 가져오고 빌드를 진행할 수 있습니다

 

 

Webhook 설정

 

새창을 여시고, 젠킨스 메인에서Jenkins 관리 - 시스템 설정으로 가Jenkins Location을 수정해주세요.

 

루프백 외에 외부에서 접근할 수 있는 도메인이나 ip/(설정한포트)를 입력하셔야 합니다. 

 

 

깃허브 프로젝트 설정으로 돌아가, Webhook 메뉴로 이동해 add webhook 버튼을 누릅니다.

 

Payload URL에는 Jenkins 주소/github-webhook/ 을 입력합니다.

마지막에 / 는 꼭 입력되어야 합니다

나머지는 기본값으로 두고 Add webhook 으로 완료합니다.

 

다시 젠킨스의 Item 생성 하던 곳으로 돌아갑시다.

 

빌드 유발 탭에서 GitHub hook trigger for GITScm polling을 선택합니다. 

 

이것으로 github에 push 이벤트가 발생하면 자동으로 빌드가 이루어질텐데,

 

서버에 따로 Visual Studio가 설치되어 있지 않으면 Build시 에러가 발생 할 수 있어 

 

Build전에 프로그램을 몇개 더 설치 해야합니다.

 

1.

https://www.nuget.org/downloads 에서 Nuget.exe를 다운로드하여 설치합니다

 

NuGet Gallery | Downloads

 

www.nuget.org

2.

Visual Studio Installer를 설치하여 MSbuiler만 설치합니다.

 

3.Jenkins 메인 > Jenkins 관리 > Global Tool Configuration 을 클릭합니다.

 

MSBuild탭 Add MSBuild버튼을 누르고

 

Name: 구분명

 

Path to MSBuild : 설치된 MSBuild 경로를 입력 한 후 저장을 누릅니다. 

 

 

 

다시 젠킨스의 Item 생성 하던 곳으로 돌아갑시다.

 

다시 Jeknins로 돌아와 [Build] 탭으로 옵니다.

 

Add Build Step을 눌러 [Execute Windows batch command] 를 추가하고, 

 

[Nuget 설치경로/실행파일] restore [.net 프로젝트]을 입력합니다

 

※ Build전 패키지 복구

C:\nuget\nuget.exe restore "C:\Program Files (x86)\Jenkins\workspace\bimp\jenkins.sln"

 

※ Build

다시 Add Build Step을 눌러 [Build a Visual Studio project or solution using MSBuild] 를 추가하고, 

 

MSBuild Version에는 아까 생성한 버전을 선택하고

 

MSBuild Build File은 .net프로젝트위치를 .sln을 포함하여 입력합니다

 

 

Command Line Arguments는 /p:Configuration=Release를 입력 하고 그외 설정은 직접 찾아보시면 됩니다.

 

 

※ Build 후 서비스되는 폴더로 옮기기

마지막으로 Add Build Step을 눌러 [Execute Windows batch command] 를 추가하고, 

 

xcopy ".net프로젝트폴더" "서비스되는폴더"  /s /h /e /d /y 를 입력합니다

 

xcopy "C:\Program Files (x86)\Jenkins\workspace\bimp\jenkins" "C:\test\" /s /h /e /d /y

 

 

이것으로 이제 Git에 소스를 푸쉬하면 자동 빌드 & 배포가 되도록 셋팅이 끝났습니다.

 

감사합니다.

 

반응형

'라이브러리' 카테고리의 다른 글

RabbitMQ 클러스터 설정하기  (0) 2022.01.15
윈도우 Jenkins 설치 [2]  (0) 2020.06.14
윈도우 Jenkins 설치  (0) 2020.06.11
[RabbitMQ] 사용자 추가  (0) 2018.09.06
RabbitMQ설치  (0) 2018.09.06
반응형

안녕하세요. 지난 포스팅에 이어서 Git과 연결하는 방법을 포스팅 하도록하겠습니다.

 

윈도우 Jenkins설치 기억이 안나시면 링크 참조하시기 바랍니다.

 

Github

설정

젠킨스 메인에서 Jenkins 관리로 들어간 후, Global Tool Configuration 메뉴로 들어갑니다.

 

스크롤을 내려 Git 부분에 Path to Git executable부분에 깃이 설치된 경로를 git.exe를 포함하여 입력해주세요.

 

Git 없으시다면 다운로드 해주세요 ~

 

 

 

Git에 로그인 하여 프로필을 눌러서 Settings에 들어값니다.

 

 

Developer settings에 들어갑니다.

 

 

Personal access tokens 를 클릭 후 Generate new token 버튼을 눌러줍니다.

아래 두 스코프에 체크 후 Token을 생성합니다.  ※생성한 Token은 잘 보관해둡니다.

 

다시 Jenkins메인 -> Jenkins관리 -> 시스템설정메뉴로 갑니다

 

 

아래로 내리다 보면 GitHub항목이 있습니다. [Add GitHub Server] 버튼 클릭 후,

 

Credentials 옆 Add 버튼을 누릅니다

Kind : Secret text

Secret : 발급받은 Token Key

ID : 구분하기 편한 이름 아무거나 입력해주시고 Add 해줍니다.

 

오른쪽 아래 Test connection까지 해주시고 저장 해주시면 됩니다.

 

 

Git연동시 Token외에 OAuth방식으로 인증도 가능한데 이부분은 따로 포스팅 하도록 하겠습니다.

 

다음 포스팅에서는 Git에 올라가 있는 소스를 빌드하여 서비스에배포하는 부분을 다루도록 하겠습니다.

 

감사합니다

반응형

'라이브러리' 카테고리의 다른 글

RabbitMQ 클러스터 설정하기  (0) 2022.01.15
윈도우 Jenkins 설치 [3]  (0) 2020.06.14
윈도우 Jenkins 설치  (0) 2020.06.11
[RabbitMQ] 사용자 추가  (0) 2018.09.06
RabbitMQ설치  (0) 2018.09.06
반응형

윈도우 Jenkins 설치

목표: JenKins설치 -> Msbuild 플러그인 설치 -> 자동빌드 & 배포

다운로드&설치

JenKinsDown로 들어가 맞는 버전의 LTS를 설치해주면 됩니다.

 

Jenkins installation and setup

Jenkins – an open source automation server which enables developers around the world to reliably build, test, and deploy their software

www.jenkins.io

압축을 풀고 Msi를 실행시켜 Next버튼을 눌러 설치를 완료 해줍니다.

 

설정
  • 혹시 8080포트를 사용중일 경우 설치폴더/jenkins.xml 를 실행 후 포트를 변경해주시면됩니다.
    <executable>%BASE%\jre\bin\java</executable>
    <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar 
    "%BASE%\jenkins.war" --httpPort=35555 --webroot="%BASE%\war"</arguments>

리눅스에서는 */etc/sysconfig/jenkins** 에서 아래 부분 수정.

JENKINS_PORT="8080"

 

  • 포트를 변경하셨다면 해당 포트의 방화벽을 오픈하셔야 됩니다.

  • 그리고 jenkins 서비스를 재시작합니다.

 

젠킨스를 실행하면 해당 화면이 나오는데, 왼쪽은 기본플러그인, 오른쪽은 커스텀 원하는 부분 클릭하여 설치를 해줍니다.

 

설치 후 계정을 생성해줍니다. 이후 Next를 누르면 설정이 완료 됩니다.

 

 

이 화면까지 나오면 정상적으로 설정이 된 것입니다. 이후 셋팅은 다음 포스팅에 이어서 하겠습니다.

 

즐공 ^^

반응형

'라이브러리' 카테고리의 다른 글

RabbitMQ 클러스터 설정하기  (0) 2022.01.15
윈도우 Jenkins 설치 [3]  (0) 2020.06.14
윈도우 Jenkins 설치 [2]  (0) 2020.06.14
[RabbitMQ] 사용자 추가  (0) 2018.09.06
RabbitMQ설치  (0) 2018.09.06
반응형

.Net MVC솔루션 개발 중

 

Ajax를 [Async:true] 로 호출해도 프리징 현상이 일어나서 원인을 파악해보니,

 

Sesstion State를 사용하면 Session Access Lock으로 인해 Serialize하게 동작하는 것을 확인했다,

 

이를 위한 해결 방법으로는 Controller에 Attribute를 사용하는 방법이 있습니다.

 

1
[SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)]
cs

 

APIController에서 Session을 사용할 수 있는데, 사용하기 위해서는 Global.asmx에 이부분을 입력 하면 됩니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
private const string _WebApiPrefix = "api";
private static string _WebApiExecutionPath = String.Format("~/{0}", _WebApiPrefix);
 
protected void Application_PostAuthorizeRequest()
{
    if (IsWebApiRequest())
    {
        HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.ReadOnly);
    }
    else
    {
        HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
    }
}
 
private static bool IsWebApiRequest()
{
    return HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath.StartsWith(_WebApiExecutionPath);
}
cs
[ APIUrl이 api/{Controller}/{action}일때는 ReadOnly 그외에는 Required ]

 

 

해당 소스에서  _WebApiPrefix변수와 Application_PostAuthorizeRequest 메소드를 이용해 세션 사용여부를 사용합니다.

 

HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required 가 Session을 읽기/쓰기사용하는 설정이고,

 

HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.ReadOnly가 Session을 읽기만 하는 설정입니다

 

위 변수와 WebApiConfig.cs 를 통해 원하는 용도에 맞게 API를 이용할 수 있습니다.

 

감사합니다.

 

 

 

반응형

'BackEnd > ASP .NET' 카테고리의 다른 글

[ASP.NET] WEB API에서 세션(SESSION) 사용하기  (1) 2017.04.10
반응형
JQuery에 다른 기능을 검색하다가 아래의 사이트를 발견하여 나중에 도움이 될 듯하여 정리해둔다.

1. jQuery로 선택된 값 읽기

$("#selectBox option:selected").val();
$("select[name=name]").val();


2. jQuery로 선택된 내용 읽기

$("#selectBox option:selected").text();
 

3. 선택된 위치

var index = $("#test option").index($("#test option:selected"));


4. Add options to the end of a select

$("#selectBox").append("<option value='1'>Apples</option>");
$("#selectBox").append("<option value='2'>After Apples</option>");
 

5. Add options to the start of a select

$("#selectBox").prepend("<option value='0'>Before Apples</option>");
 

6. Replace all the options with new options

$("#selectBox").html("<option value='1'>Some oranges</option><option value='2'>MoreOranges</option>");
 

7. Replace items at a certain index

$("#selectBox option:eq(1)").replaceWith("<option value='2'>Someapples</option>");
$("#selectBox option:eq(2)").replaceWith("<option value='3'>Somebananas</option>");
 

8. 지정된 index값으로 select 하기

$("#selectBox option:eq(2)").attr("selected", "selected");


9. text 값으로 select 하기

$("#selectBox").val("Someoranges").attr("selected", "selected");

  방법1)
  $("#selectBox option").filter(function() {return this.text == 'searchText';}).prop('selected', 'selected');

  방법2)
  $('#selectBox > option').each(function() {
      if($(this).text() == 'searchText') {
         $(this).prop('selected', 'selected');
      }
  });

  방법3) 
  $("#selectBox option:contains('searchText')").prop('selected', 'selected');


10. value값으로 select 하기

$("#selectBox").val("2");
 

11. 지정된 인덱스값의 item 삭제

$("#selectBox option:eq(0)").remove();


12. 첫번째 item 삭제

$("#selectBox option:first").remove();


13. 마지막 item 삭제

$("#selectBox option:last").remove();
 

14. 선택된 옵션의 text 구하기

alert(!$("#selectBox option:selected").text());


15. 선택된 옵션의 value 구하기

alert(!$("#selectBox option:selected").val());


16. 선택된 옵션 index 구하기

alert(!$("#selectBox option").index($("#selectBox option:selected")));


17. SelecBox 아이템 갯수 구하기

alert(!$("#selectBox option").size());


18. 선택된 옵션 앞의 아이템 갯수

alert(!$("#selectBox option:selected").prevAl!l().size());


19. 선택된 옵션 후의 아이템 갯수

alert(!$("#selectBox option:selected").nextAll().size());
 

20. Insert an item in after a particular position

$("#selectBox option:eq(0)").after("<option value='4'>Somepears</option>");
 

21. Insert an item in before a particular position

$("#selectBox option:eq(3)").before("<option value='5'>Someapricots</option>");
 

22. Getting values when item is selected

$("#selectBox").change(function(){
           alert(!$(this).val());
           alert(!$(this).children("option:selected").text());
});

출처2 : http://egloos.zum.com/tiger5net/v/5667935

반응형

'JavaScript' 카테고리의 다른 글

CheckBox Jquery 컨트롤  (0) 2022.08.09
[Javascript] check시 사용,사용불가  (0) 2018.09.06
insertAdjacentHTML() 이벤트 리스너  (0) 2018.09.04
선입선출 스케쥴링  (1) 2017.11.06

+ Recent posts