Skip to content

Staging 서버 설정

Staging 서버 설정

기본적으로 Dell 서버 접근 방법을 설정한 후에 아래와 같이 접근합니다.

Terminal window
$ ssh dell

Git repository clone 및 ddev 서버 설정

Terminal window
$ project_setup
>> Welcom to the SKNKWOXS project set up spcript.
>> This script will set up a basic project structure, staging git repository, and password protection.
>> This script assumes you are cloning from Sknkwoxs Github Account.
>> Please enter the repository name.
>> It will be used for the project and htaccess username.
>> Repository Name:

Sknkwoxs Github 계정에서 repository 를 clone 합니다. 해당 repository 는 staging 서버에서 작업할 repository 입니다.

예를 들어 주소가 git@github.com:sknkwoxs/drupal.git 이라면 drupal 을 입력합니다.

Terminal window
>> Repository Name:
drupal
>> Begin setup...
간략한 저장소로('drupal.git') 복제합니다...
remote: Enumerating objects: 1705, done.
remote: Counting objects: 100% (441/441), done.
remote: Compressing objects: 100% (305/305), done.
remote: Total 1705 (delta 270), reused 269 (delta 134), pack-reused 1264
오브젝트를 받는 중: 100% (1705/1705), 6.73 MiB | 5.07 MiB/s, 완료.
델타를 알아내는 중: 100% (1055/1055), 완료.
>> Git branch:

Git branch 를 입력합니다. 기본적으로 develop 을 입력하면 됩니다. stage repository 는 develop 브랜치를 기준으로 생성됩니다.

Terminal window
>> Git branch:
develop
>> Git post receive hook is set up at ~/repos/drupal.git
>> Cloning repository...
'develop' 브랜치로 전환합니다
Exist ddev dir
Starting drupal...
Network ddev-drupal_default created
The hostname drupal.sknkwoxs.com is not currently resolvable, trying to add it to the hosts file
DDEV needs to run with administrative privileges.
You may be required to enter your password for sudo or allow escalation. DDEV is about to issue the command:
sudo --preserve-env=HOME /usr/bin/ddev hostname drupal.sknkwoxs.com 127.0.0.1
[sudo] sknk 암호:

ddev 서버 호스트 파일 설정에 관리자 권한이 필요합니다. 암호는 sknk2024! 입니다.

DB 설정

Git repository 이름이 drupal 인 경우, 웹디렉토리 경로는 /var/www/drupal 이 됩니다. 해당 디렉토리로 이동합니다.

Terminal window
cd /var/www/drupal

ddev import-db 명령어를 사용해 DB 를 복원합니다.

Terminal window
ddev import-db --src=/path/to/db.sql.gz

백업 DB 파일 경로는 해당 프로젝트 담당 개발자에게 문의합니다.

DDEV snapshot 을 사용해 복원하는 방법도 있습니다. 해당 프로젝트 담당 개발자에게 문의합니다.

Terminal window
ddev snapshot restore

Git repository 및 ddev 서버, 웹디렉토리 삭제

Terminal window
$ project_delete
>> Project name:
drupal
>> Delete Git repos...
drupal stopped /var/www/drupal wordpr
>> If exist ddev project, please stop.
>> DDEV exist? (y|n)
y
>> What is ddev project name?
drupal
Project drupal is already stopped.
Network ddev-drupal_default Removed
Project drupal has been stopped.
DDEV needs to run with administrative privileges.
You may be required to enter your password for sudo or allow escalation. DDEV is about to issue the command:
sudo --preserve-env=HOME /usr/bin/ddev hostname --remove drupal.sknkwoxs.com 127.0.0.1
DDEV needs to run with administrative privileges.
You may be required to enter your password for sudo or allow escalation. DDEV is about to issue the command:
sudo --preserve-env=HOME /usr/bin/ddev hostname --remove drupal.rnjob.ddev 127.0.0.1
Volume drupal-mariadb for project drupal was deleted
Volume drupal-postgres for project drupal was deleted
Volume drupal_project_mutagen for project drupal was deleted
Project drupal was deleted. Your code and configuration are unchanged.
>> Delete Web directory...

해당 프로젝트의 Git repository 이름을 입력합니다. 위의 경우 drupal 이 됩니다.