diff --git a/Dockerfile b/Dockerfile index bebe5d5..7a11907 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,20 @@ # jeffery russell 12-17-2020 - FROM node:buster-slim WORKDIR /src/ # installs node dependencies -RUN npm install + ADD package.json package.json +RUN npm install -# installs pandoc +# installs pandoc for markdown to html +# need git so admin page can pull blog updates RUN apt-get update && \ - apt-get install pandoc -y + apt-get install pandoc -y && \ + apt-get install git -y # exposes port application runs on EXPOSE 8000 diff --git a/README.md b/README.md index e1281be..f43293e 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,30 @@ because you can't run a node application as port 80 unless you are root, which w security vulnerability. + +### Running with Docker + +To simplify development and deployment you can run the entire node blog and mysql server from docker using docker-compose. + + +```bash +docker-compose up +``` + +or + +```bash +docker-compose up db +docker-compose up blog +``` + +To Access mysql server of docker daemon for maintenence. Note: you need to configure username and password in docker-compose.yml and config.json. + +```bash +mysql --port=3306 --host=127.0.0.1 -u root --password=password +``` + + ## Legal **Unless otherwise stated**, everything in this repository can be @@ -146,4 +170,20 @@ I simply want the project site to be accessible under https://jrtechs.net/projec ### State Diagram of Plan -![diagram](docs/projectsSites.svg) \ No newline at end of file +![diagram](docs/projectsSites.svg) + + +# DB Backup and Restore + +This will dump everything in the database to a plain text file. A base SQL schema can be found in docs//sqlConfig.md + +``` +sudo mysqldump -u [user] -p [database_name] > [filename].sql +``` + +This will take a database dump and load it into a active mysql instance. +Note: the database (can be empty) must already exist. + +``` +sudo mysql -u [user] -p [database_name] < [filename].sql +``` \ No newline at end of file