Skip to content

Commit d6a6495

Browse files
committedJul 16, 2024·
Add script for running a remote shell
1 parent 48d9526 commit d6a6495

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
 

‎rel/console.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
set -euo pipefail
3+
4+
# This script connects to one of the running ECS tasks and opens an
5+
# interactive Elixir shell attached directly to the running system.
6+
#
7+
# In the shell, you can invoke Elixir functions, including the ones
8+
# defined in the application. A few examples follow.
9+
#
10+
# Importing a competition:
11+
#
12+
# user = WcaLive.Accounts.get_user(1) # Jonatan Kłosko
13+
# WcaLive.Synchronization.import_competition("WCACompetitionID2030", user)
14+
#
15+
# Synchronizing a competition:
16+
#
17+
# user = WcaLive.Accounts.get_user(1) # Jonatan Kłosko
18+
# competition = WcaLive.Competitions.get_competition(123456)
19+
# WcaLive.Synchronization.synchronize_competition(competition, user)
20+
#
21+
# Running an SQL query:
22+
#
23+
# result = WcaLive.Repo.query!("select count(*) from competitions")
24+
#
25+
# Again, keep in mind that the code executes directly within the running
26+
# application.
27+
#
28+
# Once you are finish, exit the shell by pressing Ctrl + C twice.
29+
30+
export AWS_DEFAULT_PROFILE=wca
31+
32+
task_arn="$(
33+
aws ecs list-tasks \
34+
--region us-west-2 \
35+
--cluster wca-live \
36+
--service-name wca-live-web \
37+
--query "taskArns[0]" \
38+
--output text
39+
)"
40+
41+
aws ecs execute-command \
42+
--region us-west-2 \
43+
--cluster wca-live \
44+
--task $task_arn \
45+
--container web \
46+
--command "/app/bin/wca_live remote" \
47+
--interactive

0 commit comments

Comments
 (0)