docker making process of mindoc online document interface system

Keywords: Go MySQL Database Redis github

Note: Mindoc is an online interface document editing system, Baidu will know it in a moment.GitHub address: https://github.com/lifei6671/mindoc

Native machine: ubuntu16.04 + dockerCE2017.12 + mysql5.7 + git2.7.4

Since mirroring with dockerfile requires jumping to the Goldang.org website, you know it.I built it using a foreign VPS

1 git clone code, execute the following command in an empty folder

git clone https://github.com/lifei6671/mindoc.git

Wait for completion.

2 Set up before mirroring

Enter the mindoc directory,

cd mindoc

Add Profile to Configuration Directory

# create a file
touch conf/app.conf

# Add the following to the profile
appname = godoc
# httpaddr = 127.0.0.1
httpport = 8181
runmode = dev
sessionon = true
sessionname = mindoc_id
copyrequestbody = true

#Default Session Generates Key
beegoserversessionkey=123456

########Session Storage method##############
#Store as file
sessionprovider=file
sessionproviderconfig=./logs
#Store as redis
#sessionprovider=redis
#sessionproviderconfig=127.0.0.1:6379
#Stored as memcache
#sessionprovider=memcache
#sessionproviderconfig=127.0.0.1:11211
#Managed Session in Memory
#sessionprovider=memory

#time zone
timezone = Asia/Shanghai

####################MySQL Database Configuration###########################
#Both MySQL and sqlite3 databases are supported, and db_database identifies the physical directory of the database if it is sqlite3
db_adapter=mysql
db_host=127.0.0.1
db_port=3306
db_database=mindoc_db
db_username=root
db_password=123456

####################sqlite3 Database Configuration###########################
#db_adapter=sqlite3
#db_database=./database/mindoc.db

#Project Default Cover
cover=/static/images/book.jpg

#Default Avatar
avatar=/static/images/headimgurl.jpg

#Default reading token length
token_size=12

#Suffix for uploading files,If you do not restrict the suffix, you can set it to *
upload_file_ext=txt|doc|docx|xls|xlsx|ppt|pptx|pdf|7z|rar|jpg|jpeg|png|gif
#Upload file size limit, if not filled in, default unlimited, units can be GB KB MB
upload_file_size=100MB

####################Mail Configuration######################
#Is mail enabled
enable_mail=false
#Limit the number of mailbox mails sent per hour
mail_number=5
#smtp service user name
smtp_user_name=admin@iminho.me
#smtp server address
smtp_host=smtp.163.com
#smtp password
smtp_password=
#Port number
smtp_port=25
#Display name for sending mail
form_user_name=admin@iminho.me
#Mail valid for 30 minutes
mail_expired=30
#Encryption Type NONE No Authentication, SSL Encryption, LOGIN Ordinary User Login
secure=LOGIN

###############To configure PDF Generate Tool Address###################
#wkhtmltopdf=D:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe

###############To configure CDN accelerate##################
cdn=
cdnjs=
cdncss=
cdnimg=

################Baidu Map Key#################
baidumapkey=

################Active Directory/LDAP################
#Is ldap enabled
ldap_enable=false
#ldap host name
ldap_host=ad.example.com
#ldap port
ldap_port=3268
#Which attribute in ldap is the user name
ldap_attribute=sAMAccountName
#Search Scope
ldap_base=DC=example,DC=com
#First binding ldap user dn
ldap_user=CN=ldap helper,OU=example.com,DC=example,DC=com
#First binding ldap user password
ldap_password=superSecret
#Automatically register user roles:0 Super Administrator /1 Administrators/ 2 Ordinary user 
ldap_user_role=2
#ldap search filter rule,AD The server: objectClass=User, openldap The server: objectClass=posixAccount ,It can also be defined as other attributes,as: title=mindoc
ldap_filter=objectClass=posixAccount


######################Cache Configuration###############################
#Whether to turn on caching,true open/false Do not open
cache=false
#Cache Method:memory/memcache/redis/file
cache_provider=memory
#Memory recycling time in seconds when the configuration cache is memory
cache_memory_interval=120
#Cached storage directory when cache mode is configured as file
cache_file_path=./runtime/cache/
#Cached file suffix
cache_file_suffix=.bin
#File Cache Directory Level
cache_file_dir_level=2
#Default expiration time for file cache
cache_file_expiry=3600
#memcache cache server address
cache_memcache_host=127.0.0.1:11211
#redis server address
cache_redis_host=127.0.0.1:6379
#redis database index
cache_redis_db=0
#redis server password
cache_redis_password=

 

Where the database configuration section is configured according to the specific situation

 

3Modify Dockerfile to remove Ali Cloud mirror source (depending on the specific situation, I use foreign VPS, it is faster to use official mirror directly)

 

4 Create a mindoc_db database in the database using the following commands

CREATE DATABASE mindoc_db  DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;

Description: The database parameter max_allowed_packet needs to be set fairly large. You can restart the database by modifying the configuration file my.ini or my.conf.I use

mysql image, do not know how to make customized configuration image, just based on the official mysql image and make modifications.Dockerfile is as follows

FROM mysql:5.7
RUN rm -rf /etc/mysql
RUN mkdir /etc/mysql
COPY my.conf /etc/mysql/

CMD ["mysqld", "--character-set-server=utf8", "--collation-server=utf8_unicode_ci","--max-allowed-packet=104857600"]

Set max_allowed_packet = 100M

My my.conf configuration file is as follows

# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
[client]

# pipe
# socket=0.0
port=3306


[mysql]
default-character-set=utf8


# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
# server_type=3
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
max_allowed_packet = 104857600
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8

pid-file    = /var/run/mysqld/mysqld.pid
socket        = /var/run/mysqld/mysqld.sock
datadir        = /var/lib/mysql
#log-error    = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address    = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

 

 

5 for mirror building

docker build . -t mindoc

It may take a while, depending on your personal network speed.There's a warning in between that doesn't care about him.The mindoc image was built successfully at the end

 

6 After the mirror is made, it can be started for verification.

docker run -p 8181:8181 -d --name=mindoc mindoc:0.9

Enter localhost:8181/in your browser to see the login page

 

The default program automatically initializes a super administrator user: admin password: 123456.Please login and reset your password.The login interface is as follows

 

 

Note that due to the stringent sql_model settings of the latest mysql, you need to manually configure SQL_MODE to disable full_group checking, change the MySQL configuration file, or run the following SQL statement to modify SQL_MODE:

SET @@global.sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION';

Posted by tHud on Fri, 17 May 2019 21:31:59 -0700