• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    HTML
  • License
    Apache License 2.0
  • Created about 4 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

LuckysheetServer docker deployment startup template

LuckysheetServerStarter

English| 简体中文

Introduction

💻LuckysheetServer docker deployment startup template.

Demo

Tutorial

Folder structure

C:\Users\Administrator\Desktop\lsheet>tree /f
│ 
│  docker-compose.yml   #Deployment file
│
├─java-server
│      application-dev.yml           #Project configuration
│      application.yml                  #Project configuration 
│      web-lockysheet-server.jar   #Project
│
├─nginx
│  │  nginx.conf  #nginx configuration
│  │
│  ├─html         #nginx static folder
|  |  index.html # Luckysheet demo
|  |
│  └─logs          #nginx log folder
├─postgres
│  │  init.sql      #postgre initialization file
│  │
│  └─data          #postgres data folder
└─redis
    │  redis.conf   #redis configuration file
    │ 
    ├─data          #redis data folder
    └─logs           #redis log folder

Requirements

1. Enter folder

cd dir

2. Set redis/logs directory permissions

chmod a+rwx ./redis/logs/

redis/logs

3. Start to build the image

docker-compose build

build

4. Start the container in the background

docker-compose up -d 

up

5. View image

docker ps

ps

6. verification

  • redis verification
docker exec -it  [container ID]  redis-cli -a '123456'

redis

  • postgres verification
#Enter the container
docker exec -ti postgres /bin/bash
#Log in to postgres
psql -U postgres
#List all databases
\l
#Switch database
\c luckysheetdb
#List all table names
\dt
#View table data
select * from luckysheet;

postgres select

  • Verify java application (use test url)
curl http://172.19.0.4:9004/luckysheet/test/constant?param=123

java

  • Verify that nginx accesses the java application
curl http://172.19.0.101/luckysheet/test/constant?param=123

java nginx

  • This example is installed on the cloud server and tested by the browser
http://xx.100.104.9/luckysheet/test/constant?param=123

browser

Visit Luckysheet demo

# static demo
http://xx.100.104.9
# Collaborative editing mode
http://xx.100.104.9?share

7. Configuration file

  • nginx configuration
#Running user
#user  nobody;

#Number of open processes <= number of CPUs
worker_processes  1;

#Error log save location
error_log  /var/log/nginx/error.log;

#Process number save file
pid        /var/log/nginx/nginx.pid;

#Waiting for event
events {
    #Open under Linux to improve performance
    #use epoll;
    #Maximum number of connections per process (maximum connection = number of connections x number of processes)
    worker_connections  1024;
}


http {
    #File extension and file type mapping table
    include       mime.types;
    
    #Default file type
    default_type  application/octet-stream;

    #Log file output format .This location corresponds to the global setting
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    #Request log save location
    access_log  /var/log/nginx/access.log  main;

    #Open send file
    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #Turn on gzip compression
    #gzip  on;
    gzip  on;
    gzip_min_length 1k;
    gzip_buffers 16 64k;
    gzip_http_version 1.0;
    gzip_comp_level 7;
    #DO NOT zip pics
    gzip_types text/plain application/x-javascript text/javascript application/x-httpd-php text/css text/xml text/jsp application/eot application/ttf application/otf application/svg application/woff;
    gzip_vary on;
    gzip_disable "MSIE [1-6].";

    #websocket
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }
    
    #Set the server list for load balancing
    upstream luckysheetserver {
        server 172.19.0.4:9004 weight=1;  
    }
    
    #The first virtual host
    server {
        #Listening IP port
        listen       80;
        
        #Host name
        server_name  localhost;
        
        #Set character set
        #charset koi8-r;

        #The access log of this virtual server is equivalent to a local variable
        #access_log  logs/host.access.log  main;
        
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        location /luckysheet/websocket/luckysheet {
            proxy_pass http://luckysheetserver/luckysheet/websocket/luckysheet;

            proxy_set_header Host $host;
            proxy_set_header X-real-ip $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_connect_timeout 1800s;
            proxy_read_timeout 600s;
            proxy_send_timeout 600s;
            #websocket
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
        location /luckysheet/ {
            proxy_pass http://luckysheetserver;

            proxy_connect_timeout 1800;
            proxy_read_timeout 600;
        }
         
        location / {
            root   /usr/share/nginx/html/;
            index  index.html index.htm;            
            
            proxy_connect_timeout 1800;
            proxy_read_timeout 600;
            #websocket
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }

        #Dynamic and static separation
        location ~ .*\.(html|js|css|jpg|txt)?$ {
           root  /usr/share/nginx/html/;
           #expires 3d;
        }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html/;
        }

    }
}
  • redis configuration
bind *
protected-mode no
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
supervised no
pidfile /usr/local/redis/redis.pid
loglevel notice
logfile /usr/local/redis/logs.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /usr/local/redis/data/
slave-serve-stale-data yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
maxmemory 500mb
maxmemory-policy noeviction
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
requirepass 123456
  • postgres initialization script
CREATE DATABASE luckysheetdb;
\c luckysheetdb;

DROP SEQUENCE IF EXISTS "public"."luckysheet_id_seq";
CREATE SEQUENCE "public"."luckysheet_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9999999999999
START 1
CACHE 10;

DROP TABLE IF EXISTS "public"."luckysheet";
CREATE TABLE "luckysheet" (
  "id" int8 NOT NULL,
  "block_id" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "index" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "list_id" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "status" int2 NOT NULL,
  "json_data" jsonb,
  "order" int2,
  "is_delete" int2
);
CREATE INDEX "block_id" ON "public"."luckysheet" USING btree (
  "block_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  "list_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "index" ON "public"."luckysheet" USING btree (
  "index" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  "list_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "is_delete" ON "public"."luckysheet" USING btree (
  "is_delete" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "list_id" ON "public"."luckysheet" USING btree (
  "list_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "order" ON "public"."luckysheet" USING btree (
  "list_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  "order" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "status" ON "public"."luckysheet" USING btree (
  "list_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  "status" "pg_catalog"."int2_ops" ASC NULLS LAST
);
ALTER TABLE "public"."luckysheet" ADD CONSTRAINT "luckysheet_pkey" PRIMARY KEY ("id");

INSERT INTO "public"."luckysheet" VALUES (nextval('luckysheet_id_seq'), 'fblock', '1', '1079500#-8803#7c45f52b7d01486d88bc53cb17dcd2c3', 1, '{"row":84,"name":"Sheet1","chart":[],"color":"","index":"1","order":0,"column":60,"config":{},"status":0,"celldata":[],"ch_width":4748,"rowsplit":[],"rh_height":1790,"scrollTop":0,"scrollLeft":0,"visibledatarow":[],"visibledatacolumn":[],"jfgird_select_save":[],"jfgrid_selection_range":{}}', 0, 0);
INSERT INTO "public"."luckysheet" VALUES (nextval('luckysheet_id_seq'), 'fblock', '2', '1079500#-8803#7c45f52b7d01486d88bc53cb17dcd2c3', 0, '{"row":84,"name":"Sheet2","chart":[],"color":"","index":"2","order":1,"column":60,"config":{},"status":0,"celldata":[],"ch_width":4748,"rowsplit":[],"rh_height":1790,"scrollTop":0,"scrollLeft":0,"visibledatarow":[],"visibledatacolumn":[],"jfgird_select_save":[],"jfgrid_selection_range":{}}', 1, 0);
INSERT INTO "public"."luckysheet" VALUES (nextval('luckysheet_id_seq'), 'fblock', '3', '1079500#-8803#7c45f52b7d01486d88bc53cb17dcd2c3', 0, '{"row":84,"name":"Sheet3","chart":[],"color":"","index":"3","order":2,"column":60,"config":{},"status":0,"celldata":[],"ch_width":4748,"rowsplit":[],"rh_height":1790,"scrollTop":0,"scrollLeft":0,"visibledatarow":[],"visibledatacolumn":[],"jfgird_select_save":[],"jfgrid_selection_range":{}}', 2, 0);
  • docker-compose file
version: "2"
services:

  nginx:
    image: nginx:latest
    #restart: always
    container_name: nginx
    environment:
      - TZ=Asia/Shanghai
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/logs:/var/log/nginx/
      - ./nginx/html:/usr/share/nginx/html/
      - /etc/localtime:/etc/localtime
    networks:
      extnetwork:
        ipv4_address: 172.19.0.101
  
  
  redis:
    image: redis:latest
    container_name: redis
    #restart: always
    environment:
      - TZ=Asia/Shanghai
    command: redis-server /usr/local/etc/redis/redis.conf --requirepass 123456
    ports:
      - "6379:6379"
    volumes:
      - ./redis/data:/usr/local/redis/data/
      - ./redis/logs:/usr/local/redis/
      - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
      - /etc/localtime:/etc/localtime
    networks:
      extnetwork:
        ipv4_address: 172.19.0.2
      

  postgres:
    image: postgres:12
    #restart: always
    privileged: true 
    container_name: postgres 
    ports:
      - 5432:5432
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 123456
      PGDATA: /var/lib/postgresql/data/pgdata
    volumes:
      - ./postgres/data:/var/lib/postgresql/data/pgdata
      - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
      - /etc/localtime:/etc/localtime
    networks:
      extnetwork:
        ipv4_address: 172.19.0.3  
      

  web-server:
    image: java:8
    #restart: always
    privileged: true  
    ports:
      - 9004:9004
    volumes:
      - ./java-server/web-lockysheet-server.jar:/usr/local/luckysheet-server/app.jar
      - ./java-server/application.yml:/usr/local/luckysheet-server/application.yml
      - ./java-server/application-dev.yml:/usr/local/luckysheet-server/application-dev.yml
      - /etc/localtime:/etc/localtime
    command: [
      'java',
      '-Xmx200m',
      '-jar',
      '/usr/local/luckysheet-server/app.jar',
      '--spring.config.location=/usr/local/luckysheet-server/application.yml,/usr/local/luckysheet-server/application-dev.yml'
    ]  
    networks:
      extnetwork:
        ipv4_address: 172.19.0.4

networks:
   extnetwork:
      ipam:
         config:
         - subnet: 172.19.0.0/16
           gateway: 172.19.0.1    
            

Note:

# Enter the container
docker exec -ti [Container ID] /bin/bash
# Enter redis in the container
docker exec -it [Container ID]  redis-cli -a '123456'
# Log in to docker to view logs
docker logs --tail 300 -f [Container ID]
# Set folder permissions
chmod a+rwx [target folder]

Links

Authors and acknowledgment

Team

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 License are reserved by the Original Author.

More Repositories

1

Luckysheet

Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source.
JavaScript
15,833
star
2

univer

Univer is an open-source productivity tool dev kit helping you integrate spreadsheets, docs and slides into your applications.
TypeScript
6,888
star
3

Luckyexcel

Luckysheet import export library
HTML
425
star
4

LuckysheetServer

Luckysheet java backend
Java
421
star
5

luckysheet-vue

luckysheet vue demo
Vue
149
star
6

luckysheet-react

luckysheet react demo
JavaScript
72
star
7

obsidian-univer

Create, edit, and view spreadsheets and documents in various formats like Excel and Word directly within your knowledge base.
TypeScript
72
star
8

PenTool

Pen tool
TypeScript
61
star
9

LuckyBabylon

Babylon.js 3D编辑器
Vue
54
star
10

chartMix

chart plugins for Luckysheet
JavaScript
36
star
11

babylon_doc

Babylon.js文档翻译计划
15
star
12

LuckyResources

Lucky Resources
Batchfile
15
star
13

Luckyexcel-node

Luckyexcel node case
JavaScript
14
star
14

univer.ai

Documentation for Univer
TypeScript
9
star
15

LuckysheetDemo

Luckysheet Demo Project
HTML
8
star
16

univer-icons

Icons used by Univer
TypeScript
6
star
17

univer-demo

Univer Demo
HTML
5
star
18

LuckysheetDocs

Luckysheet文档
HTML
5
star
19

LuckyBabylonDemo

LuckyBabylon Demo
HTML
5
star
20

luckysheetPluginPrint

JavaScript
3
star
21

LuckyexcelDemo

Luckyexcel Demo
JavaScript
3
star
22

Luckysheet-rfcs

RFCs for substantial changes / feature additions to Luckysheet
2
star
23

Learn-Luckysheet

Luckysheet tutorials, blogs, materials, resources
2
star
24

helm-charts

Deployments for Univer Servers
Smarty
2
star
25

univer-plugins

A collection of plugins for Univer
TypeScript
2
star
26

cli

Command-line tool for quickly creating univer plugins.
TypeScript
1
star
27

univer-collaboration

univer collaboration front
JavaScript
1
star
28

univer-examples

Univer Demos
TypeScript
1
star