Browse Source

refactor(scripts): remove unnecessary files

pull/4237/head
Wing-Kam Wong 2 years ago
parent
commit
c5be5ec13d
  1. 0
      scripts/BACKERS.md
  2. 1
      scripts/diagrams/architecture-lt.drawio
  3. 1
      scripts/diagrams/architecture.drawio
  4. 1
      scripts/diagrams/overview.drawio
  5. 2
      scripts/diagrams/overview.xml
  6. 93
      scripts/metaSync/queries.md
  7. 22
      scripts/misc/jsdoc.json
  8. 189
      scripts/setups/TrueNAS/README.md
  9. 0
      scripts/templates/0001.json

0
scripts/BACKERS.md

1
scripts/diagrams/architecture-lt.drawio

File diff suppressed because one or more lines are too long

1
scripts/diagrams/architecture.drawio

@ -1 +0,0 @@
<mxfile host="Electron" modified="2021-07-14T13:20:03.334Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.9.3 Chrome/80.0.3987.158 Electron/8.2.0 Safari/537.36" etag="3eFb5NTYOIAgzQMoGIyL" version="12.9.3" type="device"><diagram id="p7AUMbp67osUxDllEml3" name="Page-1">1VhLk5s4EP41rsoelkJIYDgOfiSHTGq2prZms5eUAA1WDUaOkF/59SsBAvEY27txvDP4YNRSN1J/n1rdmsDZ+vCR483qniUkmzh2cpjA+cRxAAS+/FOSYyXxPVQJUk6TelAreKQ/SC20a+mWJqToDBSMZYJuusKY5TmJRUeGOWf77rBnlnW/usEpGQgeY5wNpU80Eat6Fc60lX8iNF3pLwMvqHrWWA+uV1KscML2hgguJnDGGRPV2/owI5lynvZLpbd8pbeZGCe5uEQhfnr4nnz+++UPMsf30Z0I/nxKf3cqKzucbesFTxwvk/bCSL6k6uULi9k8bMRcyx8J3xGu5fK7jUa9XnHUTuRsmydEzQPI7v2KCvK4wbHq3UvaSNlKrLO6+5lm2YxljJe6EEQYEOmssBCcvRCjx7a9xd1SabBcGPLn8mnmIScpyOFVp4EGCslhwtZE8KMcUisg5FUqNX2hRnPfkgFo2cogwrSW4Zp/aWO6hUi+1Cj9C8TAGGQ9f5M8uVPcl604w0VB49J/mIuh2PC89Ak//iUbtuXq5lezb668Yjeto24dqDDUZOur0dMqqYbWGaDp2+rXoEaSwb7sYSYDAeYpEefYPcTWwM4dgU7LOMmwoLvuNMbwrL/wwKicYEMd1+5Sx/V6lCjYlsek1jI3bs8QQnbHEHJ6hio/DAyV9GqW/ROMgzdgnMk3g35nGRcEHc5ZruOf5J1qPBBOpVMIvyIXKzBPeBF674G0wOtyDbquZRtPz+ClFJaxumf2xhRGv4zCNyGPcyF30Cun2Y0intOLeP5/jHiu7cqN3T5+xyyYAgu5Bindm3IJ2ue5tFEfJ3yxk0gXmig6/1PcSHCxKhMi+xSbcpaTYUaEIEJIRT1cbKqU95kelLEwwxHJHlhBBWW5IizJyygXqhyIyqT2c29AxIRga2PAXUZT1SGYyspw3WrssK3IaC7np5Ntu1rYRq17fUhVDWDtdom1J9G3SGXfpdo1EjHXs6bj56lB7sC33OCGyRh0z3PBQPcsDAOHl4iGOH5Jyxx6LMsdh64iki5ZRvPn5dKXm+ckM/vQUlZMLSprrcJKsMBXghYGlmNud7eLMxjADHQ8N0EGdmCdCFk/h7P3jnGGMAiWy/8fZ+B247gTTN8AssEIsr0KWAtUnVleNWjXet+3rBoAUaJ+pqiunmffyuIZrxVaeVRsDINtMf0Bv2Bp+h4Xig+OPZdej3BBfjPq6+rz3SmdLLslVKJ7vAx4dw1YnV55AqbWyJYNRvIO+KviMho7o6+I6uIg3ZdjNY8hlhq74u1jNzxVgT9ywXFb7MA7jrVv5kxFfieDDlAH5ZHU6eaRF11w9xjWKeSVdkwf1jVNEqUeclLQHzgqTSmMyvy9XLAbTty5srUVklvl7TS4EkTTbrXkITQAxRvZeP3bnwsAkc32nrmqg9rberj4Bw==</diagram></mxfile>

1
scripts/diagrams/overview.drawio

File diff suppressed because one or more lines are too long

2
scripts/diagrams/overview.xml

File diff suppressed because one or more lines are too long

93
scripts/metaSync/queries.md

@ -1,93 +0,0 @@
### Init
```sql
CREATE TABLE `table_col_delete` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `table_to_col_add` (
`id` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `table_to_rel_add_child` (
`id` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `table_to_rel_add_parent` (
`id` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `table_to_rel_remove_parent` (
`id` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `table_to_rel_remove_child` (
`id` int NOT NULL AUTO_INCREMENT,
`table_to_rel_remove_parent_id` int DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `table_to_rel_remove_parent_fk_idx` (`table_to_rel_remove_parent_id`),
CONSTRAINT `table_to_rel_remove_parent_fk` FOREIGN KEY (`table_to_rel_remove_parent_id`) REFERENCES `table_to_rel_remove_parent` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `table_to_remove` (
`id` int NOT NULL AUTO_INCREMENT,
`table_to_removecol` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
```
## Col delete
```sql
ALTER TABLE `table_col_delete`
DROP COLUMN `title`;
```
## Rel delete
```sql
ALTER TABLE `table_to_rel_remove_child`
DROP FOREIGN KEY `table_to_rel_remove_parent_fk`;
ALTER TABLE `table_to_rel_remove_child`
DROP COLUMN `table_to_rel_remove_parent_id`,
DROP INDEX `table_to_rel_remove_parent_fk_idx` ;
```
## table delete
```sql
DROP TABLE `table_to_remove`;`
```
## column add
```sql
ALTER TABLE `table_to_col_add`
ADD COLUMN `new_col_1` VARCHAR(45) NULL AFTER `new_col`;
```
## Add rel
```sql
ALTER TABLE `table_to_rel_add_child`
ADD COLUMN `parent_id` INT NULL AFTER `id`,
ADD INDEX `_p_fk_idx` (`parent_id` ASC) VISIBLE;
;
ALTER TABLE `table_to_rel_add_child`
ADD CONSTRAINT `_p_fk`
FOREIGN KEY (`parent_id`)
REFERENCES `table_to_rel_add_parent` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
```

22
scripts/misc/jsdoc.json

@ -1,22 +0,0 @@
{
"tags": {
"allowUnknownTags": false
},
"source": {
"include": "./lib/SqlMigrator/lib",
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": ["plugins/markdown"],
"opts": {
"template": "node_modules/minami",
"encoding": "utf8",
"destination": "docs/",
"recurse": true,
"verbose": true
},
"templates": {
"cleverLinks": false,
"monospaceLinks": false
}
}

189
scripts/setups/TrueNAS/README.md

@ -1,189 +0,0 @@
# Installing NocoDB in FreeBSD/FreeNAS/TrueNAS jail
> As provided by [Zamana](https://github.com/Zamana) [here](https://gist.github.com/Zamana/e9281d736f9e9ce5882c6f4b140a590e)
First of all, make sure to refer and understand the general instructions in the official **NocoDB** site:
https://docs.nocodb.com/getting-started/installation
What you'll find here are the specific instructions to setup **NocoDB** in a FreeBSD system, or in a FreeNAS/TrueNAS CORE jail.
This was originally done in a TrueNAS CORE 12.0-U5.1, which uses FreeBSD 12.4-RELEASE-p6 as base system.
## 0. Adjust your date/time (if necessary).
In my specific case it is.
```
# rm /etc/localtime
# ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
```
## 1. Update your packages:
```
# pkg update
# pkg upgrade
```
## 2. Create the user 'nocodb'
and set its home folder to '/usr/local/share/nocodb', that's where the application will be saved:
```
# pw add user nocodb -d /usr/local/share/nocodb
```
## 3. Install the packages
'git' and 'npm', and optionaly the database(s) you intend to use. By default **NocoDB** uses sqlite3:
```
# pkg install git npm postgresql14-server postgresql14-client
```
## 4. Clone the repository:
Go to the 'nocodb' home folder, clone the repository, and grant the access:
```
# cd /usr/local/share/nocodb
# git clone https://github.com/nocodb/nocodb-seed
# chown -R nocodb:nocodb nocodb-seed
```
## 5. Install the whole shebang
Enter in the folder just created and run the 'install' command:
```
# cd nocodb-seed
# npm install
```
If everything ran fine, you are ready to run the app, but hold on, because you'll need to make the FreeBSD setup.
## 6. Folder for the PID
Create a folder to save the PID file for the process, and grant the access:
```
# mkdir /var/run/nocodb/
# chown -R nocodb:nocodb /var/run/nocodb
```
## 7. Init script
Save this file with the name **nocodb** at '/usr/local/etc/rc.d':
```
#!/bin/sh
#
# Author: C. R. Zamana (czamana at gmail dot com)
#
# PROVIDE: nocodb
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="nocodb"
rcvar="${name}_enable"
load_rc_config ${name}
: ${nocodb_enable:="NO"}
: ${nocodb_user:="nocodb"}
pidfile="/var/run/nocodb/nocodb.pid"
start_precmd="nocodb_precmd"
PATH=$PATH:/usr/local/bin
nocodb_precmd() {
cd $(getent passwd ${nocodb_user} | cut -d\: -f6)
cd nocodb-seed
}
command="/usr/sbin/daemon"
command_args="-P ${pidfile} /usr/local/bin/npm start > /dev/null"
run_rc_command "$1"
```
and grant the execution permissions:
```
# chmod +x /usr/local/etc/rc.d/nocodb
```
## 8. Run at boot
Configure the service to run automagically at system/jail boot:
```
# sysrc nocodb_enable=YES
```
From now on you can control the service with:
```
# service nocodb start | stop | status
```
but first is necessary to change the IP where **NocoDB** listens. That's because it came by default listening at **localhost** only, which is not pratical if you need to access the app from outside the server, what's generally true.
For this, edit the file **.env** and add a definition for the variable **HOST** pointing to your IP or more generally to **0.0.0.0**, so **NocoDB** will listen on every interface available. For example:
```
# vi /usr/local/share/nocodb/nocodb-seed/.env
```
and set **HOST** to your desired IP:
```
HOST=192.168.0.101
```
## 9. Change 'index.js'
Now edit the file 'usr/local/share/nocodb/nocodb-seed/index.js', and change the line with **localhost** to **${process.env.HOST}**. At the end you want your **index.js** file to looks like this:
```
(async () => {
const app = require('express')();
const {Noco} = require("nocodb");
app.use(await Noco.init({}));
console.log(`Visit : ${process.env.HOST}:${process.env.PORT}/dashboard`)
app.listen(process.env.PORT);
})()
```
## 10. Start the service:
```
# service start nocodb
```
and make sure that it is running and listening at port 8080:
```
# service status nocodb
nocodb is running as pid 60058. <<-- your PID will be different...
# netstat -an | grep -iw listen
tcp46 0 0 *.8080 *.* LISTEN <<<---- here it is
tcp46 0 0 *.8083 *.* LISTEN
tcp4 0 0 127.0.0.1.5432 *.* LISTEN
tcp6 0 0 ::1.5432 *.* LISTEN
```
Now the service should be accessible through your browser:
```
http://<jail|freebsd IP>:8080
```
Congratulations!
## 11. Update/Upgrade
In order to update/upgrade the app, execute:
```
# service nocodb stop
# cd /usr/local/share/nocodb/nocodb-seed
# git pull
# npm uninstall nocodb
# npm install --save nocodb
# service nocodb start
```
> Feel free to point out any mistakes I made, including misspellings, typos and grammar errors.

0
scripts/templates/0001.json

Loading…
Cancel
Save