-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: railway deployment guide (#70)
* feat: railway deployment guide * chore: update dockerfile * fix: cleanup * chore: cleanup * chore: update readme
- Loading branch information
Showing
10 changed files
with
339 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,64 @@ | ||
# Railway | ||
# Railway | ||
|
||
## One-click Deploy Example | ||
|
||
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/Rqrlcf?referralCode=eD4laT) | ||
|
||
## Deploy an example project | ||
|
||
https://github.com/joshstevens19/rindexer/tree/master/providers/railway | ||
|
||
1. Clone the relevant directory | ||
|
||
```bash | ||
# this will clone the railway directory | ||
mkdir rindexer-railway && cd rindexer-railway | ||
git clone \ | ||
--depth=1 \ | ||
--no-checkout \ | ||
--filter=tree:0 \ | ||
https://github.com/joshstevens19/rindexer . | ||
git sparse-checkout set --no-cone providers/railway . | ||
git checkout && cp -r providers/railway/* . && rm -rf providers | ||
``` | ||
|
||
2. Initialize a new Railway project | ||
|
||
```bash | ||
railway init --name rindexer-example | ||
``` | ||
|
||
3. Create a service and link it to the project | ||
|
||
```bash | ||
railway up --detach | ||
railway link --name rindexer-example --enviroment production | ||
``` | ||
|
||
4. Create a Postgres database | ||
|
||
```bash | ||
railway add --database postgre-sql | ||
``` | ||
|
||
5. Configure environment variables | ||
|
||
```bash | ||
railway open | ||
``` | ||
|
||
- then open the service "Variables" tab and click on "Add Variable Reference" and select `DATABASE_URL`, | ||
- postfix `?sslmode=diable` to the end of the value. It should look like this: `${{Postgres.DATABASE_URL}}?sslmode=disable`, | ||
- hit "Deploy" or Shift+Enter. | ||
|
||
6. Create a domain to access GraphQL Playground | ||
|
||
```bash | ||
railway domain | ||
``` | ||
|
||
7. Redeploy the service | ||
|
||
```bash | ||
railway up | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
|
||
!Dockerfile | ||
!.dockerignore | ||
!example-app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# syntax = docker/dockerfile:1.6 | ||
FROM ghcr.io/joshstevens19/rindexer:latest AS rindexer | ||
|
||
ARG PROJECT_PATH="./example-app" | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY ${PROJECT_PATH} /usr/src/app/rindexer-app | ||
|
||
ARG PORT="3001" | ||
ENV PORT=${PORT} | ||
|
||
EXPOSE ${PORT} | ||
|
||
ENTRYPOINT ["/app/rindexer"] | ||
CMD ["start", "-p", "./rindexer-app", "all"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Railway | ||
|
||
## One-click Deploy Example | ||
|
||
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/Rqrlcf?referralCode=eD4laT) | ||
|
||
## Deploy an example project | ||
|
||
<https://github.com/joshstevens19/rindexer/tree/master/providers/railway> | ||
|
||
1. Clone the relevant directory | ||
|
||
```bash | ||
# this will clone the railway directory | ||
mkdir rindexer-railway && cd rindexer-railway | ||
git clone \ | ||
--depth=1 \ | ||
--no-checkout \ | ||
--filter=tree:0 \ | ||
https://github.com/joshstevens19/rindexer . | ||
git sparse-checkout set --no-cone providers/railway . | ||
git checkout && cp -r providers/railway/* . && rm -rf providers | ||
``` | ||
|
||
2. Initialize a new Railway project | ||
|
||
```bash | ||
railway init --name rindexer-example | ||
``` | ||
|
||
3. Create a service and link it to the project | ||
|
||
```bash | ||
railway up --detach | ||
railway link --name rindexer-example --enviroment production | ||
``` | ||
|
||
4. Create a Postgres database | ||
|
||
```bash | ||
railway add --database postgre-sql | ||
``` | ||
|
||
5. Configure environment variables | ||
|
||
```bash | ||
railway open | ||
``` | ||
|
||
- then open the service "Variables" tab and click on "Add Variable Reference" and select `DATABASE_URL`, | ||
- postfix `?sslmode=diable` to the end of the value. It should look like this: `${{Postgres.DATABASE_URL}}?sslmode=disable`, | ||
- hit "Deploy" or Shift+Enter. | ||
|
||
6. Create a domain to access GraphQL Playground | ||
|
||
```bash | ||
railway domain | ||
``` | ||
|
||
7. Redeploy the service | ||
|
||
```bash | ||
railway up | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
[ | ||
{ | ||
"constant": true, | ||
"inputs": [], | ||
"name": "name", | ||
"outputs": [{ "name": "", "type": "string" }], | ||
"payable": false, | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [ | ||
{ "name": "guy", "type": "address" }, | ||
{ "name": "wad", "type": "uint256" } | ||
], | ||
"name": "approve", | ||
"outputs": [{ "name": "", "type": "bool" }], | ||
"payable": false, | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [], | ||
"name": "totalSupply", | ||
"outputs": [{ "name": "", "type": "uint256" }], | ||
"payable": false, | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [ | ||
{ "name": "src", "type": "address" }, | ||
{ "name": "dst", "type": "address" }, | ||
{ "name": "wad", "type": "uint256" } | ||
], | ||
"name": "transferFrom", | ||
"outputs": [{ "name": "", "type": "bool" }], | ||
"payable": false, | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [{ "name": "wad", "type": "uint256" }], | ||
"name": "withdraw", | ||
"outputs": [], | ||
"payable": false, | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [], | ||
"name": "decimals", | ||
"outputs": [{ "name": "", "type": "uint8" }], | ||
"payable": false, | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [{ "name": "", "type": "address" }], | ||
"name": "balanceOf", | ||
"outputs": [{ "name": "", "type": "uint256" }], | ||
"payable": false, | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [], | ||
"name": "symbol", | ||
"outputs": [{ "name": "", "type": "string" }], | ||
"payable": false, | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [ | ||
{ "name": "dst", "type": "address" }, | ||
{ "name": "wad", "type": "uint256" } | ||
], | ||
"name": "transfer", | ||
"outputs": [{ "name": "", "type": "bool" }], | ||
"payable": false, | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [], | ||
"name": "deposit", | ||
"outputs": [], | ||
"payable": true, | ||
"stateMutability": "payable", | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [ | ||
{ "name": "", "type": "address" }, | ||
{ "name": "", "type": "address" } | ||
], | ||
"name": "allowance", | ||
"outputs": [{ "name": "", "type": "uint256" }], | ||
"payable": false, | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ "payable": true, "stateMutability": "payable", "type": "fallback" }, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "src", "type": "address" }, | ||
{ "indexed": true, "name": "guy", "type": "address" }, | ||
{ "indexed": false, "name": "wad", "type": "uint256" } | ||
], | ||
"name": "Approval", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "src", "type": "address" }, | ||
{ "indexed": true, "name": "dst", "type": "address" }, | ||
{ "indexed": false, "name": "wad", "type": "uint256" } | ||
], | ||
"name": "Transfer", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "dst", "type": "address" }, | ||
{ "indexed": false, "name": "wad", "type": "uint256" } | ||
], | ||
"name": "Deposit", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "src", "type": "address" }, | ||
{ "indexed": false, "name": "wad", "type": "uint256" } | ||
], | ||
"name": "Withdrawal", | ||
"type": "event" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: wETHIndexer | ||
description: My first rindexer project | ||
repository: https://github.com/joshstevens19/rindexer | ||
project_type: no-code | ||
networks: | ||
- name: sepolia | ||
chain_id: 11155111 | ||
rpc: https://sepolia.gateway.tenderly.co | ||
storage: | ||
postgres: | ||
enabled: true | ||
contracts: | ||
- name: SepoliaWETH | ||
details: | ||
- network: sepolia | ||
address: 0x097D90c9d3E0B50Ca60e1ae45F6A81010f9FB534 | ||
abi: ./erc20.abi.json | ||
include_events: | ||
- Deposit | ||
- Approval | ||
- Transfer | ||
- Withdrawal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#: schema https://railway.app/railway.schema.json | ||
[build] | ||
builder = "DOCKERFILE" | ||
buildEnvironment = "V2" | ||
dockerfilePath = "./Dockerfile" | ||
|
||
[deploy] | ||
runtime = "V2" | ||
numReplicas = 1 | ||
sleepApplication = false | ||
restartPolicyMaxRetries = 10 | ||
restartPolicyType = "ON_FAILURE" |