Stage 서버 deploy 파일 추가

This commit is contained in:
2026-07-06 22:16:28 +09:00
parent 1ea9e64667
commit e17b1f0f1f
4 changed files with 62 additions and 0 deletions
+174
View File
@@ -0,0 +1,174 @@
# 서버 접속
ssh root@106.10.53.153
# 암호 변경
passwd
# 사용자 추가, 암호 변경
adduser jisangs
passwd jisangs
# root ssh 로그인 막기
vi /etc/ssh/sshd_config
...
PermitRootLogin no
...
...
#1 Apache, mariadb, php7.1 설치
https://www.if-not-true-then-false.com/2010/install-apache-php-on-fedora-centos-red-hat-rhel/
# MariaDB 설치 확인
https://www.dazzii.com/centos7-apache-mariadb-php-webserver/
systemctl start mysql
mysql --version
# MariaDB 설정
http://oerun.tistory.com/2
vi /etc/my.cnf
----------------------------------------
[client]
default-character-set = utf8
[mysqld]
character-set-client-handshake = FALSE
init_connect = "SET collation_connection = utf8_general_ci"
init_connect = "SET NAMES utf8"
character-set-server = utf8
collation-server = utf8_general_ci
[mysqldump]
default-character-set = utf8
[mysql]
default-character-set = utf8
----------------------------------------
# php용 remi repository 추가만
https://blog.asamaru.net/2018/02/14/install-php-7-2-on-centos-with-remi-rpm-repository/
# php 설치후 /etc/httpd/conf/httpd.conf 수정
LoadModule php7_module modules/libphp7.so
DirectoryIndex index.html index.html.var index.php index.php3
AddType application/x-httpd-php .php .html .htm .inc
AddType application/x-httpd-php-source .phps
# phpMyAdmin 설치
http://luckyyowu.tistory.com/287
yum install -y phpMyAdmin
vi /etc/httpd/conf.d/phpMyAdmin.conf
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
Order Allow,Deny
Allow from All
</Directory>
vi /etc/httpd/conf/httpd.conf
<Directory />
AllowOverride none
Require all granted
</Directory>
# git 설치 및 설정
http://morningame.tistory.com/27
scp id_rsa.pub jisangs@106.10.45.240:/home/jisangs/
scp id_rsa.pub git@106.10.45.240:/home/git/
--- 위까지 해서 성공 ---
# (취소) php-fpm 설치
https://blog.bypass.sh/280
yum install -y epel-release
rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum --enablerepo=remi update remi-release
yum --enablerepo=remi-php70 install -y php php-fpm php-mysql
# php7.2 설치
https://blog.asamaru.net/2018/02/14/install-php-7-2-on-centos-with-remi-rpm-repository/
# phpinfo.php
<?php phpinfo(); ?>
#2 php 설치 확인
yum list installed | cut -d " " -f 1 | grep php
php -v
# php7.2 설치
http://ellordnet.tistory.com/166
git 설치
yum install git
git 세팅
adduser git
passwd git
mkdir /git_repository
chown git:git /git_repository
mkdir /git_repository/mouse_typing.git
chown git:git /git_repository/mouse_typing.git
vi /git_reposotory/mouse_typing.git/hooks/post-receive
#!/bin/sh
# GIT_WORK_TREE=/var/www/html/mouse_typing git checkout -f
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
echo 'Changes pushed live.'
fi
if [ "release" == "$branch" ]; then
git --work-tree=/volume1/docker/chocomae/html/mouse_typing/ checkout -f $branch
cp /volume1/docker/chocomae/html/mouse_typing/src/web/server/setup/NA_service_db_setting.php /volume1/docker/chocomae/html/mouse_typing/src/web/server/setup/service_db_setting.php
sed -i 's/localhost/mysql/g' /volume1/docker/chocomae/html/mouse_typing/src/web/server/setup/service_db_setting.php
echo 'Changes pushed to dev.'
fi
done
(root) mkdir /var/www/html/mouse_typing
(root) chown git:git /var/www/html/mouse_typing
----
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
php설치
yum install -y php70w
자주쓰는 관련 PHP 설치
yum install -y php70w-mysql php70w-pdo php70w-pgsql php70w-odbc php70w-mbstring php70w-mcrypt php70w-gd
yum install -y php70w-pear php70w-pdo_dblib php70w-pecl-imagick php70w-pecl-imagick-devel php70w-xml php70w-xmlrpc
php 설치가능패키지확인
yum search php70w
+21
View File
@@ -0,0 +1,21 @@
FROM php:7.3-apache
RUN apt-get update && apt-get install -y libonig-dev \
&& docker-php-ext-install mysqli mbstring \
&& rm -rf /var/lib/apt/lists/*
RUN a2enmod rewrite
RUN { \
echo '<Directory /var/www/html>'; \
echo ' AllowOverride All'; \
echo '</Directory>'; \
echo ''; \
echo '<FilesMatch "\.(php|html|htm|inc)$">'; \
echo ' SetHandler application/x-httpd-php'; \
echo '</FilesMatch>'; \
} > /etc/apache2/conf-available/chocomae.conf \
&& a2enconf chocomae
ENV TZ=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
BASE_DIR=/volume1/docker/service/jisangs/stage-chocomae
CHOCOMAE_DIR=$BASE_DIR/chocomae
echo "=== [1/3] git pull ==="
git -C $CHOCOMAE_DIR pull
if [ $? -ne 0 ]; then
echo "git pull 실패. 배포 중단."
exit 1
fi
echo "=== [2/3] service_db_setting.php 복사 ==="
cp $BASE_DIR/service_db_setting.php $CHOCOMAE_DIR/src/web/server/setup/service_db_setting.php
if [ $? -ne 0 ]; then
echo "service_db_setting.php 복사 실패. 배포 중단."
exit 1
fi
echo "=== [3/3] docker compose up ==="
docker compose -f $BASE_DIR/docker-compose.yml up -d
echo "=== 배포 완료 ==="
+18
View File
@@ -0,0 +1,18 @@
version: '3'
services:
stage-chocomae:
build: .
container_name: stage-chocomae
hostname: stage-chocomae
volumes:
- ./chocomae:/var/www/html/mouse_typing
environment:
- TZ=Asia/Seoul
networks:
- proxy-network
restart: unless-stopped
networks:
proxy-network:
external: true