Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Apr 13, 2024
1 parent f2100ca commit 4538a01
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

- name: Run docker-compose
run: |
docker-compose up -d
docker-compose up -d --wait
- name: Bootstrap DB
id: bootstrap_db
Expand All @@ -20,10 +20,15 @@ jobs:
account_sid=$(echo $output | grep -Po 'Account\s+SID:\s+\K\b[a-zA-Z0-9-]+\b')
auth_token=$(echo $output | grep -Po 'Auth\s+Token:\s+\K\b[a-zA-Z0-9_-]+\b')
phone_number=$(echo $output | grep -Po 'Phone\s+Number:\s+\K\b[a-zA-Z0-9-]+\b')
sms_gateway_device_token=$(echo $output | grep -Po 'SMS\s+Gateway\s+Device\s+Token:\s+\K\b[a-zA-Z0-9-]+\b')
echo "account_sid=$account_sid" >> $GITHUB_OUTPUT
echo "auth_token=$auth_token" >> $GITHUB_OUTPUT
echo "phone_number=$phone_number" >> $GITHUB_OUTPUT
echo "sms_gateway_device_token=$sms_gateway_device_token" >> $GITHUB_OUTPUT
- name: Start SMS Gateway
run: |
docker-compose run -T -d --wait sms-gateway somleng-sms-gateway -v -k "${{ steps.bootstrap_db.outputs.sms_gateway_device_token }}" -d ws://ws:8080 dummy
- name: Test an outbound call
run: |
Expand All @@ -35,6 +40,15 @@ jobs:
--data-urlencode "To=+299221234" \
--data-urlencode "From=${{ steps.bootstrap_db.outputs.phone_number }}"
- name: Test an outbound SMS
run: |
curl --fail -s -X "POST" "http://api.lvh.me:3000/2010-04-01/Accounts/${{ steps.bootstrap_db.outputs.account_sid }}/Messages" \
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
-u "${{ steps.bootstrap_db.outputs.account_sid }}:${{ steps.bootstrap_db.outputs.auth_token }}" \
--data-urlencode "To=+299221234" \
--data-urlencode "Body=Hello World from Integration Test" \
--data-urlencode "From=${{ steps.bootstrap_db.outputs.phone_number }}"
deploy:
name: Deploy
runs-on: ubuntu-latest
Expand Down
20 changes: 14 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ services:
DB_POOL: 30
REDIS_URL: redis://redis:6379/0
ANYCABLE_SECRET: secret
ANYCABLE_BROADCAST_ADAPTER: redisx
ports:
- "3000:3000"
depends_on: &somleng_depends_on
Expand Down Expand Up @@ -59,10 +60,10 @@ services:
ports:
- '8080:8080'
environment:
REDIS_URL: redis://redis:6379/0
ANYCABLE_HOST: "0.0.0.0"
ANYCABLE_PORT: "8080"
ANYCABLE_DISABLE_TELEMETRY: "true"
ANYCABLE_REDIS_URL: redis://redis:6379/0
ANYCABLE_RPC_HOST: anycable:50051
ANYCABLE_BROADCAST_ADAPTER: redisx
ANYCABLE_BROKER: memory
Expand All @@ -76,28 +77,25 @@ services:
depends_on:
redis:
condition: service_healthy
anycable:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --server-response --spider --quiet http://localhost:8080/health 2>&1 | grep '200 OK' > /dev/null"]
interval: 10s
timeout: 5s
retries: 10


anycable:
<<: *somleng
command: bundle exec anycable
environment:
<<: *somleng_environment
ANYCABLE_REDIS_URL: redis://redis:6379/0
ANYCABLE_RPC_HOST: 0.0.0.0:50051
ANYCABLE_SECRET: secret
ANYCABLE_DEBUG: 1
ports:
- '50051'
depends_on:
<<: *somleng_depends_on
ws:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "grpc-health-probe -addr :50051"]
interval: 10s
Expand Down Expand Up @@ -140,3 +138,13 @@ services:
interval: 10s
timeout: 5s
retries: 10

sms-gateway:
image: ghcr.io/somleng/sms-gateway
ports:
- "3210:3210"
depends_on:
ws:
condition: service_healthy
profiles:
- donotstart
2 changes: 1 addition & 1 deletion public/website/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -4342,7 +4342,7 @@ <h4>
<code class="language-bash">
Account SID: account-sid
Auth Token: auth-token
Inbound Phone Number: 1234
Phone Number: 1234
---------------------------------------------
URL: http://my-carrier.app.lvh.me:3000/
Carrier User Email: johndoe@carrier.com
Expand Down

0 comments on commit 4538a01

Please sign in to comment.