Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Api Server #43

Draft
wants to merge 22 commits into
base: rewrite
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ build/
.idea/

lib_old/

**/node_modules/**
6 changes: 5 additions & 1 deletion .github/workflows/publish_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ jobs:
context: .
target: prod
push: true
build-args: |
REACT_APP_CLIENT_ID=${{ secrets.REACT_APP_CLIENT_ID }}
REACT_APP_REDIRECT_URL=${{ secrets.REACT_APP_REDIRECT_URL }}
REACT_APP_API_SERVER=${{ secrets.REACT_APP_API_SERVER }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Redeploy portainer
uses: muinmomin/[email protected]
with:
url: ${{ secrets.ROD_PORTAINER_WEBHOOK }}
url: ${{ secrets.ROD_PORTAINER_WEBHOOK }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ doc/api/
*.db

sessions/

public/
!public/.gitkeep
19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,29 @@ FROM build AS build_prod

RUN dart run nyxx_commands:compile bin/running_on_dart.dart -o bot

FROM node:lts-slim as build_frontend

ARG REACT_APP_CLIENT_ID
ARG REACT_APP_REDIRECT_URL
ARG REACT_APP_API_SERVER

ENV REACT_APP_CLIENT_ID=$REACT_APP_CLIENT_ID
ENV REACT_APP_REDIRECT_URL=$REACT_APP_REDIRECT_URL
ENV REACT_APP_API_SERVER=$REACT_APP_API_SERVER

WORKDIR /app

COPY ./frontend/ /app

RUN npm install
RUN npm run build

FROM scratch AS prod

WORKDIR /app

COPY --from=build_prod /runtime /
COPY --from=build_prod /app/templates /app/templates
COPY --from=build_prod /app/bot.exe /app
COPY --from=build_frontend /app/build /app/public

CMD [ "./bot.exe" ]
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ run: ## Run dev project
upgrade: ## Run dart pub upgrade
dart pub upgrade

build-frontend-dev: ## Build dev frontend
cd frontend/; env-cmd -f .env.development.local yarn build
cp -r frontend/build/** public/

fix-project: fix analyze format ## Fix whole project

check-project: fix-project tests ## Run all checks
1 change: 0 additions & 1 deletion bin/running_on_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void main() async {
IgnoreExceptions(),
commands,
pagination,
SessionManagerPlugin(),
],
));

Expand Down
4 changes: 1 addition & 3 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
version: '3.9'
services:
running_on_dart:
image: ghcr.io/nyxx-discord/running_on_dart:4.10.0-dev.15
image: ghcr.io/nyxx-discord/running_on_dart:4.10.0-dev.22
container_name: running_on_dart
env_file:
- .env
depends_on:
- db
volumes:
- "rod_sessions:/sessions"
networks:
- internal
- nginx-proxy_default
Expand Down
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ services:
- "8088:8088"
depends_on:
- db
volumes:
- "./sessions:/sessions"
- "./templates:/templates"

db:
image: postgres:17
Expand Down
26 changes: 26 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.idea/
*.iml

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Loading
Loading