Skip to content

Commit

Permalink
chore: 테스트 서버 mysql 설치 스크립트 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
5uhwann committed Jul 9, 2024
1 parent 6d285d0 commit eea89b9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .ebextensions/01-install-test-mysql.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: ENV_TYPE
value: test

commands:
01_check_env:
command: |
if [ "$ENV_TYPE" = "test" ]; then
echo "This is a test environment. Proceeding with MySQL installation."
else
echo "This is not a test environment. Skipping MySQL installation."
exit 0
fi
02_install_mysql:
test: '[ "$ENV_TYPE" = "test" ]'
command: |
yum install -y mysql-server mysql
03_start_mysql:
test: '[ "$ENV_TYPE" = "test" ]'
command: "service mysqld start"
04_create_database:
test: '[ "$ENV_TYPE" = "test" ]'
command: "mysql -e 'CREATE DATABASE IF NOT EXISTS ddingdong_test;'"
05_create_user:
test: '[ "$ENV_TYPE" = "test" ]'
command: "mysql -e \"CREATE USER IF NOT EXISTS 'admin'@'localhost' IDENTIFIED BY 'ddingdong';\""
06_grant_privileges:
test: '[ "$ENV_TYPE" = "test" ]'
command: "mysql -e \"GRANT ALL PRIVILEGES ON myapp.* TO 'admin'@'localhost';\""
07_flush_privileges:
test: '[ "$ENV_TYPE" = "test" ]'
command: "mysql -e 'FLUSH PRIVILEGES;'"

services:
sysvinit:
mysqld:
enabled: true
ensureRunning: true
test: '[ "$ENV_TYPE" = "test" ]'

0 comments on commit eea89b9

Please sign in to comment.