5 Commits

Author SHA1 Message Date
9a50b2c6cf Dockerize gather 2024-02-04 19:09:33 +03:00
db9180721a Updated drone.yml
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-07 02:36:58 +03:00
1af1048670 Fix crash
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-06 19:43:44 +03:00
148a3693b9 Merge branch 'monorepo' of ssh://git.radner.ru:3036/anatolykopyl/warframe-center into monorepo
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-05 14:50:16 +03:00
efb1cba216 Remove metrika id from env 2022-07-05 14:50:12 +03:00
13 changed files with 2631 additions and 3050 deletions

View File

@@ -1,65 +0,0 @@
kind: pipeline
type: ssh
name: install dependencies
server:
host: warframe.center
user: webmaster
ssh_key:
from_secret: ssh_private_key
clone:
disable: true
steps:
- name: fetch remote
commands:
- cd /home/webmaster/warframe-center && git fetch --all && git reset --hard origin/monorepo
- name: install dependencies
commands:
- export PATH=$PATH:/home/webmaster/.nvm/versions/node/v16.14.2/bin
- cd /home/webmaster/warframe-center && npm install
trigger:
branch:
- monorepo
---
kind: pipeline
type: docker
name: build
clone:
disable: true
steps:
- name: bulid frontend
image: node:16
environment:
SSH_PRIVATE_KEY:
from_secret: ssh_private_key
MONGODB_URI:
from_secret: MONGODB_URI
commands:
- git clone -b monorepo https://git.radner.ru/anatolykopyl/warframe-center.git
- cd warframe-center
- npm install
- npm run build -w app
- mkdir ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 400 ~/.ssh/id_rsa
- scp -o StrictHostKeyChecking=no -r ./app/.next webmaster@warframe.center:~/warframe-center/app
- |
ssh -o StrictHostKeyChecking=no webmaster@warframe.center '
[ -s ~/.nvm/nvm.sh ] && source ~/.nvm/nvm.sh &&
nvm use default &&
pm2 restart warframe-center-app-3000
'
depends_on:
- install dependencies
trigger:
branch:
- monorepo

2
.gitignore vendored
View File

@@ -2,3 +2,5 @@ node_modules
.DS_Store
.vscode
.env
.idea
.yarn

View File

@@ -13,7 +13,7 @@ const WithYandexMetrika = (props) => {
} else {
console.log('%c[YandexMetrika](HIT)', 'color: orange', url)
}
}, [])
}, [enabled])
useEffect(() => {
hit(window.location.pathname + window.location.search)

View File

@@ -1,7 +0,0 @@
module.exports = {
apps: [{
name: 'warframe-center-app-3000',
script: 'npm run start',
watch: false
}]
}

9
gather/Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM node:20-alpine
LABEL authors="anatolykopyl"
WORKDIR /usr/node/app
COPY package*.json ./
RUN npm ci
COPY . .

View File

@@ -0,0 +1,9 @@
version: '3'
services:
warframe-center-gather:
image: git.radner.ru/anatolykopyl/warframe-center-gather:latest
container_name: warframe-center-gather
working_dir: /usr/node/app
command: >
sh -c "node src/index.js"

View File

@@ -1,9 +0,0 @@
module.exports = {
apps: [{
name: 'warframe-center-gather',
script: './src/index.js',
watch: true,
ignore_watch: ['node_modules', 'public'],
restart_delay: 1 * 60 * 1000
}]
}

View File

@@ -15,7 +15,6 @@
"shared-stuff": "file:../shared-stuff"
},
"devDependencies": {
"eslint-config-standard": "^16.0.3",
"pm2": "^5.2.0"
"eslint-config-standard": "^16.0.3"
}
}

View File

@@ -7,8 +7,10 @@ async function initDB () {
await mongoose.connect(process.env.MONGODB_URI)
}
(async () => {
await initDB()
const main = async (firstLaunch) => {
if (firstLaunch) {
await initDB()
}
for (const item of items) {
process.stdout.write(`Looking at ${item.name}: `)
@@ -36,5 +38,13 @@ async function initDB () {
console.log('✅')
}
await mongoose.disconnect()
})()
await main()
}
main(true)
process.on('SIGINT', () => {
mongoose.disconnect().then(() => {
process.exit()
})
})

View File

@@ -10,6 +10,10 @@ module.exports = class Part {
async getPrice () {
const orders = await Api.getSortedOrders(this.urlPath)
if (orders.length === 0) {
return 0
}
return Number(orders[0].platinum) * this.amount
}
}

5525
package-lock.json generated

File diff suppressed because it is too large Load Diff

11
shared-stuff/dist/index.js vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.models = void 0;
const ScanResult_1 = __importDefault(require("./models/ScanResult"));
const models = {
ScanResult: ScanResult_1.default
};
exports.models = models;

17
shared-stuff/dist/models/ScanResult.js vendored Normal file
View File

@@ -0,0 +1,17 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose_1 = __importDefault(require("mongoose"));
const scanResultSchema = new mongoose_1.default.Schema({
name: String,
fullName: String,
url: String,
partsPrice: Number,
setPrice: Number,
difference: Number
}, {
timestamps: true
});
exports.default = mongoose_1.default.models.ScanResult || mongoose_1.default.model('ScanResult', scanResultSchema);