paralenzworld

* install "docker" and "docker-compose" on your development machine * optional: install postgresql (for syncing db) * optional: install awscli (for syncing s3 resources) * add a paralenz section to .aws/config * add aws credentials to .aws/credentials

Usage no npm install needed!

<script type="module">
  import paralenzworld from 'https://cdn.skypack.dev/paralenzworld';
</script>

README

How to start the development server

  • install "docker" and "docker-compose" on your development machine

  • optional: install postgresql (for syncing db)

  • optional: install awscli (for syncing s3 resources)

    • add a paralenz section to .aws/config
    • add aws credentials to .aws/credentials
  • download "https://drive.google.com/open?id=1VaABUUB2KKjad5sNTkwO2xoMqlzJUSSl" and place it in root folder

  • get hold of ".env.development" file from a co-worker and place in local repository

  • install dependencies: yarn --network-concurrency 1 (hopefully we will get rid of --network-concurrency soon)

  • build app: yarn build

  • run yarn docker:up (if you are running psql locally, use docker-compose to bring up the needed service)

  • optional: run yarn db:wipe-from-staging to sync from staging to developmen database

  • start server using yarn start:dev

  • when running local postgresql you may need to enable uuid-ossp with this command CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

Coding standard

We are writing everything in TypeScript with as little "any" as possible. We are using "Standard JS" (standardjs.com) as coding guidelines.

Continuous Integration Server

We are using "Buddy" (app.buddy.works) for automated deployment to staging and production environments.

Testing

We are using "Jest" as our testing frameworks and aim to provide unit tests for most modules and integration tests when applicable.

Traefik

We are using Traefik as the gateway/reversed proxy. It uses docker labels to communicate between service.

Traefik handles a lot of stuff. To name af few:

HTTPS

Traefik is responsible for renewing our SSL certificates. It is using the HTTP-01 challenge to renew the certificate. For this an unsecure connection is needed (thus port 80 is open for this).

To route a domain (i.e. production.paralenzworld.com) to a service just add a few labels in docker-compose.yml to the service which uses that domain:

  labels:
    - traefik.enable=true
    - traefik.http.routers.app-router.tls.certresolver=lets-encrypt
    - traefik.http.routers.app-router.rule=Host(`production.paralenzworld.com`)
    - traefik.http.routers.app-router.entrypoints=web-secure

Notice that app-router is the name of the router for this service. The three lines are almost self explaining:

  • Use lets-entrypt for this route
  • Set at host name for this route.
  • Use the web-secure endpoint (defined in traefik.yml)

To route multiple domains, use || and && to compose rules:

  - traefik.http.routers.app-router.rule=Host(`api.paralenz.com`) || Host(`production.paralenzworld.com`)