참고노션 : https://dramatic-armchair-97f.notion.site/e85a109829c94c9ea5c841ca8e852ac5
https://docs.docker.com/engine/install/ubuntu/
sudo vim /etc/sysconfig/jenkins
에서 포트 변경 가능sudo docker run --name jenkins -d -p 8081:8080 -p 50000:50000 jenkins/jenkins:lts
http://[IP]:8081
sudo docker logs jenkins
를 입력해서 찾을 수 있음Gitlab
, Publish Over SSH
, Mattermost Notification
, docker
, node.js
설치Name : zzalu_deploy_server_test
Hostname : [EC2 domain]
Username : ubuntu
Remote Directory : /home/ubuntu/jenkins_build
jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [zzalu_deploy_server_test]. Message [java.net.UnknownHostException: http://###/]]
mkdir ~/jenkins_build
sudo vim /etc/ssh/sshd_config
PubkeyAuthentication yes
PubkeyAcceptedKeyTypes +ssh-rsa
sudo service sshd restart
sudo apt-get install openjdk-11-jdk
sudo docker exec -it -u root jenkins /bin/bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 14
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; cp -r $n/{bin,lib,share} /usr/local
sudo apt-get install openjdk-11-jdk
node {
stage('Build') {
checkout scmGit(~)
dir("front") {
sh "pwd"
sh "npm install"
sh "npm run build"
}
}
}
sudo npm install -g --unsafe-perm=true --allow-root
명령어 실행apt-get update
apt-get install sudo
apt-get install vim
sudo visudo
명령어로 설정파일 열기jenkins ALL=(ALL) NOPASSWD: ALL
추가docker run --name maria-db -d -p 3306:3306 --restart=always -e MYSQL_ROOT_PASSWORD=password mariadb
docker exec -it maria-db mysql -u root -p
create database IF NOT EXISTS `ssafy_sns`;
// redis 이미지 불러오기
docker pull redis
// 불러온 이미지를 통해 redis docker 서버 실행
docker run --name myredis -d -p 6379:6379 redis
// redis 연결 확인
docker run -it --link myredis:redis --rm redis redis-cli -h redis -p 6379
Git clone
클론한 폴더에서 docker-compose.yml 파일 수정
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper
container_name: zookeeper
ports:
- "2181:2181"
restart: unless-stopped
kafka:
build: .
image: wurstmeister/kafka
container_name: kafka
ports:
- "9092:9092"
environment:
DOCKER_API_VERSION: 1.22
KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_MESSAGE_MAX_BYTES: 10000000
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_DELETE_TOPIC_ENABLE: 'true'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
해당 폴더에서 터미널 실행
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
source ~/.bashrc