Skip to content

Commit

Permalink
chore: restructure project - migrating to self hosted deno instance (#72
Browse files Browse the repository at this point in the history
)

* chore: restructure project

* refactor: auto format

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore: setup ci/cd pipelines

* chore: remove unused import and clean up

---------

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
wax911 authored Dec 17, 2023
1 parent 51265dc commit 37ab2c5
Show file tree
Hide file tree
Showing 138 changed files with 1,163 additions and 949 deletions.
181 changes: 181 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# Created by https://www.toptal.com/developers/gitignore/api/deno,visualstudiocode,node
# Edit at https://www.toptal.com/developers/gitignore?templates=deno,visualstudiocode,node

### Deno ###
/node_modules

.env
*.orig
*.pyc
*.swp

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/deno,visualstudiocode,node

/.idea/

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

.temp
4 changes: 3 additions & 1 deletion .env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ MONGO_URL="mongodb://localhost:27017"

SPOTIFY="https://api.spotify.com/v1"
SPOTIFY_ID="SPOTIFY_ID"
SPOTIFY_SECRET="SPOTIFY_SECRET"
SPOTIFY_SECRET="SPOTIFY_SECRET"

PORT=8080
12 changes: 0 additions & 12 deletions .github/scripts/deploy-all.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .github/scripts/generate-types.sh

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/deno-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: deno-cd

on:
workflow_call:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build against'
required: true
default: 'latest'
push:
branches:
- dev
tags: "*"

jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set Tag
id: set-tag
run: |
if [[ -z "${{ github.event.inputs.tag }}" && -z "${GITHUB_REF#refs/tags/}" ]]; then
echo "::set-output name=tag::latest"
else
if [ -z "${{ github.event.inputs.tag }}" ]; then
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
else
echo "::set-output name=tag::${{ github.event.inputs.tag }}"
fi
fi
- name: Build and Push Docker Image
run: |
docker buildx create --use
docker buildx build --platform linux/amd64 . \
--output type=docker \
--tag ghcr.io/anitrend/anitrend-on-the-edge:${{ steps.set-tag.outputs.tag }} \
--cache-from type=registry,ref=ghcr.io/anitrend/anitrend-on-the-edge:cache,mode=max \
--cache-to type=registry,ref=ghcr.io/anitrend/anitrend-on-the-edge:cache
docker push ghcr.io/anitrend/anitrend-on-the-edge:${{ steps.set-tag.outputs.tag }}
working-directory: .
21 changes: 0 additions & 21 deletions .github/workflows/supabase-deploy.yml

This file was deleted.

62 changes: 3 additions & 59 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,17 @@
"configurations": [
{
"request": "launch",
"name": "config",
"name": "server",
"type": "node",
"program": "${workspaceFolder}/supabase/functions/config/index.ts",
"program": "${workspaceFolder}/src/index.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "/home/max/.deno/bin/deno",
"runtimeExecutable": "deno",
"runtimeArgs": [
"run",
"--inspect-wait",
"--allow-all"
],
"attachSimplePort": 9229
},
{
"request": "launch",
"name": "news",
"type": "node",
"program": "${workspaceFolder}/supabase/functions/news/index.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "/home/max/.deno/bin/deno",
"runtimeArgs": [
"run",
"--inspect-wait",
"--allow-all"
],
"attachSimplePort": 9229
},
{
"request": "launch",
"name": "preview",
"type": "node",
"program": "${workspaceFolder}/supabase/functions/preview/index.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "/home/max/.deno/bin/deno",
"runtimeArgs": [
"run",
"--inspect-wait",
"--allow-all"
],
"attachSimplePort": 9229
},
{
"request": "launch",
"name": "series",
"type": "node",
"program": "${workspaceFolder}/supabase/functions/series/index.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "/home/max/.deno/bin/deno",
"runtimeArgs": [
"run",
"--inspect-wait",
"--allow-all"
],
"attachSimplePort": 9229
},
{
"request": "launch",
"name": "graphql",
"type": "node",
"program": "${workspaceFolder}/supabase/functions/graphql/index.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "/home/max/.deno/bin/deno",
"runtimeArgs": [
"run",
"--inspect-wait",
"--allow-all"
],
"attachSimplePort": 9229
}
]
}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM denoland/deno:1.38.5

WORKDIR /usr/app

# Copy the rest of the application code
COPY . /usr/app

# Compile the Deno TypeScript code to a standalone executable
RUN deno compile --output=server src/index.ts
Loading

0 comments on commit 37ab2c5

Please sign in to comment.