NodeJs/Express/Passport/Pug/Redis, React in the backend
- Install
NodeJS/npm
- Install
MongoDB
locally or run in a docker containerdocker run --name dci-mongo -p 27017:27017 -d mongo:latest
- Install
Redis
or run it in a docker containerdocker run --name dci-redis -d redis
- copy the
.env.example
to.env
and fill in the neccessary real secret keys what an admin eventually provides you. - It can happend that it complains about a missing global
webpack
andwebpack-cli
. Just un/install them global:npm i webpack webpack-cli -g
PORT=3000
MONGOURL=mongodb://localhost:27017/marketing-website
DOMAIN=localhost
EVENTBRIDE_API_KEY=XXXXXXXXXXXXXXXXXXXX
MAILHOST=XXXXXX.XXXXXXXXXX.com
MAILUSER=XXXXXXXXXXXX
MAILPW=XXXXXXXXXXXXXX
MAILPORT=587
MAILRECEIVER=developer@digitalcareerinstitute.org
TOURMAILRECEIVER=developer@digitalcareerinstitute.org
IMAGE_UPLOAD_DIR=uploads/images/
USE_REDIS=true
AUTHORIZATION='auth xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-us14'
URL='https://us14.api.mailchimp.com/3.0/lists/xxxxxxxxxx'
CRONINTERVAL="0 0 * * *"
CLIENT_ID="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
CLIENT_SECRET="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
SESSION_KEY=digitalcareerinstitute
SESSION_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
HUBSPOT_API_KEY=XXXXXXXX-00XX-0000-0000-XXXXXXXXXXXX
Start normal: npm start
Start development: npm run dev
Insert example data:
npm run seed
Remove all seeds from database:
npm run seed:delete
mongorestore -h localhost:27017 -d marketing-website DIRNAME --drop
To get access to the admin-area, you need to create a user.
Go to register and submit the form. You should then have a database users record which needs to be verified
and then activated
. Finally you want to make yourself a admin
and superadmin
. Use the following command to accomplish all.
db.users.findOneAndUpdate({email: "user@digitalcareerinstitute.org"}, {$set: {admin: "true", superAdmin: "true", verifiedAt: ISODate(), activatedAt: ISODate()}})
Then you can login per login
- Check out the Issues for a
good first issue
and let yourself invite to Trello by @spielhoelle - And read the Contribution Guidelines
- Be nice to each other and follow the Code of Conduct
docker-compose up
If you push to the staging-branch, a github action triggers a new release in the staging environment, if a new release will be created - the GH action deploys to production.
For more control over the deployment porcess, acquire access to the private infrastructure repo and follow the containing README.md
.
Let a admin add your ssh key to the server. Then map the live-mongo db to an alternative local port:
ssh dci@95.217.184.232 -L 27018:localhost:27017
Then connect to the live mongo-db from another terminal window:
mongo --port 27018
Then you can run normal mongo commands in your local mongo-terminal towards the remote production mongo instance.
Eg. update a users admin privileges:
db.users.findOneAndUpdate({email: "user@digitalcareerinstitute.org}, {$set: {admin: "true", superAdmin: "true", activatedAt: ISODate()}})
To keep the database according to the changes to the model over time, you can create migrations to batch over all records.
Run them for example with nodemon migration/runner.js MIGRATION_FILE_NAME.js
This is also used to sync contacts manually with hubspot. The migration/manually_send_hubspot_payload.js holds the DB backup, sanitizing and sync-process documentation.
For some actions you need a superadmin account, for some a normal admin role is enough. Contact @spielhoelle or @ majofi for extended access rights.
Events will be automatically fetched once a night per a automated task. It is possible to manually delete all of them and refetch in case of urgent update. Go on /admin/events and use the appropriate interface action for just refetch, or first purge all.
Todo
Todo
Todo
Todo
If you append the query parameter dci_blank=true
behind every page/url you get a raw page, just displaying the content without header and footer. This is useful for Iframes where you just want to eg. render a questionaire. You can create a page without content. Each page gets the page-title added as ID to the main container. If you create a page with a empty content you can use it as a target for a renderselector from the questionaire.
Static-sites are main content deliverers and can serve as landingpages, general information
Slug
When creating a page, the slug (url/permalink) derives from the title. Eg. a page with the title Our students generates a slug like our-studets. The slug is important for SEO, should kept consistent and would confuse google crawler if changed later on.
Order and page location
Pagelocation defines where and whether the page should be visible in a menu. Prominent shows the page in the main header-navigation - otherwise its in the GET INVOLVED submenu sorted by order. If page location is not set, the page will be created, but not in a menu - so kind of invisible, but reachable per direct link.
Order Defines the position of the pages amongst their location (header-page => 1, 2, 3 ... | footer-pages => 1, 2, 3)
Call to action
Offers posibility to show a prominent box on the page frontend. If not set, bos is not visible.
Translations
By default all entries are created in a english namespace and are also just visible on the english version in the frontend. If you translate a entry, it creates a clone and links the original with the translated pendant. All fields are individual editable. If you switch in the frontend the language, the adequate version will be displayed.
Rich-text-editor
This page offers a lot of the build in mechanics to make pages more visually attractive. We use Quill rich text editor with some basic features to not overkill the content.
Todo
Slug
see Pages -> Slug
Translation
see Pages -> Translation
Excerpt
Preview of the content. Shows up storyslider on the landingpage to prevent overlapping text. Use it for granular summary of the story in case the story content itself has a lyrical, very long or unconnected beginning content
Todo
Todo
Todo
Todo
Todo