• redmine private 인스턴스 2개 생성

# 현재 인스턴스 Stopped 상태

 

  • bastion에서 privatekey를 통해 접속
sudo ssh -i 'sshKey이름' '유저명'@'접속할 privateIP'
sudo ssh -i ssh-key-2024-03-04.key opc@10.0.1.71

 

 

## key가 bastion 폴더에 있어야함

  • EPEL, REMI, yum-utils, php 7.3
sudo -s
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm --skip-broken
yum -y install yum-utils
yum list php
yum-config-manager --enable remi-php73
yum -y install php 
php -v
  • 정상 설치 되었다면 php -v 결과
# 정상 설치 완료 # [root@redmine-vm4 opc]# php -v 
PHP 7.3.33 (cli) (built: Aug 1 2023 13:29:47) ( NTS ) 
Copyright (c) 1997-2018 The PHP Group 
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies

 

  • Redmine 의존성 파일 설치
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick

yum -y install gcc g++ cpp gcc-c++
yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel 
yum -y install mariadb-devel 
yum -y install ImageMagick ImageMagick-devel

sudo yum install memcached libmemcached
sudo systemctl start memcached
sudo systemctl enable memcached
  • rvm 실행 전 키 받기
curl -sSL https://get.rvm.io | bash -s stable

저는 위에꺼로 안돼서 다른곳에서 찾아봐서 아래 코드로 진행했습니다.

curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
rvm pkg install openssl
rvm install 2.3.4 -C --with-openssl-dir=$HOME/.rvm/usr

# 다시 해주기
curl -sSL https://get.rvm.io | bash -s stable
curl -sSL https://get.rvm.io | bash -s stable --rails
source /usr/local/rvm/scripts/rvm
source /etc/profile.d/rvm.sh
rvm reload
rvm requirements run
rvm list known

#rvm reinstall ruby-2.7.2 --disable-dtrace


rvm install 2.7
rvm list
rvm use 2.7 --default
ruby -v
  • 루비 정상설치시
[root@redmine-vm4 ~]# ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
  • ruby-gems 설치
cd /usr/local/src 
wget https://rubygems.org/rubygems/rubygems-3.1.2.tgz 
tar xvf rubygems-3.1.2.tgz 
cd rubygems-3.1.2
  • Redmine 설치
cd /home 
wget https://www.redmine.org/releases/redmine-4.1.0.tar.gz
tar xvfz redmine-4.1.0.tar.gz
  • Redmine DB 연동 정보 수정
cd redmine-4.1.0 
cp config/configuration.yml.example config/configuration.yml 
cp config/database.yml.example config/database.yml 
vi config/database.yml

- database.yml  ## 호스트에 이전에 DB설치한 인스턴스 프라이빗 IP주소 넣기

production: 
 adapter: mysql2 
 database: redmine 
 host: 'mariaDB privateIP' 
 username: redmine 
 password: "1111" 
 encoding: utf8
vi Gemfile

gem "nokogiri", "~> 1.10.0"        ## 이부분을 아래 내용으로 변경 저장함

gem "nokogiri", "~> 1.15", ">= 1.15.3"
  • 패키지 설치
bundle install --without development test --path vendor/bundle
  •  쿠키 암호화를 위한 시크릿 토큰 생성
bundle exec rake generate_secret_token
  •  DB와 마이그레이션
RAILS_ENV=production bundle exec rake db:migrate
  • 기본언어 : 한국어로 설정
bundle exec rake redmine:load_default_data RAILS_ENV=production REDMINE_LANG=ko

 

Can't connect to local MySQL server through socket 

=> db설치 인스턴스에서 3306포트열고 restart

 

++ 테이블 없다는 에러 뜨면 

RAILS_ENV=production bundle exec rake db:migrate 

이코드 다시 실행해보기 . 마이그레이션 진행될때 자동으로 테이블 생성

 

  • Redmine 실행
firewall-cmd --permanent --add-port=3000/tcp 
systemctl restart firewalld

cd /home/redmine-4.1.0
bundle exec rails server webrick -e production -b 0.0.0.0 &
  • lb만들어서 백엔드에 redmine private IP 2개 추가

 

## 계속 지우고 새로하고 해보느라 위에꺼랑 IP가 다름 . 원래는 redmine 인스턴스 2개 private IP

 

  • lb를통해 접속

load balancer ip주소 :3000 으로 접속

## 로드밸런서를 통해 이제 서버 한대가 다운이 되어도 등록해놓은 다른 서버로 접속

'국비지원교육 > 클라우드' 카테고리의 다른 글

alertmanager 설치 후 슬랙 연동  (0) 2024.05.13
redmine에 node_exporter 설치  (0) 2024.05.13
mariaDB 설치  (0) 2024.05.13
prometheus 설치  (0) 2024.05.13
Redmine과 오픈소스 모니터링 연동  (0) 2024.05.13
복사했습니다!