DB init and load

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-01-15 16:56:26 -08:00
parent 15945e5004
commit 3951ea706f
4 changed files with 62 additions and 7 deletions

42
README.md Normal file
View File

@ -0,0 +1,42 @@
### Create `photos` user for DB
You will need to know the root password for your mariadb installation. If you
need to reset the root password, you can perform the following:
```bash
export PASSWORD=m4g1cP4ssw0rd
sudo service mysql stop
sudo mysqld_safe --skip-grant-tables &
sleep 1 # mysqld_safe can take a bit of time to come online
sudo mysql << EOF
use mysql;
UPDATE user SET PASSWORD=PASSWORD("${PASSWORD}") WHERE USER='root';
UPDATE user SET plugin='mysql_native_password' WHERE USER='root';
FLUSH PRIVILEGES;
QUIT
EOF
sudo service mysql stop
sudo service mysql start
```
Once you know the root password, you can then create a new user and DB
for the photo app via:
### Create the USER
```bash
U=photos
P=p4$$w0rd
mysql -u root --password=${PASSWORD} << EOF
GRANT ALL PRIVILEGES ON *.* TO '${U}'@'localhost' IDENTIFIED BY '${P}';
EOF
```
```bash
D=photos
mysql -u ${U} --password=${P} << EOF
DROP DATABASE IF EXISTS ${D};
CREATE DATABASE ${D} CHARACTER SET utf8 COLLATE utf8_general_ci;
EOF
```

View File

@ -1,3 +1,11 @@
{ {
"picturesPath": "./pictures" "db": {
"host": "mysql://photos:p4$$w0rd@localhost/photos",
"options": {}
},
"server": {
"port": 8080
},
"picturesPath": "./pictures",
"basePath": "/photos"
} }

View File

@ -40,7 +40,7 @@
"paper-dialog": "PolymerElements/paper-dialog#^1.1.0", "paper-dialog": "PolymerElements/paper-dialog#^1.1.0",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.1.5", "paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.1.5",
"iron-collapse": "PolymerElements/iron-collapse#^1.2.1", "iron-collapse": "PolymerElements/iron-collapse#^1.2.1",
"paper-spinner": "PolymerElements/paper-spinner#^1.0.0", "paper-spinner": "PolymerElements/paper-spinner#^2.0.0",
"paper-autocomplete": "^1.3.0", "paper-autocomplete": "^1.3.0",
"iron-accordions": "https://github.com/alijaya/iron-accordions.git#^1.1.0", "iron-accordions": "https://github.com/alijaya/iron-accordions.git#^1.1.0",
"paper-input": "PolymerElements/paper-input#^1.1.20", "paper-input": "PolymerElements/paper-input#^1.1.20",
@ -52,6 +52,7 @@
"resolutions": { "resolutions": {
"polymer": "^1.4.0", "polymer": "^1.4.0",
"iron-location": "^1.0.0", "iron-location": "^1.0.0",
"iron-collapse": "^1.2.1" "iron-collapse": "^1.2.1",
"paper-spinner": "^1.0.0"
} }
} }

View File

@ -16,12 +16,16 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
"body-parser": "^1.17.2", "body-parser": "^1.18.2",
"config": "^1.28.1", "config": "^1.28.1",
"express": "^4.15.2", "cookie-parser": "^1.4.3",
"morgan": "^1.8.1", "express": "^4.16.2",
"mariasql": "^0.2.6",
"morgan": "^1.9.0",
"mysql2": "^1.5.1",
"node-inspector": "^1.1.1", "node-inspector": "^1.1.1",
"sequelize": "^4.28.6" "sequelize": "^4.28.6",
"sequelize-mysql": "^1.7.0"
}, },
"jshintConfig": { "jshintConfig": {
"undef": true, "undef": true,