chore: many production changes

This commit is contained in:
Hao He 2022-06-18 14:02:19 +00:00
parent 1af9cacaa7
commit a5c86a912a
12 changed files with 410 additions and 769 deletions

View File

@ -4,6 +4,7 @@
![GFI-Bot Tests](https://github.com/osslab-pku/gfi-bot/actions/workflows/test-gfi-bot.yml/badge.svg)
![GFI-Bot Coverage](https://img.shields.io/codecov/c/github/osslab-pku/gfi-bot?label=GFI-Bot%20Coverage)
![License](https://img.shields.io/github/license/osslab-pku/gfi-bot?label=License)
[![GFI-Bot]https://gfibot.io/api/repo/badge?owner=osslab-pku&name=gfi-bot)](https://gfibot.io/?owner=osslab-pku&name=gfi-bot)
ML-powered 🤖 for finding and labeling good first issues in your GitHub project!
@ -78,6 +79,10 @@ python -m gfibot.data.dataset --since=2008.01.01 --nprocess=4
### Model Training
Model training can be simply done by running the following script.
```shell script
```
### Backend Deployment

View File

@ -0,0 +1,2 @@
REACT_APP_ENV = 'development'
REACT_APP_BASE_URL ?= undefined

2
frontend/.env.production Normal file
View File

@ -0,0 +1,2 @@
REACT_APP_ENV = 'production'
REACT_APP_BASE_URL ?= 'https://gfibot.io/'

2
frontend/.gitignore vendored
View File

@ -22,4 +22,4 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env.*
# .env.*

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
"@ant-design/icons": "^4.7.0",
"@babel/core": "^7.16.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@svgr/webpack": "^5.5.0",
"@svgr/webpack": "^6.2.1",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",

View File

@ -922,7 +922,7 @@ def get_repo_badge():
).count()
print(gfi_num)
img_src = "https://img.shields.io/badge/{}-{}".format(
"Using - GFIBot", "success"
f"GFIBot - {gfi_num} recommended good first issues", "success"
)
svg = requests.get(img_src).content
return app.response_class(svg, mimetype="image/svg+xml")

View File

@ -289,8 +289,6 @@ def get_dataset(issue: Union[OpenIssue, ResolvedIssue], before: datetime) -> Dat
logger.error(f"{issue.owner}/{issue.name}#{issue.number}: Pull Request")
return
logger.info(f"{issue.owner}/{issue.name}#{issue.number} (before {before}) start")
repo: Repo = Repo.objects(owner=issue.owner, name=issue.name).first()
contribs, n_closed, n_open, close_times = _get_background_data(
issue.owner, issue.name, before
@ -355,7 +353,6 @@ def get_dataset(issue: Union[OpenIssue, ResolvedIssue], before: datetime) -> Dat
data.event_users = event_users
data.save()
logger.info(f"{issue.owner}/{issue.name}#{issue.number} (before {before}) is done")
return data
@ -435,6 +432,14 @@ def get_dataset_for_repo(
ResolvedIssue.objects(repo_query & Q(resolved_at__gte=since))
)
open_issues = list(OpenIssue.objects(repo_query & Q(updated_at__gte=since)))
logger.info(
"%s/%s: start building dataset (%d resolved, %d open)",
owner,
name,
len(resolved_issues),
len(open_issues),
)
get_dataset_with_issues(resolved_issues, open_issues)
log.updated_open_issues = len(open_issues)

View File

@ -20,12 +20,13 @@ services:
depends_on:
- mongodb
gfi-bot-frontend:
build:
context: ../
dockerfile: ./production/gfibot.frontend.dockerfile
ports:
- "80:80"
- "443:443"
depends_on:
- gfi-bot
# TODO: fix strange dependency bugs before using frontend docker
#gfi-bot-frontend:
# build:
# context: ../
# dockerfile: ./production/gfibot.frontend.dockerfile
# ports:
# - "80:80"
# - "443:443"
# depends_on:
# - gfi-bot

View File

@ -1,20 +1,15 @@
FROM node:16
ENV NODE_ENV=production
WORKDIR /
COPY ./ /gfi-bot
WORKDIR /gfi-bot/frontend
RUN npm ci --force
RUN npm run build:prod
FROM caddy:2.5.1
EXPOSE 80
EXPOSE 443
# Install caddy
RUN apt install -y debian-keyring debian-archive-keyring apt-transport-https
RUN curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
RUN curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
RUN apt update
RUN apt install caddy
WORKDIR /
COPY ./ /gfi-bot/
WORKDIR /gfi-bot/frontend
RUN npm install --force
RUN npm run build:prod
WORKDIR /gfi-bot/
RUN caddy run --config=/gfibot/production/Caddyfile
WORKDIR /gfi-bot
RUN caddy run --config=production/Caddyfile

View File

@ -4,7 +4,7 @@ import json
import logging
import argparse
MONGO_URI: Final = "mongodb://mongodb:27017/"
MONGO_URI: Final = "mongodb://mongodb:27020/"
SECRET_FILE_NAME: Final = "production/production_secrets.json"
db_client = pymongo.MongoClient(MONGO_URI)

View File

@ -104,7 +104,7 @@ projects = [ # This list of 100 projects comes from RecGFI paper
github_graphql_schema_path = "gfibot/data/github_graphql_schema.graphql"
[mongodb]
url = "mongodb://localhost:27017"
url = "mongodb://localhost:27020"
db = "gfibot"
[tool.poetry]