-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
6,640 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
Dockerfile |
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,2 @@ | ||
DATABASE_URI=postgres://postgres:postgres@localhost:5432/sqf-indexer | ||
RPC_URL_SEPOLIA= |
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,24 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- "**" | ||
- "!main" | ||
pull_request: | ||
branches: | ||
- "**" | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker Compose | ||
uses: hoverkraft-tech/[email protected] | ||
with: | ||
compose-file: "./docker-compose.yaml" | ||
env: | ||
DATABASE_URI: ${{ secrets.DATABASE_URI }} | ||
RPC_URL_SEPOLIA: ${{ secrets.RPC_URL_SEPOLIA }} |
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,43 @@ | ||
name: Build and Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker Compose | ||
uses: hoverkraft-tech/[email protected] | ||
with: | ||
compose-file: "./docker-compose.yaml" | ||
env: | ||
DATABASE_URI: ${{ secrets.DATABASE_URI }} | ||
RPC_URL_SEPOLIA: ${{ secrets.RPC_URL_SEPOLIA }} | ||
|
||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up SSH key | ||
run: | | ||
mkdir ~/.ssh | ||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | ||
chmod 600 ~/.ssh/id_ed25519 | ||
ssh-keyscan -p 22 ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | ||
- name: Deploy | ||
run: | | ||
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} /bin/bash <<'ENDSSH' | ||
cd ${{ secrets.APP_PATH }} | ||
git pull origin main | ||
export DATABASE_URI=${{ secrets.DATABASE_URI }} | ||
export RPC_URL_SEPOLIA=${{ secrets.RPC_URL_SEPOLIA }} | ||
docker compose -f docker-compose.yaml up -d --build | ||
ENDSSH |
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,4 @@ | ||
node_modules | ||
dist | ||
.env | ||
sqlite_cache |
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 @@ | ||
{} |
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,18 @@ | ||
FROM node:lts | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
|
||
# Bundle app source | ||
COPY src src | ||
COPY tsconfig.json ./ | ||
|
||
RUN npm run build | ||
|
||
EXPOSE 3000 | ||
|
||
CMD [ "npm", "start" ] |
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,26 @@ | ||
services: | ||
sqf-indexer: | ||
build: | ||
context: . | ||
ports: | ||
- '3000:3000' | ||
command: npm run start | ||
environment: | ||
- NODE_ENV=production | ||
- DATABASE_URI=${DATABASE_URI} | ||
- RPC_URL_SEPOLIA=${RPC_URL_SEPOLIA} | ||
volumes: | ||
- sqlite_data:/sqlite_cache | ||
db: | ||
image: postgres:14 | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_DB=sqf-indexer | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
volumes: | ||
postgres_data: | ||
sqlite_data: |
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,10 @@ | ||
import globals from "globals"; | ||
import pluginJs from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
|
||
export default [ | ||
{languageOptions: { globals: globals.browser }}, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
]; |
Oops, something went wrong.