A blog use Node.js,lowdb and deployed with docker.Occupies less resources and simple.
- docker
- docker>=17.0-ce
- docker-compose>=1.6
- Node.js
- node>=16
- npm>=8
If you want to deploy automatically, you could refer to my CI/CD
Using the environment variables to configure the service.
ADMIN_USER: // the username to login the blog administrator beckend
ADMIN_PWD: // the password to login the blog, use the `MD5` string
COOKIE_SECRET:
SESSION_SECRET:
MAIL_HOST: // error mail host
MAIL_USER: // error mail user
MAIL_PASS: // error mail password
MAIL_FROM: // error mail from
MAIL_TO: // error mail to notify `receiver`
GOOGLE_ANALYTICS: // use google analytics or not, boolean type, default `false`
GOOGLE_ANALYTICS_ID: // if use google analytics, set the gid, such as `UA-152095536-1`
DISQUS: // use disqus comment or not, boolean type, default `false`
DISQUS_NAME: // if use disqus comment, set the name, such as `reply2future-pw`
# for rss feed https://www.npmjs.com/package/rss to find more details
RSS_SITE_URL: // your website name like https://blog.reply2future.pw
RSS_TITLE: // for rss feed title
RSS_DESCRIPTION: // for rss feed description
RSS_WEB_MASTER: // optional
RSS_COPYRIGHT: // optional
RSS_LANGUAGE: // optional
There are two ways to deploy the service: npm command
and docker-compose
.
- Set the environment variable
- Run below command on the root of project.
npm start
- Rename the file
docker-compose.yml.template
todocker-compose.yml
- Build your image and push it to the image registry, and you could refer to the command
npm run build-img:linux
ofpackage.json
. - Replace the environment variable of
docker-compose.yml
, such as${ADMIN_USER}
, and you could useenvsubst
command to do it quckily. - Run below command on the same directory of the
docker-compose.yml
.
docker-compose up -d
All done! Check http://localhost:3000
Create your db directory to store your data,and see docker-compose.yml volumes settings.
npm test