Sign inSign up

yuguanpei/code-easier

By yuguanpei

•Updated about 1 month ago

CodeEasier

Image
API management
Web servers
Databases & storage
0

2.7K

yuguanpei/code-easier repository overview

⁠CodeEasier

⁠mysql/conf/mysql.conf

[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
skip-host-cache
skip-name-resolve

⁠mysql/init/init.sql

CREATE DATABASE IF NOT EXISTS code_easier;

USE mysql;
GRANT SELECT, INSERT, UPDATE, CREATE, LOCK TABLES, DROP, ALTER, ALTER ROUTINE, REFERENCES ON code_easier.* TO 'admin'@'%';
FLUSH PRIVILEGES;

⁠nginx/conf/default.conf

server {
    listen 80;

    charset utf-8;
    # client_max_body_size 10m;
    
    location / {
        proxy_pass http://codeasier:3000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    
    # listen 443 ssl;
    # server_name xxx;

    # ssl_certificate cert/xxx.pem;
    # ssl_certificate_key cert/xxx.key;
    # ssl_session_timeout 5m;
    # ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    # ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    # ssl_prefer_server_ciphers on;

    # location / {
    #     root /usr/share/nginx/html;
    #     index index.html index.htm;
    # }

    # location /...subpath/ {
    #     proxy_pass http://codeasier:3000/;
    #     proxy_http_version 1.1;
    #     proxy_set_header Upgrade $http_upgrade;
    #     proxy_set_header Connection "upgrade";
    #     proxy_set_header Host $host;
    #     proxy_set_header X-Real-IP $remote_addr;
    #     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    # }
}

⁠redis/conf/redis.conf

...
# IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatibility
# layer on top of the new ACL system. The option effect will be just setting
# the password for the default user. Clients will still authenticate using
# AUTH <password> as usually, or more explicitly with AUTH default <password>
# if they follow the new protocol: both will work.
#
# The requirepass is not compatible with aclfile option and the ACL LOAD
# command, these will cause requirepass to be ignored.
#
requirepass code_easier

...

⁠.env

BASE_URL=/

PUBLIC_KEY=2BfxrU7pcZJgoTHm
PRIVATE_KEY=ZWVuTmFtZSI6IumxvOWFiOeUnyIsImNy

MYSQL_HOST=mysql
MYSQL_PORT=3306
MYSQL_USERNAME=admin
MYSQL_PASSWORD=admin
MYSQL_DATABASE=code_easier
MYSQL_SCHEMA=

REDIS_HOST=redis
REDIS_PORT=6379
REDIS_USERNAME=default
REDIS_PASSWORD=code_easier
REDIS_DB=0

⁠docker-compose.yml

services:
  codeasier:
    image: yuguanpei/code-easier:latest
    restart: always
    environment:
      - TZ=Asia/Shanghai
      - BASE_URL=${BASE_URL}
      - MYSQL_HOST=${MYSQL_HOST}
      - MYSQL_PORT=${MYSQL_PORT}
      - MYSQL_USERNAME=${MYSQL_USERNAME}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_SCHEMA=${MYSQL_SCHEMA}
      - REDIS_HOST=${REDIS_HOST}
      - REDIS_PORT=${REDIS_PORT}
      - REDIS_USERNAME=${REDIS_USERNAME}
      - REDIS_PASSWORD=${REDIS_PASSWORD}
      - REDIS_DB=${REDIS_DB}
    # ports:
    #   - 3000:3000
    volumes:
      - ./.env:/app/.env.production
      - ./data/client:/app/public/client
      - ./data/uploads:/app/public/uploads
      - ./data/scripts:/app/scripts
      - ./data/logs:/app/logs
    depends_on:
      - mysql
      - redis

  mysql:
    image: mysql:8.0.31
    restart: always
    environment:
      - TZ=Asia/Shanghai
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USERNAME}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    ports:
      - 3306:3306
    volumes:
      - ./mysql/conf:/etc/mysql/conf.d
      - ./mysql/data:/var/lib/mysql
      - ./mysql/init:/docker-entrypoint-initdb.d
    command: --default-authentication-plugin=mysql_native_password

  redis:
    image: redis:7.0.4
    restart: always
    environment:
      - TZ=Asia/Shanghai
    ports:
      - 6379:6379
    volumes:
      - ./redis/conf:/etc/redis/conf
      - ./redis/data:/data
    command: redis-server /etc/redis/conf/redis.conf

  nginx:
    image: nginx:1.27.0
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx/conf:/etc/nginx/conf.d
      # - ./nginx/cert:/etc/nginx/cert
      # - ./data/client:/usr/share/nginx/html

Tag summary

Content type

Image

Digest

sha256:95c4317c5…

Size

104.4 MB

Last updated

about 1 month ago

docker pull yuguanpei/code-easier