You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docker가 sudo로 실행되어서 jenkins가 github에 등록한 키 인식을 못하는 문제
⇒ jenkins를 설치한 주체가 root가 아니라 alpha_technic이어야 한다.
⇒ jenkins를 도커 container가 아닌 hostPC에 직접 설치하는 방향으로 해결
이따금씩 서버가 다운되고 다시 뜨고 하는데, 그렇게 되면 컨테이너가 죽게될 지도 모름.
⇒ 도커스웜의 오토힐링에 의존하기 보다, GCP를 믿자.
⇒ 리눅스 서비스에 등록을 한다. (jenkins.service 파일 생성)
계정이 alpha.technic이면 parsing에 문제가 있는 경우가 있기도 하다.
⇒ alpha_technic으로 바꿔서 해결
jenkins가 실행할 script에 sudo 명령 입력이 안됨..
⇒ alpha_technic 계정도 sudo 명령 없이 docker를 실행할 수 있도록 설정
⇒ /etc/sudoers를 수정한다.
Big Concept
리눅스 서비스에 등록하고자 함
why?
jenkins를 도커 컨테이너로 만들면 VM, Docker, 컨테이너 3가지가 모두 성공적으로 오토힐링 되어야 함
Github 레포 Webhooks에 jenkins 등록할 때 User 문제(docker를 sudo로 띄워서 문제)가 생김
GCP는 vpn 외부에 있고, 카카오브레인 Github는 vpn 내부에 있어서 환경 셋팅이 곤란
=> Private Github Organization
Dockerfile 있는 상황
FROM python:3.9.0
# 도커가 (혹은 portainer가) build 시 속도를 위해 caching을 해서,
# 장고에서 내용을 수정 후 다시 build할 때 마저도 cache하는 불상사가 없도록
# 아래의 명령어를 바꿔가면서 (예: testing!으로 했다가 test!!로 했다가 등등) build
RUN echo "ssddddeSting!!!"
RUN mkdir /root/.ssh/
ADD ./.ssh/id_rsa /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
WORKDIR /home/alpha.technic/
# 한국 시간으로 설정
ENV TZ=Asia/Seoul
RUN apt-get install -y tzdata
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN git clone -b dev --single-branch git@github.com:neo-wolley/wolley-deploy.git
WORKDIR /home/alpha.technic/wolley-deploy/
RUN pip install -r requirements.txt
RUN pip install gunicorn
RUN pip install mysqlclient
EXPOSE 8000
CMD ["bash", "-c", "python manage.py collectstatic --settings=myapi.settings.deploy --no-input && python manage.py migrate --settings=myapi.settings.deploy && gunicorn myapi.wsgi --env DJANGO_SETTINGS_MODULE=myapi.settings.deploy --bind 0.0.0.0:8000"]