Skip to content

chore: P1 - stage.dzcode.io to new more powerful VPS #654

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

Merged
merged 21 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
927db93
added script and config files to deploy to zcluster
ZibanPirate Apr 26, 2025
59ae348
initiated ./web-server
ZibanPirate Apr 26, 2025
727c349
feat: initialize web server with express and TypeScript
ZibanPirate Apr 26, 2025
bee4195
added dynamic routes and fallback to static content
ZibanPirate Apr 26, 2025
a9c5a45
refactor: update Dockerfile for Node.js setup and remove Nginx config…
ZibanPirate Apr 26, 2025
6a25150
included fullstack config
ZibanPirate Apr 26, 2025
ba81541
generate project sitemap in ./web-server
ZibanPirate Apr 27, 2025
7e67739
auto gen web-server deps into dockerfile copy steps
ZibanPirate Apr 27, 2025
f61b9d5
generate the rest of sitemaps in ./web-server
ZibanPirate Apr 27, 2025
73b6e81
refactor: improve XML escaping in sitemap generation
ZibanPirate Apr 27, 2025
644b109
render project page
ZibanPirate Apr 27, 2025
734fd27
feat: add contribution and contributor page rendering logic
ZibanPirate Apr 27, 2025
55c7f93
removed cloudflare
ZibanPirate Apr 27, 2025
7e95413
removed redundant rsbuild config file
ZibanPirate Apr 27, 2025
8cb7473
modify deploy action to only deploy api using the old way
ZibanPirate Apr 27, 2025
a7a01a7
setup ./web-server CD
ZibanPirate Apr 27, 2025
e9f2994
fix: specify Dockerfile path in build command for consistency
ZibanPirate Apr 27, 2025
a40fb14
fix: update Docker build command to use buildx and correct file path
ZibanPirate Apr 27, 2025
6fabbb9
feat: add zcluster installation and deployment steps to workflow
ZibanPirate Apr 27, 2025
1f619a1
fix: streamline zcluster installation steps in deployment workflow
ZibanPirate Apr 27, 2025
61537ce
fix: update zcluster deployment command to use correct docker-compose…
ZibanPirate Apr 27, 2025
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ cloudflare/public/*
.wrangler
**/cloudflare/wrangler.toml

# web server
web-server/nodemon.json

# data
data/nodemon.json
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM --platform=linux/amd64 node:22

WORKDIR /usr/src/repo

COPY ./package.json ./package.json

# AUTO_GEN
COPY ./web-server/dist ./web-server/dist
COPY ./web-server/package.json ./web-server/package.json
COPY ./packages/utils/dist ./packages/utils/dist
COPY ./packages/utils/package.json ./packages/utils/package.json
COPY ./packages/models/dist ./packages/models/dist
COPY ./packages/models/package.json ./packages/models/package.json
COPY ./api/dist ./api/dist
COPY ./api/package.json ./api/package.json
COPY ./web/dist ./web/dist
COPY ./web/bundle ./web/bundle
COPY ./web/package.json ./web/package.json
COPY ./packages/tooling/package.json ./packages/tooling/package.json
COPY ./data/dist ./data/dist
COPY ./data/package.json ./data/package.json
# AUTO_GEN_END

RUN npm install --install-strategy=nested --omit=dev --workspace=@dzcode.io/web-server

ENV PORT=80
WORKDIR /usr/src/repo/web-server
CMD [ "npm", "run", "start" ]
18 changes: 10 additions & 8 deletions api/src/digest/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { AIResponseTranslateNameDto, AIResponseTranslateTitleDto } from "./dto";
import { DataProjectEntity } from "src/data/types";
import { RepositoryEntity } from "@dzcode.io/models/dist/repository";
import { BitbucketService } from "src/bitbucket/service";
import { ConfigService } from "src/config/service";

type RepoInfo = Pick<RepositoryEntity, "id" | "name" | "owner" | "provider" | "stars">;
interface RepoContributor {
Expand Down Expand Up @@ -56,6 +57,7 @@ export class DigestCron {
private readonly tagRepository: TagRepository,
private readonly aiService: AIService,
private readonly bitbucketService: BitbucketService,
private readonly configService: ConfigService,
) {
const SentryCronJob = cron.instrumentCron(CronJob, "DigestCron");
new SentryCronJob(
Expand Down Expand Up @@ -98,14 +100,14 @@ export class DigestCron {
const runId = Math.random().toString(36).slice(2);
this.logger.info({ message: `Digest cron started, runId: ${runId}` });

const projectsFromDataFolder = await this.dataService.listProjects();
// todo-ZM: make this configurable
// uncomment during development
// const projectsFromDataFolder = (await this.dataService.listProjects()).filter((p) =>
// ["Open-listings", "dzcode.io website", "Mishkal", "System Monitor"].includes(p.name),
// );
// or uncomment to skip the cron
// if (Math.random()) return;
let projectsFromDataFolder = await this.dataService.listProjects();

if (this.configService.env().NODE_ENV === "development") {
this.logger.info({ message: `Running in development mode, filtering projects` });
projectsFromDataFolder = projectsFromDataFolder.filter((p) =>
["Open-listings", "dzcode.io website", "Mishkal", "System Monitor"].includes(p.name),
);
}

const projectTitleSystemPrompt = `user will give you an open-source project name, and you will translate it to Arabic.
it may contain non-translatable parts like acronyms, keep them as is.`;
Expand Down
4 changes: 2 additions & 2 deletions data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"description": "data.dzcode.io code",
"version": "6.1.0",
"author": {
"email": "contact@zakiii.com",
"email": "zakman.dev@gmail.com",
"name": "Zakaria Mansouri",
"url": "https://www.zakiii.com"
"url": "https://zak-man.com"
},
"dependencies": {
"fs-extra": "^11.2.0",
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
web:
image: ghcr.io/dzcode-io/stage-dot-dzcode-dot-io-server:latest
pull_policy: always
restart: unless-stopped
environment:
- VIRTUAL_HOST=stage.dzcode.io
- LETSENCRYPT_HOST=stage.dzcode.io
- STAGE=staging
networks:
- main-infra-network

networks:
main-infra-network:
external: true
Loading
Loading