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

feat: update docker-compose tar #145

Merged
merged 1 commit into from
Mar 15, 2022
Merged
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: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ node_modules/
*.map
.github/workflows/nodejs.yml

app/**/*.js
config/**/*.js
app/**/*.map
config/**/*.map
dist/
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ Nebula Graph Studio (Studio for short) is a web-based visualization tool for Neb

## Development Quick Start

### Set up nebula-graph-studio
### set up studio and server at the same time
```
$ npm install
$ npm run dev-all
```

### Set up nebula-graph-studio only
```
$ npm install
$ npm run dev
```
### Set up go-server
### Set up go-server only
```
$ cd server
$ go build -o server
Expand All @@ -25,18 +31,18 @@ $ nohup ./server &
```
$ npm run install
$ npm run build
$ mv dist server/assets
```

### 1. Build Web
### 2. Build Server
```
// remove default port 7001 in config/example-config.yaml first
$ cd server
// update default port 9000 to 7001 in config/example-config.yaml first
$ go build -o server
```

### 3. Start
```
$ mv dist server/assets
$ nohup ./server &
```

Expand Down
33 changes: 33 additions & 0 deletions config/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const path = require('path');
const process = require('process');
const fs = require('fs');
const chalk = require('chalk');
const { spawn, spawnSync } = require('child_process');
const webpack = require('webpack');
const openBrowser = require('react-dev-utils/openBrowser');
const WebpackDevServer = require('webpack-dev-server');
const config = require('./webpack.dev');

const compiler = webpack(config);
const portal = config.devServer.https ? 'https' : 'http';
const port = config.devServer.port;
const ip = config.devServer.host || '127.0.0.1';

const goServerPath = path.resolve(process.cwd(), './server');

const goServerProcess = spawn('go run main.go', { cwd: goServerPath, shell: true });
goServerProcess.stdout.on('data', (data) => console.log(chalk.blue(`server::${data.toString().slice(0, -1)}`)));
goServerProcess.on('close', () =>
console.log(chalk.red('\ngo server 启动失败,服务器将不可用,请切换到 server 目录调试异常\n'))
);

const server = new WebpackDevServer(config.devServer, compiler);
server.startCallback(() => {
console.log(`Listening at localhost: ${port}`);
console.log('Opening your system browser...');
openBrowser(`${portal}://${ip}:${port}`);
});

process.on('exit', (code) => {
console.log(`process exits with code: ${code}`);
});
17 changes: 8 additions & 9 deletions config/webpack.base.ts → config/webpack.base.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import HtmlWebpackPlugin from 'html-webpack-plugin';
import path, { resolve } from 'path';
import webpack, { Configuration } from 'webpack';
import Package from '../package.json';
import AntdDayjsWebpackPlugin from 'antd-dayjs-webpack-plugin';

const commonConfig: Configuration = {
const path = require('path');
const webpack = require('webpack');
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const Package = require('../package.json')
const commonConfig = {
entry: {
app: [path.join(__dirname, '../app/index.tsx')],
},
Expand Down Expand Up @@ -89,7 +88,7 @@ const commonConfig: Configuration = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.join(__dirname, '../app/index.html'),
favicon: resolve(__dirname, '../favicon.ico'),
favicon: path.resolve(__dirname, '../favicon.ico'),
minify: {
collapseWhitespace: true,
removeComments: true,
Expand Down Expand Up @@ -121,4 +120,4 @@ const commonConfig: Configuration = {
},
};

export default commonConfig;
module.exports = commonConfig;
10 changes: 6 additions & 4 deletions config/webpack.dev.ts → config/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import path from 'path';
import { mergeWithCustomize } from 'webpack-merge';
import commonConfig from './webpack.base';
const path = require('path');
const merge = require('webpack-merge');
const commonConfig = require('./webpack.base');

const devConfig = {
mode: 'development',
devtool: 'inline-source-map',
entry: {
app: [
Expand All @@ -27,6 +28,7 @@ const devConfig = {

devServer: {
port: 7001,
open: true,
headers: { 'Access-Control-Allow-Origin': '*' },
historyApiFallback: true,
host: 'localhost',
Expand Down Expand Up @@ -61,7 +63,7 @@ const devConfig = {
},
};

module.exports = mergeWithCustomize({
module.exports = merge.mergeWithCustomize({
customizeArray(_, b, key) {
if (key === 'entry.app') {
return b;
Expand Down
18 changes: 9 additions & 9 deletions config/webpack.prod.ts → config/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import path from 'path';
import webpack, { Configuration } from 'webpack';
import merge from 'webpack-merge';
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const webpack = require('webpack');
const { merge } = require('webpack-merge');

import commonConfig from './webpack.base';
const commonConfig = require('./webpack.base');

const publicConfig: Configuration = {
const publicConfig = {
mode: 'production',
output: {
path: path.join(__dirname, '../dist/'),
Expand All @@ -33,8 +33,8 @@ const publicConfig: Configuration = {
new CleanWebpackPlugin(),

new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[id].[hash].css',
filename: '[name].[fullhash].css',
chunkFilename: '[id].[fullhash].css',
}),
],
};
Expand Down
14 changes: 14 additions & 0 deletions deployment/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Nebula Studio Docker Deploy

### Package:

`tar -czf nebula-graph-studio-$VERSION.tar.gz

### Use:

```
tar -xvf nebula-graph-studio-$VERSION.tar.gz
cd nebula-graph-studio-$VERSION
docker-compose pull
docker-compose up -d
```
14 changes: 14 additions & 0 deletions deployment/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.4'
services:
web:
image: vesoft/nebula-graph-studio:v3.3.0-beta
environment:
USER: root
UPLOAD_DIR: ${MAPPING_DOCKER_DIR}
ports:
- 7001:7001
networks:
- nebula-web

networks:
nebula-web:
Loading