구현 환경  : AWS(ubuntu 20.04) , nodejs

 

출처 : 

[GitLab CI] docker gitlab-runner 등록 및 간단 예제 (tistory.com)

https://www.devopsschool.com/blog/setup-docker-service-to-use-insecurehttp-registry-instead-of-https/

https://hihellloitland.tistory.com/65

https://hihellloitland.tistory.com/63

https://otrodevym.tistory.com/474

https://not-to-be-reset.tistory.com/326

https://gitlab.com/gitlab-org/gitlab-runner/-/issues/5026

 

-  Docker  private registry 설치

우분투 초기 이미지 업데이트 레포 찾음 
apt update

도커 컴포저 설치 
apt install docker-compose

도커 레지스트리 설치 
docker pull registry:latest


레지스트리 이미지 구동
docker run --name local-registry -d --restart=always -p 5000:5000 -v /data/registry:/var/lib/registry/docker/registry/v2 registry:latest





빨간색 처럼 private repo 컨테이너 올라가면  실패 재설치

아래 그림처럼 올라가면 성공

 

 

본인이 구축할 private repo IP주소를 작성하면 됩니다.

push시 https만 허용만 가능하여 이렇게 강제로 설정해 줍니다.

 

vi /etc/docker/daemon.json

{

"insecure-registries" : ["13.125.27.25:5000"]

}

 

도커 재 실행 

service docker restart

 

- 방화벽 오픈 (5000, 8900번)

윈도우 도스창에서
telnet  xxx.xxx.xxx.xxx 5000
제대로 접근 가능한지 확인

##############################################################################

-  Gitlab runnuer 설치

 

mkdir -p /opt/gopath/src/gitlab/

cd /opt/gopath/src/gitlab/

vi docker-compose.gitlab.runner.yml 파일 생성

gitlab-runner:
 container_name: gitlab-runner
 image: 'gitlab/gitlab-runner:latest'
 restart: always
 volumes:
  - '/srv/gitlab-runner/config:/etc/gitlab-runner'
  - '/var/run/docker.sock:/var/run/docker.sock'
  - '/usr/bin/docker:/usr/bin/docker'

 

도커 compose파일 실행 

도커 컴포저 실행

docker-compose -f /opt/gopath/src/gitlab/docker-compose.gitlab.runner.yml up -d

컨테이너 실행 확인 
docker container ls

 

gitlab  새로운 project에 파일 3개 생성

Dockerfile

# This file is a template, and might need editing before it works on your project.
FROM node:10

WORKDIR /usr/src/app

ARG NODE_ENV
ENV NODE_ENV $NODE_ENV

COPY package.json /usr/src/app/
RUN yarn install

COPY . /usr/src/app

# replace this with your application's default port
EXPOSE 3000
CMD [ "yarn", "start" ]

리엑트 프로젝트 샘플

 

package.json

{
  "name": "deployReact",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "0.18.1",
    "enzyme": "^3.8.0",
    "enzyme-adapter-react-16.3": "^1.4.1",
    "moment": "^2.24.0",
    "next": "^8.1.0",
    "node-build-tools": "^0.3.2",
    "node-gyp": "^3.8.0",
    "python2": "^0.0.1",
    "react": "^16.7.0",
    "react-dom": "^16.7.0",
    "react-redux": "^6.0.0",
    "react-router-dom": "^5.0.0",
    "react-scripts": "2.1.7",
    "react-test-renderer": "^16.7.0",
    "react-with-styles": "^3.2.1",
    "recompose": "^0.30.0",
    "redux": "^4.0.1",
    "redux-pack": "^0.1.5",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0",
    "selector-action": "^1.1.1",
    "web-vitals": "^2.1.2"
  },
  "scripts": {
    "dev": "next",
    "predeploy": "yarn build-all",
    "deploy": "firebase deploy",
    "build-all": "yarn ssrbuild && yarn build-firebase",
    "build-firebase": "cd \"./functions\" && yarn --ignore-engines",
    "ssrbuild": "next build",
    "storybook": "start-storybook -p 9001 -c .storybook",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "mockserver": "json-server --watch --delay 500 --port 4000 mock/create.js",
    "errorserver": "node mock/fake.js",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
 },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "@babel/core": "7.5.5",
    "@babel/plugin-syntax-object-rest-spread": "^7.2.0",
    "@storybook/addon-actions": "^5.2.6",
    "@storybook/addons": "^5.2.6",
    "@storybook/react": "^5.2.6",
    "aphrodite": "^2.2.3",
    "babel-loader": "^8.0.5",
    "json-server": "^0.14.2",
    "node-sass": "^4.12.0",
    "react-with-styles-interface-aphrodite": "^5.0.1",
    "redux-devtools-extension": "^2.13.8",
    "sass-loader": "^7.1.0",
    "storybook-addon-jsx": "^7.1.13"
  }
}

토큰값 확인 

신용카드 auth도 진행하는데 해외결제 그낭 카드번호만 넣으면 완료

 

 

gitlab-runner 컨테이너에서 등록

아래 보라색 두값만 위 2번에 맞게 쓰시면 되고 Docker 컨테이너 내부 에서 유일하게 진행하는 작업.

그외는 모두 Docker 밖에서 실행

도커 gitlab-runner 컨테이너 실행
docker container exec -it gitlab-runner bash


root@4abec937906f:/# gitlab-runner register -n \
--url https://gitlab.com/ \
--registration-token M9토큰값 \
--description gitlab-runner \
--executor docker \
--docker-image docker:latest \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock

 

Edit를 클릭하여 Tags에  [gitlab-cicd-tag] 작성

 

위에 설정한 tag는 아래 yml파일에서도 사용

리엑트 프로젝트는 포트 3000으로 실행

.gitlab-ci.yml

stages:
  - test
  - build
  - deploy

variables:
  IMAGE_NAME: 13.125.27.25:5000/nodejs-server-test:latest

cache:
  paths:
    - node_modules/
    
test:
  stage: test
  image: node:10
  script:
    - env
    - yarn


build:
  stage: package
  tags:
    - gitlab-cicd-tag
  image: docker:latest
  services:
    - docker:dind
  stage: build
  script:
    - ls -al
    - docker container ls -a
    - docker build . -t $IMAGE_NAME
    - docker push $IMAGE_NAME
    - docker images | grep '13.125.27.25'

deploy:
  stage: deploy
  tags:
    - gitlab-cicd-tag
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker container ls -a
    - docker container rm -f nodejs-server 
    - docker run -d -p 3000:3000 --name nodejs-server --restart always $IMAGE_NAME
    - docker container ls -a

 



 

 

 

 

gitlab 해당 프로젝트에 파일이 push뒤면 ci pipe라인에서 자동으로 실행 됩니다.

서버 사양은 꽤나 높으면 빠를거 같습니다.

'시스템' 카테고리의 다른 글

AWS Amplify 설치  (0) 2021.12.28
ipfs 사용법  (0) 2021.12.06
gitlab CI_SERVER_TLS_CA_FILE: Permission denied  (0) 2021.08.30
gitlab ci Docker 연동(nodejs)  (2) 2021.08.23
Configuring tzdata Dockerfile  (0) 2021.07.27
블로그 이미지

iesay

,
# groups gitlab-runner
gitlab-runner : gitlab-runner



# usermod -a -G root gitlab-runner



# groups gitlab-runner
gitlab-runner : gitlab-runner root

 

'시스템' 카테고리의 다른 글

ipfs 사용법  (0) 2021.12.06
gitlab ci Docker 연동(React)  (0) 2021.11.24
gitlab ci Docker 연동(nodejs)  (2) 2021.08.23
Configuring tzdata Dockerfile  (0) 2021.07.27
방화벽 설정  (0) 2020.10.26
블로그 이미지

iesay

,

구현 환경  : AWS(ubuntu 20.04) , nodejs

 

출처 : 

[GitLab CI] docker gitlab-runner 등록 및 간단 예제 (tistory.com)

https://www.devopsschool.com/blog/setup-docker-service-to-use-insecurehttp-registry-instead-of-https/

https://hihellloitland.tistory.com/65

https://hihellloitland.tistory.com/63

https://otrodevym.tistory.com/474

https://not-to-be-reset.tistory.com/326

https://gitlab.com/gitlab-org/gitlab-runner/-/issues/5026

 

-  Docker  private registry 설치

우분투 초기 이미지 업데이트 레포 찾음 
apt update

도커 컴포저 설치 
apt install docker-compose

도커 레지스트리 설치 
docker pull registry:latest


레지스트리 이미지 구동
docker run --name local-registry -d --restart=always -p 5000:5000 -v /data/registry:/var/lib/registry/docker/registry/v2 registry:latest





빨간색 처럼 private repo 컨테이너 올라가면  실패 재설치

아래 그림처럼 올라가면 성공

 

 

본인이 구축할 private repo IP주소를 작성하면 됩니다.

push시 https만 허용만 가능하여 이렇게 강제로 설정해 줍니다.

 

vi /etc/docker/daemon.json

{

"insecure-registries" : ["13.125.27.25:5000"]

}

 

도커 재 실행 

service docker restart

 

- 방화벽 오픈 (5000, 8900번)

윈도우 도스창에서
telnet  xxx.xxx.xxx.xxx 5000
제대로 접근 가능한지 확인

##############################################################################

-  Gitlab runnuer 설치

 

mkdir -p /opt/gopath/src/gitlab/

cd /opt/gopath/src/gitlab/

vi docker-compose.gitlab.runner.yml 파일 생성

gitlab-runner:
 container_name: gitlab-runner
 image: 'gitlab/gitlab-runner:latest'
 restart: always
 volumes:
  - '/srv/gitlab-runner/config:/etc/gitlab-runner'
  - '/var/run/docker.sock:/var/run/docker.sock'
  - '/usr/bin/docker:/usr/bin/docker'

 

도커 compose파일 실행 

도커 컴포저 실행

docker-compose -f /opt/gopath/src/gitlab/docker-compose.gitlab.runner.yml up -d

컨테이너 실행 확인 
docker container ls

 

gitlab  새로운 project에 파일 3개 생성

Dockerfile

# This file is a template, and might need editing before it works on your project.
FROM node

WORKDIR /usr/src/app

ARG NODE_ENV
ENV NODE_ENV $NODE_ENV

COPY package.json /usr/src/app/
RUN npm install

COPY . /usr/src/app

# replace this with your application's default port
EXPOSE 8900
CMD [ "npm", "start" ]

 

 

index.js

const express = require('express')
const app = express()

app.get('/', function(req, res) {
    res.send('Hello Gitlab!!!!!!안녕하세요!!!!!!!')
})

app.listen(8900, function() {
    console.log('Example app listening on port 8900!')
})
 

 

package.json

{
  "name": "sample",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "start": "node index.js"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}

 

 

토큰값 확인 

신용카드 auth도 진행하는데 해외결제 그낭 카드번호만 넣으면 완료

 

 

gitlab-runner 컨테이너에서 등록

아래 보라색 두값만 위 2번에 맞게 쓰시면 되고 Docker 컨테이너 내부 에서 유일하게 진행하는 작업.

그외는 모두 Docker 밖에서 실행

도커 gitlab-runner 컨테이너 실행
docker container exec -it gitlab-runner bash


root@4abec937906f:/# gitlab-runner register -n \
--url https://gitlab.com/ \
--registration-token M9토큰값 \
--description gitlab-runner \
--executor docker \
--docker-image docker:latest \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock

 

Edit를 클릭하여 Tags에  [gitlab-cicd-tag] 작성

 

위에 설정한 tag는 아래 yml파일에서도 사용

 

.gitlab-ci.yml

stages:
  - test
  - build
  - deploy

variables:
  IMAGE_NAME: 13.125.27.25:5000/nodejs-server-test:latest

cache:
  paths:
    - node_modules/
    
test:
  stage: test
  image: node:latest
  script:
    - env
    - npm install

build:
  stage: package
  tags:
    - gitlab-cicd-tag
  image: docker:latest
  services:
    - docker:dind
  stage: build
  script:
    - ls -al
    - docker container ls -a
    - docker build . -t $IMAGE_NAME
    - docker push $IMAGE_NAME
    - docker images | grep '13.125.27.25'

deploy:
  stage: deploy
  tags:
    - gitlab-cicd-tag
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker container ls -a
    - docker container rm -f nodejs-server 
    - docker run -d -p 8900:8900 --name nodejs-server --restart always $IMAGE_NAME
    - docker container ls -a



 

 

 

 

 

gitlab 해당 프로젝트에 파일이 push뒤면 ci pipe라인에서 자동으로 실행 됩니다.

서버 사양은 꽤나 높으면 빠를거 같습니다.

'시스템' 카테고리의 다른 글

gitlab ci Docker 연동(React)  (0) 2021.11.24
gitlab CI_SERVER_TLS_CA_FILE: Permission denied  (0) 2021.08.30
Configuring tzdata Dockerfile  (0) 2021.07.27
방화벽 설정  (0) 2020.10.26
우분투 No space left on device  (0) 2020.06.26
블로그 이미지

iesay

,

환경 : 버추얼박스 , 우분투 20

Dockerfile에 apt updates 위줄에 옵션 추가 

#Avoiding user interaction with tzdata
ENV DEBIAN_FRONTEND=noninteractive

 

'시스템' 카테고리의 다른 글

gitlab CI_SERVER_TLS_CA_FILE: Permission denied  (0) 2021.08.30
gitlab ci Docker 연동(nodejs)  (2) 2021.08.23
방화벽 설정  (0) 2020.10.26
우분투 No space left on device  (0) 2020.06.26
gitlab 설치  (0) 2020.04.07
블로그 이미지

iesay

,

방화벽 설정

시스템 2020. 10. 26. 11:08

ports: 3306/tcp 22/tcp 8080/tcp 443/tcp 8443/tcp 444/tcp
firewall-cmd --list-all

firewall-cmd --reload


firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=443/tcp 

 

'시스템' 카테고리의 다른 글

gitlab ci Docker 연동(nodejs)  (2) 2021.08.23
Configuring tzdata Dockerfile  (0) 2021.07.27
우분투 No space left on device  (0) 2020.06.26
gitlab 설치  (0) 2020.04.07
vscode , 버추얼박스  (0) 2019.11.05
블로그 이미지

iesay

,

출처 : https://askubuntu.com/questions/1106795/ubuntu-server-18-04-lvm-out-of-space-with-improper-default-partitioning

 

우분투 No space left on device

당황하지 말고 LVM에서 / 파티션을 재설정하도록 실행한다.

 

# We need to resize the logical volume to use all the existing and free space of the volume group
$ lvm
lvm
> lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
lvm
> exit

# And then, we need to resize the file system to use the new available space in the logical volume
$ resize2fs
/dev/ubuntu-vg/ubuntu-lv
resize2fs
1.44.1 (24-Mar-2018)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks
= 1, new_desc_blocks = 58
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 120784896 (4k) blocks long.

# Finally, you can check that you now have available space:
$ df
-h
Filesystem                         Size  Used Avail Use% Mounted on
udev                              
3.9G     0  3.9G   0% /dev
tmpfs                             
786M  1.2M  785M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  454G  3.8G  432G   1% /

'시스템' 카테고리의 다른 글

Configuring tzdata Dockerfile  (0) 2021.07.27
방화벽 설정  (0) 2020.10.26
gitlab 설치  (0) 2020.04.07
vscode , 버추얼박스  (0) 2019.11.05
버추얼박스 VT-x is not available 오류  (1) 2019.07.18
블로그 이미지

iesay

,

gitlab 설치

시스템 2020. 4. 7. 14:25

환경 : 우분투 18.04 server

apt-get update
apt-get install -y curl openssh-server ca-certificates

apt-get install -y postfix
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
EXTERNAL_URL="http://gitlab.example.com" apt-get install gitlab-ee

http://내부ip주소/

gitlab-ctl reconfigure
gitlab-ctl start

gitlab-ctl stop

깃랩 설치 완료

초기 패스워드 설정

root // 초기설정한 패스워드 입력

 

스페너 클릭

 

 

 

 

 

 

 

 

 

신규 아이디 메일주소로 발급

그런 뒤 프로젝트 생성 운용

 

 

 

 

 

 

'시스템' 카테고리의 다른 글

방화벽 설정  (0) 2020.10.26
우분투 No space left on device  (0) 2020.06.26
vscode , 버추얼박스  (0) 2019.11.05
버추얼박스 VT-x is not available 오류  (1) 2019.07.18
시놀리지 나스 synology nas(redmine plugin)설치  (2) 2019.04.29
블로그 이미지

iesay

,

vscode , 버추얼박스

시스템 2019. 11. 5. 11:08

출처 : https://noooop.tistory.com/entry/VS-Code-Remote-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-SSH-%EB%B0%A9%EC%8B%9D

 

버추얼박스로 우분투19 자원은

cpu core개 램은 6기가 정도가 적당하다.

 

Root 계정이 접속 가능하도록 우분투 세팅을 바꾼다.

그래서 Putty든  vscode든 다 root로 접속하는게 작업 하기 편하다.

 

cd /etc/ssh

vi sshd_config

 

# Authentication:

LoginGraceTime 2m
PermitRootLogin yes
StrictModes yes

 

service ssh restart

 

config설정 완료하면 나중에 패스워드 입력 하라는 창이뜬다

입력하면 완료.

 

 

 

'시스템' 카테고리의 다른 글

우분투 No space left on device  (0) 2020.06.26
gitlab 설치  (0) 2020.04.07
버추얼박스 VT-x is not available 오류  (1) 2019.07.18
시놀리지 나스 synology nas(redmine plugin)설치  (2) 2019.04.29
pm2  (0) 2019.03.28
블로그 이미지

iesay

,

 

 

도커와 버추얼박스를 병행해서 쓰다보면 Hyper-V 충돌이 자주 발생된다.

 

Microsoft Windows [Version 10.0.18362.239]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>
C:\WINDOWS\system32>
C:\WINDOWS\system32>dism.exe /Online /Disable-Feature:Microsoft-Hyper-V

배포 이미지 서비스 및 관리 도구
버전: 10.0.18362.1

이미지 버전: 10.0.18362.239

기능을 사용하지 않도록 설정하는 중
[==========================100.0%==========================]
작업을 완료했습니다.

C:\WINDOWS\system32>bcdedit /set hypervisorlaunchtype off
작업을 완료했습니다.

C:\WINDOWS\system32> 

관리자 모드로 cmd 실행한 후 위 명령어를 치고 재부팅 한뒤

 

버추얼 박스를 실행하면 된다.

 

여담으로 윈도우 도커를 사용중 블루스크린이 자주 뜬다면

윈도우 10 버전을 1903으로 업데이트 하기 바란다.

 

 

1803버그가 도커와 충돌이 자주 발생 된다.

'시스템' 카테고리의 다른 글

gitlab 설치  (0) 2020.04.07
vscode , 버추얼박스  (0) 2019.11.05
시놀리지 나스 synology nas(redmine plugin)설치  (2) 2019.04.29
pm2  (0) 2019.03.28
nodejs - form submit  (0) 2019.01.22
블로그 이미지

iesay

,

시놀리지 NAS 구매한 사람은 시놀리지 쓰고

해놀리지라도 쓰고 싶은분은 빈 PC에 해놀리지 구축 하면 된다.

https://blog.djjproject.com/202

 

 

설치가 다 끝나면 아래와 같은 모습을 볼수 있다.

http://192.168.0.146:5000/

admin // 패스워드

 

 

putty로 ROOT권한을 받을러면

admin // 패스워드

sudo su -

admin패스워드와 동일하게 입력한다.

 

 

 

1] ckeditor 설치

https://github.com/a-ono/redmine_ckeditor

 

레드마인은 시놀리지에서 패키지에서 설치하면 된다.

http://192.168.0.146:30002/  접속이 가능하다 초기 패스워드는 admin // admin 이다.

 

 

버전에 맞는걸 설치하고

 

 

데스크탑에서 경로

/home/redmine/data/plugins

 

 

레드마인 플러그인이 설치될 경로

/home/redmine/redmine/plugins

아래 경로에 git clone에서 받아도 된다.

 

cd .. 한단계 위로 와서

 

bundle install --without development test


rake redmine:plugins:migrate RAILS_ENV=production

두개의 명령어를 설치 해주고

 

레드마인을 재실행 하면 된다.

 

가끔 nginx 에러라고 보는데 브라우저 쿠키를 삭제하고 재시작 하면 된다.

 

 

 


클립보드 이미지를 곧바로 첨부하기                                      
https://github.com/peclik/clipboard_image_paste
git clone https://github.com/peclik/clipboard_image_paste.gitplugins/clipboard_image_paste

애자일 : http://www.redmine.org/plugins/redmine_agile   

체크리스트 : http://www.redmine.org/plugins/redmine_checklists     O

ckeditor https://github.com/a-ono/redmine_ckeditor/releases/tag/1.1.7

일감 닫기 버튼 : http://www.redmine.org/plugins/redmine_close_button

 

문서 화면 심플하게 표시 : http://www.redmine.org/plugins/redmine_documents_short

 

관리 로그                                                              
https://github.com/haru/redmine_logs

 

모든 설치시 저 위에 명령어 두개를 치고

레드마인 restart 하면 된다.

 

 mv redmine_checklists-3_1_15-l ight.zip ../../redmine/plugins/
 

 

 

 

'시스템' 카테고리의 다른 글

vscode , 버추얼박스  (0) 2019.11.05
버추얼박스 VT-x is not available 오류  (1) 2019.07.18
pm2  (0) 2019.03.28
nodejs - form submit  (0) 2019.01.22
nodejs + mariadb 연동  (0) 2019.01.14
블로그 이미지

iesay

,