Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/actions/deploy-to-ec2/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
host:
required: true
description: SSH host
ssh-host-key:
required: true
description: SSH host public key for strict host verification
username:
required: true
description: SSH username
Expand All @@ -30,7 +33,7 @@ runs:
_REMOTE_COMMAND: ${{ inputs.remote-command }}
run: |
missing=()
for var in _SSH_PRIVATE_KEY _HOST _USERNAME _REMOTE_COMMAND; do
for var in _SSH_PRIVATE_KEY _HOST _SSH_HOST_KEY _USERNAME _REMOTE_COMMAND; do
if [ -z "${!var}" ]; then
missing+=("${var#_}")
fi
Expand All @@ -47,7 +50,7 @@ runs:
mkdir -p ~/.ssh
echo "${{ inputs.ssh-private-key }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H "${{ inputs.host }}" >> ~/.ssh/known_hosts 2>/dev/null
echo "${{ inputs.host }} ${{ inputs.ssh-host-key }}" >> ~/.ssh/known_hosts

- name: 파일 업로드
if: ${{ inputs.files != '' }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
with:
ssh-private-key: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
host: ${{ vars.EC2_HOST }}
ssh-host-key: ${{ vars.EC2_HOST_KEY }}
username: ${{ vars.EC2_USERNAME }}
files: deploy/deploy.sh deploy/secrets.env build/libs/sofia-${{ steps.version.outputs.version }}.jar
remote-command: "/app/deploy.sh '/app/sofia-${{ steps.version.outputs.version }}.jar'"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
with:
ssh-private-key: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
host: ${{ vars.EC2_HOST }}
ssh-host-key: ${{ vars.EC2_HOST_KEY }}
username: ${{ vars.EC2_USERNAME }}
files: deploy/init.sh deploy/nginx-sofia.conf deploy/cert.pem deploy/key.pem
remote-command: "bash /app/init.sh"
Expand Down
7 changes: 7 additions & 0 deletions deploy/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ install_and_configure_nginx() {
sudo systemctl enable --now nginx
}

save_host_key() {
echo "Saving host key..."
ssh-keyscan -t ed25519 localhost > /app/host_key 2>/dev/null
echo "Host key saved to /app/host_key"
}

# --- Main ---
install_jdk
install_and_configure_nginx
save_host_key
echo "Done."
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.console=plain
org.gradle.logging.level=quiet
org.gradle.warning.mode=summary
ywcheong.sofia.version=26b.04.01.2
ywcheong.sofia.version=26b.04.01.3
ywcheong.sofia.jdk_version=21
Loading