This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createApp } from '@root/app.js'; | |
import { Cookies } from './lib/cookie.js'; | |
const APP = createApp(); | |
global.cookies = new Cookies({env: 'browser'}); | |
global.APP = APP; | |
if (window.__INITIAL_STATE__) { | |
APP.Store.replaceState(window.__INITIAL_STATE__); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const LRU = require('lru-cache'); | |
const fastify = require('fastify'); | |
const server = fastify({ | |
logger: false, | |
}); | |
const bundle = require('./../dist/vue-ssr-server-bundle.json'); | |
const vueRenderer = require('vue-server-renderer'); | |
const fs = require('fs'); | |
const templatePath = path.resolve(__dirname, './index.html'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {instance} from './instance.js'; | |
import {SwaggerApi} from './swagger.js'; | |
export class BiglionApi extends SwaggerApi { | |
constructor() { | |
super(); | |
this.Request = instance; | |
} | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {instance} from './instance.js'; | |
import {SwaggerApi} from './swagger.js'; | |
export class MainApi extends SwaggerApi { | |
constructor() { | |
super(); | |
this.Request = instance; | |
} | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
export const instance = axios.create({ | |
baseURL: appConf.BACKEND_HOST, | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get current ENV | |
//Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/ | |
const | |
ENV = process.env.APP_ENV, | |
ENV_CONF = require(`./pm2.${ENV}.js`); | |
if(ENV === undefined){ | |
console.error(`ERROR: Undefined envoirment: ${ENV}. Start stopped.`); | |
process.exit(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ENVOIRMENT = require('./env.development.js'); | |
module.exports = { | |
APPS: [ | |
{ | |
name: 'SSR', | |
script: 'src/server.js', | |
instances: 1, | |
exec_mode: 'fork', | |
autorestart: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ENVOIRMENT = require('./env.production.js'), | |
GREEN_ENV = Object.assign({ | |
SSR_PORT: 8080, | |
}, ENVOIRMENT), | |
BLUE_ENV = Object.assign({ | |
SSR_PORT: 9090, | |
}, ENVOIRMENT); | |
console.log('GREEN ENV', GREEN_ENV); | |
console.log('BLUE ENV', BLUE_ENV); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#GREEN | |
upstream NODE_SSR_GREEN { server 127.0.0.1:8080; } | |
upstream NODE_SSR_BLUE { server 127.0.0.1:8082; } | |
#Основной сервер | |
server { | |
set $ACTIVE_SSR NODE_SSR_GREEN; | |
set $APP_ROOT /var/www/app-GREEN/dist; | |
server_name vue.ssr; |