https://github.com/electrified/notes
https://github.com/electrified/notes
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/electrified/notes
- Owner: electrified
- License: mit
- Created: 2017-02-13T22:24:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T03:13:05.000Z (over 3 years ago)
- Last Synced: 2024-04-15T07:27:03.152Z (about 2 years ago)
- Language: JavaScript
- Size: 3.09 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Notes - a node.js blog engine
Yet another blog engine
[](https://circleci.com/gh/electrified/notes)
## Prerequisites
* Node.js
* PostgreSQL
* Docker (optional)
## Installation with docker (Recommended)
1. Fetch docker-compose.* files from repository `wget https://raw.githubusercontent.com/electrified/notes/master/docker-compose.yml && wget https://raw.githubusercontent.com/electrified/notes/master/docker-compose.example.yml`
2. Copy `docker-compose.example.yml` to `docker-compose.prod.yml` Adjust database passwords and config as necessary
3. Ensure latest images downloaded `docker-compose pull` (only if has been run before)
4. Start the containers `docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d`
5. Run database migrations `docker exec notes_web_1 npm run migrate`
6. Add an admin user `docker exec -i notes_web_1 npm run createUser`
### Dumping the database
`docker exec notes_database_1 pg_dump -U notes notes > db.sql`
### Restoring the database
`docker exec -i notes_database_1 psql -U notes notes < db.sql`
### Querying the database
`docker exec -it notes_database_1 psql -U notes notes`
## Installation without using Docker
1. Clone this repo into e.g. `/srv/http/notes/`
1. Install dependencies `npm install --python=/usr/bin/python2`
2. Symlink systemd service file
`ln -s /srv/http/notes/notes.service /etc/systemd/system`
3. Install postgres and initdb
`su - postgres -c "initdb --locale en_GB.UTF-8 -D '/var/lib/postgres/data'"``
4. Create postgres database
`su - postgres
createuser notes -P
createdb -O notes notes`
5. configure connection strings in
`config.(development|production).json`
6. Run db migration to create schema
`npm run migrate`
7. Create an admin user
`export NODE_ENV=production
npm run createUser`
8. Enable the service `systemctl enable notes`
9. Start the service `systemctl start notes`
## Running
Supported environment variables
* DB_USER
* DB_PASSWORD
* DB_DATABASE
* DB_HOST
* ASSETS_DIR
Log into admin area
`/admin`
Create first post!
## TODO
* Improve 404 & 500 pages
* Check all promises usage, use promises instead of callbacks
* write tests
* check dependency versions
* Darker UI?
* Express error handling middleware to remove more boilerplate
* Stop using Facebook's fixed-data-tables as they are unmaintained?
* Fix window title on admin pages, make it use configured site title
* Cache invalidation when changing published status
* Fix HMR
* Fix `Warning: connect.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process.`
* Init db with GB locale
* Standardise log format output
* How to perform clean shutdown
* Make session key not hardcoded
* Don't use HMR when in production, prebuild assets