Skip to content

Commit

Permalink
Merge pull request #576 from 0xsend/dev
Browse files Browse the repository at this point in the history
deploy
  • Loading branch information
0xBigBoss authored Jul 12, 2024
2 parents 42c3da7 + c47bd56 commit aa90342
Show file tree
Hide file tree
Showing 31 changed files with 1,426 additions and 442 deletions.
2 changes: 2 additions & 0 deletions .env.local.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ SUPABASE_DB_URL=postgresql://postgres:postgres@localhost:54322/postgres
SUPABASE_JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
SUPABASE_SERVICE_ROLE=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
# NEXT_PUBLIC_ENABLE_QUERY_DEV_TOOLS=1
# Enables more logging for sendapp
# DEBUG="api:*,app:*,test:*,-test:fixtures:snaplet:*"
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Environment
uses: ./.github/actions/setup-env
with:
Expand All @@ -37,6 +39,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Environment
uses: ./.github/actions/setup-env
env:
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
name: Deploy Dev

on:
push:
workflow_run:
workflows: ["Docker Build"]
branches: [dev]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
needs: build-docker
deploy-docker-dev:
runs-on: self-hosted
steps:
- name: Configure SSH
- name: Configure ssh & Deploy
shell: bash
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/deployer.key
chmod 600 ~/.ssh/deployer.key
echo "$SSH_KEY" | base64 -d > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "$DEPLOYMENT_TARGETS"
for h in $DEPLOYMENT_TARGETS; do echo Deploying to $h && \
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no $SSH_USER@$h \
timeout 30 ssh $SSH_FLAGS $SSH_USER@$h \
'cd /opt/next-app-dev && docker compose pull && docker compose up -d' ; done
env:
SSH_USER: ${{ secrets.DEPLOYER_SSH_USER }}
SSH_KEY: ${{ secrets.DEPLOYER_SSH_KEY }}
SSH_FLAGS: ${{ secrets.DEPLOYER_SSH_FLAGS }}
DEPLOYMENT_TARGETS: ${{ secrets.DEV_DOCKER_DEPLOYMENT_TARGETS }}
20 changes: 10 additions & 10 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[submodule "packages/contracts/lib/forge-std"]
path = packages/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
path = packages/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "packages/contracts/lib/openzeppelin-contracts"]
path = packages/contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
path = packages/contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "packages/contracts/lib/account-abstraction"]
path = packages/contracts/lib/account-abstraction
url = https://github.com/eth-infinitism/account-abstraction
path = packages/contracts/lib/account-abstraction
url = https://github.com/eth-infinitism/account-abstraction
[submodule "packages/contracts/lib/openzeppelin-contracts-upgradeable"]
path = packages/contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
path = packages/contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "packages/contracts/lib/p256-verifier"]
path = packages/contracts/lib/p256-verifier
url = https://github.com/daimo-eth/p256-verifier
path = packages/contracts/lib/p256-verifier
url = https://github.com/0xbigboss/p256-verifier
25 changes: 13 additions & 12 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ if CI:
if not os.path.exists(".env.local"):
local("cp .env.local.template .env.local")
print(color.green("📝 Created .env.local"))
if CFG.dockerize:
sed = str(local("which gsed || which sed")).strip()
if sed == "":
print(color.red("Could not find sed. Please install it and try again."))
exit(1)

# replace NEXT_PUBLIC_SUPABASE_URL with the dockerized supabase url
local(sed + " -i 's/localhost/host.docker.internal/' .env.local")

# except NEXT_PUBLIC_URL
local(sed + " -i 's/NEXT_PUBLIC_URL=http:\\/\\/host.docker.internal/NEXT_PUBLIC_URL=http:\\/\\/localhost/' .env.local")
print(color.green("📝 Dockerized .env.local"))

if CFG.dockerize:
print(color.green("📝 Dockerizing .env.local"))
sed = str(local("which gsed || which sed")).strip()
if sed == "":
print(color.red("Could not find sed. Please install it and try again."))
exit(1)

# replace NEXT_PUBLIC_SUPABASE_URL with the dockerized supabase url
local(sed + " -i 's/localhost/host.docker.internal/' .env.local")

# except NEXT_PUBLIC_URL
local(sed + " -i 's/NEXT_PUBLIC_URL=http:\\/\\/host.docker.internal/NEXT_PUBLIC_URL=http:\\/\\/localhost/' .env.local")

for dotfile in [
".env",
Expand Down
6 changes: 4 additions & 2 deletions packages/api/src/routers/sendAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ export const sendAccountRouter = createTRPCRouter({
})
}

log('createAccount', `hash=${hash}`)

await withRetry(
async function waitForTransactionReceipt() {
const { count, error } = await supabaseAdmin
Expand All @@ -261,7 +263,7 @@ export const sendAccountRouter = createTRPCRouter({
.eq('account', hexToBytea(senderAddress))
.single()
throwIf(error)
log('waitForTransactionReceipt', `count=${count}`)
log('waitForTransactionReceipt', `hash=${hash}`, `count=${count}`)
return count
},
{
Expand All @@ -273,7 +275,7 @@ export const sendAccountRouter = createTRPCRouter({
},
shouldRetry({ count, error }) {
// @todo handle other errors like balance not enough, invalid nonce, etc
console.error('waitForTransactionReceipt failed', count, error)
console.error('waitForTransactionReceipt failed', { count, error, hash })
if (error.message.includes('Failed to create send account')) {
return false
}
Expand Down
Loading

0 comments on commit aa90342

Please sign in to comment.