In order for the image resize & the templates' preview generation to work you will need those build packs IN THAT ORDER:
- https://github.com/alex88/heroku-buildpack-vips.git
- https://github.com/heroku/heroku-buildpack-apt
- https://github.com/captain401/heroku-buildpack-xvfb.git
- https://github.com/benschwarz/heroku-electron-buildpack.git
- heroku/nodejs
Copy and paste those urls in the Buildpacks
section of Settings
This has to be done BEFORE any deploy
- go in the settings of your application
- click on
settings
- click on
Reveal Config Vars
- variables name should follow this pattern :
badsender_emailOptions__from
- always put
badsender_
first - then each level of config should be seperate with a double underscore:
__
- see
.badsenderrc-example
on the master branch for the config requirements
below are the common environments variables you should want to set:
badsender_emailTransport__service Mailjet
badsender_emailTransport__auth__user your Username (or API key)
badsender_emailTransport__auth__pass your password (or Secret Key)
badsender_emailTransport__service is for nodemailer-wellknown configuration
badsender_emailOptions__from Badsender Builder <[email protected]>
the path to your mongoDB instance
badsender_database mongodb://localhost/badsender
badsender_admin__password a password of your choice
The domain name of your app
badsender_host badsender-test.herokuapp.com
Those are the keys you should set for aws
badsender_storage__type aws
badsender_storage__aws__accessKeyId 20 characters key
badsender_storage__aws__secretAccessKey 40 characters secret key
badsender_storage__aws__bucketName your bucket name
badsender_storage__aws__region region of your bucket (ex: ap-southeast-1)
console.aws.amazon.com/iam -> create new access key
console.aws.amazon.com/s3 -> create bucket
you have also to set the good policy for the bucket:
Properties -> Permissions -> Add bucket policy
and copy and paste this:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOURBUCKETNAME/*"
}
]
}
then replace YOURBUCKETNAME
by your real bucket name
// will print on the front some debug infos
debug: false,
// redirect any http request to https
forcessl: false,
images: {
// needed only if not using S3 image storage
uploadDir: 'uploads',
// tmp directory name for image upload
tmpDir: 'tmp',
// cache resized images & add cache-control to image request
cache: false,
},
- NodeJS 6
- MongoDB v3.2.7 (if installed locally
mongod
to start) (brew install mongod
on mac) - a SMTP server. mailcatcher can help for local dev (
mailcatcher
to start) (brew install ruby && gem install mailcatcher
on mac) - sharp should work out the box most of the time. In case of troubles see sharp installation instructions. MacOs will need XCode in order to compile.
You need to have:
- clone/fork the project
- in your terminal, go in the folder
- run
npm run deps
in the root folder
It should have a default config for dev already setup.
If you want to change some, create .badsenderc
at the root of the project then fill with the values you want to overrride as described in the .badsenderrc-example
those are the main developper commands:
npm run build
npm start
server will be running on localhost:3000
npm run prod
npm run dev
- server will be running on
localhost:7000
- server will be restarted on files changes
- build will be updated on files changes also
on your current branch
npm run release
The release will be pushed in the branch you have chosen (dev/stage)
Automatic deploy is configured in heroku. So pushing to any branch will automatically been deployed to heroku
see README.md
.badsenderrc
should be provided with dbConfigs infos. See .badsenderrc-example
for more informations
- can copy one DB into another
- can also copy a snapshot saved in
images.tmpDir
(see below) into another
npm run sync-db
- will save a snapshot of the specified DB in the folder defined by
images.tmpDir
config
npm run backup-db
- save a local db snapshot
- restore it later
npm run local-db
Run all backoffice's tests:
- Open a working dev server
npm run dev
- run the test with
npm run tape
Run a specific test:
./node_modules/.bin/tape tests/functional/user-deactivation.js | ./node_modules/.bin/faucet
This is some script to backup a bucket or sync a bucket from a backup.
This is mostly use for developement purpose.
- aws cli –
brew install awscli
on a mac .badsenderc
filled with s3Configs parameters. See.badsenderrc-example
more details about why we use the aws cli
npm run backup-s3
npm run sync-s3