【AWS】CodeDeploy를 구현했을 때의 에러와 그 해결까지
4546 단어 PHP라라벨CodeDeployAWS
소개
CodeDeploy에서 배포 자동화를 구현하려고 할 때 몇 가지 오류가 발생하여 기록으로 남습니다.
거의 범 미스 같은 느낌입니다만, 참고가 되면 다행입니다.
조건
macOS: "11.2.3 Big Sur"
php artisan -V
# > Laravel Framework 6.20.30
php -v
# > PHP 8.0.8
nginx -v
# > nginx version: nginx/1.12.2
git --version
# > git version 2.32.0
1. DownloadBundle에서 오류


The specified key does not exist.
(訳)指定されたキーは存在しません。
해결
이것은 단순히 .circleci/config.yml
디렉토리에 s3へのアップロード
의 기재를 하지 않았기 때문이었습니다.
config.yml // 省略
- run:
name: upload artifacts to s3
command: aws s3 cp lantern.zip s3://${AWS_S3_BUCKET_NAME}
// 省略
참고
2. AfterInstall에서 오류 : ①


Script does not exist at specified location
(訳)スクリプトが指定された場所に存在しません
해결
원인은, AfterInstall
이벤트로 사용되고 있던 쉘 스크립트가 반영되어 있지 않은 것이었습니다.

scripts/after_install.sh
를 추가했지만 이것이 프로덕션 환경에 반영되지 않았습니다.
그래서 프로덕션 환경에 마찬가지로 디렉토리와 파일을 작성.
# ① scriptsディレクトリ作成
$ mkdir scripts
# ② scriptsディレクトリ内に移動して、after_install.shファイルを作成
[scripts] $ touch after_install.sh
# ③ ファイルの中を編集
[scripts] $ vi after_install.sh
다음은 after_install.sh
파일의 설명 내용입니다.
after_install.sh#!/bin/bash
set -eux
cd ~/Lantern/lantern
php artisan migrate --force
php artisan config:cache
좋아, 이것으로 갈 수 있을 것이다! 생각하고 다시 배포. . .
3. AfterInstall에서 오류 : ②

Could not open input file: artisan
(訳)入力ファイルを開くことができませんでした:artisan
artisan
명령을 사용할 수 없다는 것은 지정하고 있는 디렉토리가 다른 것일까...라고 생각했으므로 확인.
방안의 정, 디렉토리를 지정하고 있는 곳이 달랐기 때문에 이하와 같이 수정.
after_install.sh- cd ~/Lantern/lantern
+ cd ~/Lantern/lantern-ssh-deploy
php artisan migrate --force
php artisan config:cache
좋아, 이것으로 갈 수 있을 것이다! !

무사히 배포 완료!
결론
다시 되돌아 보면 디렉토리의 지정 실수가 깜짝 놀랐습니다 ....
조금은 AWS와 친해진 것 같습니다.
참고
Reference
이 문제에 관하여(【AWS】CodeDeploy를 구현했을 때의 에러와 그 해결까지), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/greencha/items/06c33454693d9067ca6a
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
macOS: "11.2.3 Big Sur"
php artisan -V
# > Laravel Framework 6.20.30
php -v
# > PHP 8.0.8
nginx -v
# > nginx version: nginx/1.12.2
git --version
# > git version 2.32.0
1. DownloadBundle에서 오류


The specified key does not exist.
(訳)指定されたキーは存在しません。
해결
이것은 단순히 .circleci/config.yml
디렉토리에 s3へのアップロード
의 기재를 하지 않았기 때문이었습니다.
config.yml // 省略
- run:
name: upload artifacts to s3
command: aws s3 cp lantern.zip s3://${AWS_S3_BUCKET_NAME}
// 省略
참고
2. AfterInstall에서 오류 : ①


Script does not exist at specified location
(訳)スクリプトが指定された場所に存在しません
해결
원인은, AfterInstall
이벤트로 사용되고 있던 쉘 스크립트가 반영되어 있지 않은 것이었습니다.

scripts/after_install.sh
를 추가했지만 이것이 프로덕션 환경에 반영되지 않았습니다.
그래서 프로덕션 환경에 마찬가지로 디렉토리와 파일을 작성.
# ① scriptsディレクトリ作成
$ mkdir scripts
# ② scriptsディレクトリ内に移動して、after_install.shファイルを作成
[scripts] $ touch after_install.sh
# ③ ファイルの中を編集
[scripts] $ vi after_install.sh
다음은 after_install.sh
파일의 설명 내용입니다.
after_install.sh#!/bin/bash
set -eux
cd ~/Lantern/lantern
php artisan migrate --force
php artisan config:cache
좋아, 이것으로 갈 수 있을 것이다! 생각하고 다시 배포. . .
3. AfterInstall에서 오류 : ②

Could not open input file: artisan
(訳)入力ファイルを開くことができませんでした:artisan
artisan
명령을 사용할 수 없다는 것은 지정하고 있는 디렉토리가 다른 것일까...라고 생각했으므로 확인.
방안의 정, 디렉토리를 지정하고 있는 곳이 달랐기 때문에 이하와 같이 수정.
after_install.sh- cd ~/Lantern/lantern
+ cd ~/Lantern/lantern-ssh-deploy
php artisan migrate --force
php artisan config:cache
좋아, 이것으로 갈 수 있을 것이다! !

무사히 배포 완료!
결론
다시 되돌아 보면 디렉토리의 지정 실수가 깜짝 놀랐습니다 ....
조금은 AWS와 친해진 것 같습니다.
참고
Reference
이 문제에 관하여(【AWS】CodeDeploy를 구현했을 때의 에러와 그 해결까지), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/greencha/items/06c33454693d9067ca6a
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
The specified key does not exist.
(訳)指定されたキーは存在しません。
// 省略
- run:
name: upload artifacts to s3
command: aws s3 cp lantern.zip s3://${AWS_S3_BUCKET_NAME}
// 省略


Script does not exist at specified location
(訳)スクリプトが指定された場所に存在しません
해결
원인은,
AfterInstall
이벤트로 사용되고 있던 쉘 스크립트가 반영되어 있지 않은 것이었습니다.
scripts/after_install.sh
를 추가했지만 이것이 프로덕션 환경에 반영되지 않았습니다.그래서 프로덕션 환경에 마찬가지로 디렉토리와 파일을 작성.
# ① scriptsディレクトリ作成
$ mkdir scripts
# ② scriptsディレクトリ内に移動して、after_install.shファイルを作成
[scripts] $ touch after_install.sh
# ③ ファイルの中を編集
[scripts] $ vi after_install.sh
다음은
after_install.sh
파일의 설명 내용입니다.after_install.sh
#!/bin/bash
set -eux
cd ~/Lantern/lantern
php artisan migrate --force
php artisan config:cache
좋아, 이것으로 갈 수 있을 것이다! 생각하고 다시 배포. . .
3. AfterInstall에서 오류 : ②

Could not open input file: artisan
(訳)入力ファイルを開くことができませんでした:artisan
artisan
명령을 사용할 수 없다는 것은 지정하고 있는 디렉토리가 다른 것일까...라고 생각했으므로 확인.
방안의 정, 디렉토리를 지정하고 있는 곳이 달랐기 때문에 이하와 같이 수정.
after_install.sh- cd ~/Lantern/lantern
+ cd ~/Lantern/lantern-ssh-deploy
php artisan migrate --force
php artisan config:cache
좋아, 이것으로 갈 수 있을 것이다! !

무사히 배포 완료!
결론
다시 되돌아 보면 디렉토리의 지정 실수가 깜짝 놀랐습니다 ....
조금은 AWS와 친해진 것 같습니다.
참고
Reference
이 문제에 관하여(【AWS】CodeDeploy를 구현했을 때의 에러와 그 해결까지), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/greencha/items/06c33454693d9067ca6a
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Could not open input file: artisan
(訳)入力ファイルを開くことができませんでした:artisan
- cd ~/Lantern/lantern
+ cd ~/Lantern/lantern-ssh-deploy
php artisan migrate --force
php artisan config:cache
다시 되돌아 보면 디렉토리의 지정 실수가 깜짝 놀랐습니다 ....
조금은 AWS와 친해진 것 같습니다.
참고
Reference
이 문제에 관하여(【AWS】CodeDeploy를 구현했을 때의 에러와 그 해결까지), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/greencha/items/06c33454693d9067ca6a
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여(【AWS】CodeDeploy를 구현했을 때의 에러와 그 해결까지), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/greencha/items/06c33454693d9067ca6a텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)