introduce

Showdoc is an online API documentation, technical documentation tool perfect for IT teams. You can use Showdoc to write online API documentation, technical documentation, data dictionaries, and online manuals. For more information about Showdoc, see www.showdoc.cc/help

A good data dictionary document can clearly reflect the structure of the database and relevant definitions, convenient for technical personnel to refer to. Showdoc makes it easy to generate dictionary documents that show the structure of the database and automatically modify the documents as the structure changes, eliminating the need for manual editing.

The automation of all of this relies on our reporting scripts. You will need to download our script to your server for execution and upload the database structure information to Showdoc. The source code of the report script is fully open and you can read it to confirm security. We made sure that it uploaded only basic database structure information and did not upload sensitive information such as database password configuration, business data, etc.

Currently, only mysql databases under Linux are supported. More types will be considered in the future.

steps

  • Execute the command to download the script
wget https://www.showdoc.cc/script/showdoc_db.sh 
Copy the code
  • Open this file
vi showdoc_db.sh
Copy the code
  • Modifying configuration Information After opening the file, you can see several configurations in the front of the file. Among them, information like database configuration, API_key and so on need you to fill in, after filling in can save. The following lists the meanings of each configuration item.
Host: indicates the address of the database. The default value is localhost port. The default value is 3306. User: indicates the database user name. To synchronize multiple db can be more copies of the script | api_key: authentication credentials. Log in to Showdoc, after creating a project, click "Project Settings" - "Open API" in the upper right corner to see api_token: same as above cat_name: Optional. If you want to place all generated documents in a subdirectory of your project, fill in the subdirectory name here. Url: Optional. Url to synchronize to. If you use www.showdoc.cc, you do not need to change this item. If it is deployed showdoc open source version, please change this to http://xx.com/server/index.php?s=/api/open/updateDbItem. The domain name | xx.com for your deploymentCopy the code
  • perform
sh showdoc_db.sh 

Copy the code

See the word success is ok. You can open the Showdoc project to see if it’s actually generated.

If automatic updates are required, you need to add a scheduled task to the system. The following is an example of synchronization every 10 minutes

/10 * * * * /bin/sh /root/showdoc_db.sh
Copy the code

The showdoc_db.sh script needs to write an absolute path in the scheduled task.

Matters needing attention

If you set up automatic execution of the script, do not manually log in to Showdoc to modify the document. Because your changes are automatically overwritten. Because it overwrites your changes. So if you want to set Chinese comments for a field, please modify the mysql field comments instead of manually editing the document on Showdoc. In this case, documents are automatically added and modified, but not deleted (mainly for data security). So, if you delete a table, that page will not be deleted from the document. You need to manually log in to Showdoc to delete it. Generally speaking, this is not a lot.