- docker
- docker-compose
- nodejs >= 8.x
npm install # install dependencies (first time)
npm run setup # creates directories (once only)
vim ./data/config/config.js # put your email in .authorizedEmail and edit any other setting
npm run build:all # builds everything
npm run docker:db # starts database (doesnt run detached)
npm run docker:web # starts app (doesnt run detached)A more detailed explanation of the setup is desribed in the Running section.
Important: You can leave the current google oauth config for testing, but it will be important that you create your own app if you switch to production. See the Google OAuth section.
Note: when you make changes, rebuild the app with npm run build:all.
.
├── bin/www -- starts the application
├── client -- all front-end files are here
│ ├── build -- autogenerated. Is copied at /public on `npm run build`
│ │ └── static
│ │ ├── css
│ │ ├── js
│ │ └── media
│ ├── public
│ └── src
│ ├── actions
│ ├── assets
│ ├── components
│ ├── constants
│ ├── containers
│ ├── reducers
│ ├── routes
│ ├── store
│ ├── styles
│ └── utils
├── config/config.js -- development configuration file
├── data -- where data is stored
│ ├── db -- This folder is mounted as a volume in the image, for DB files
│ └── files -- Mounted as well, but here are stored the user-uploaded files
├── helpers -- general purpose utils
├── models -- models for interacting with the database
├── public -- autogenerated public files
│ ├── static
│ | ├── css
│ | ├── js
│ | └── media
| └── index.html
├── routes/ -- contains API routes
└── app.js -- backend app entry point
The first time, run:
npm install
npm run setup
# Then, modify ./data/config/config.js as you needThen, let these 3 commands run in separate terminals:
npm run docker:dev
cd client && npm run watch-css
cd client && npm start # runs webpack-dev-servernpm run build:all
# The command above runs the two below
npm run build:client # builds front-end
npm run build:server # builds back-end docker imageYou will need to create three directories:
$DB_DATA_DIRECTORY: This will contain the database data. It's an external volume that persits across docker restats.$FILES_DIRECTORY: This will contain user-uploaded files. It's also an external volume.$CONFIG_DIRECTORY: This will contain the application configuration (e.g. SMTP account, Google OAuth account, etc). It must be created by copying the/configdirectory of this project, and modifying the$CONFIG_DIRECTORY/config.jsfile accordingly.
Here is a proposed procedure to setup the directories, then start the application:
cd $APPLICATION_DIRECTORY
mkdir -p data/db
mkdir -p data/files
cp -r config data/config
# At this point, modify ./data/config/config.js as you need
export DB_DATA_DIRECTORY="$(pwd)/data/db"
export FILES_DIRECTORY="$(pwd)/data/files"
export CONFIG_DIRECTORY="$(pwd)/data/config"
export PORT=8080
docker-compose run \
-d \
-v $DB_DATA_DIRECTORY:/var/lib/postgresql/data \
db
docker-compose run \
-d \
-v $CONFIG_DIRECTORY:/usr/etc/follow \
-v $FILES_DIRECTORY:/usr/share/follow \
-p $PORT:3001 \
webBackup the state of the application by copying the $DB_DATA_DIRECTORY and
$FILES_DIRECTORY directories. If you followed the above procedure, both are
contained in the /data folder.
An example script is provided in follow-backup, which can be placed in the
/etc/cron.daily folder of your machine. Make sure to have the zip utility
installed and to adjust the paths.
To configure the google authentication to work with your domain, you will need to follow this procedure:
- Goto Google Cloud Console
- Create a new project (top bar maybe?), and give it a name (e.g.
follow-app) - Enable the Google+ API
- In the menu, choose API & Services > Credentials, then on that page
choose Create Credentials > OAuth client id
- Set the application name & logo (if applicable)
- Select type Web Application
- Fill the
Name - Fill the
Authorised JavaScript originswith, e.g.:https://YOUR_DOMAIN.com - Fill the
Authorised redirect URIswith, e.g.:https://YOUR_DOMAIN.com/auth/google/callback - Note your client ID & client secret, and replace those values in the
./data/config/config.jsfile.