Skip to content

Commit

Permalink
Merge pull request #871 from isucon/feature-add-hosts-script-and-task…
Browse files Browse the repository at this point in the history
…-update

Add script to update /etc/hosts and modify bundle install command
  • Loading branch information
catatsuy authored Sep 29, 2024
2 parents 3c90c77 + 5d63a49 commit a5c9350
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
24 changes: 24 additions & 0 deletions provisioning/roles/bootstrap/files/home/isucon/add_hosts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Error: IP address not provided."
echo "Usage: $0 <IP_ADDRESS>"
exit 1
fi

ip_address=$1

domains=(
"bp.t.isucon.pw"
"bs.t.isucon.pw"
"payment.t.isucon.pw"
"shipment.t.isucon.pw"
)

{
echo ""
echo "# The following entries were added automatically by a script."
for domain in "${domains[@]}"; do
echo "${ip_address} ${domain}"
done
} | sudo tee -a /etc/hosts >/dev/null
8 changes: 8 additions & 0 deletions provisioning/roles/bootstrap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,11 @@
owner: isucon
group: isucon
mode: 0755

- name: Copy add_hosts.sh
copy:
src: home/isucon/add_hosts.sh
dest: /home/isucon/add_hosts.sh
owner: isucon
group: isucon
mode: 0755
4 changes: 3 additions & 1 deletion provisioning/roles/webapp.ruby/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
args:
chdir: /home/isucon/isucari/webapp/ruby
shell: |
bash -lc "bundle install --path=.bundle"
bash -lc "bundle install"
environment:
PATH: "/home/isucon/local/ruby/bin:{{ ansible_env.PATH }}"

- name: Copy isucari.ruby unit file
copy:
Expand Down

0 comments on commit a5c9350

Please sign in to comment.