training.shoppinpal.com
  • Introduction
  • 1. The Ideal Workspace
    • The Perfect Machine
      • For Biz Team
      • For Developers
      • For Designers
    • Setup a machine in the cloud
      • Solution
      • Setup box on Azure
        • Create a machine on Azure
        • Test drive your remote machine
        • Setup Dropbox On Azure
      • Setup box on DigitalOcean
        • Setup UI
        • Shared FileSystem
          • Dropbox
            • Use locally developed node modules in another project
          • sshfs
        • Long Running Sessions
      • Feedback
  • 2. Learning Git
    • Static Code Analysis
  • 3. The Backend
    • Use Containers
    • Setup a loopback project
    • Lockdown
    • Build a better mousetrap
    • The abyss stares back
    • Built-in models
    • Extending built-in models
    • Understanding UserModel
    • Boot Scripts
    • Promises
    • Find roles for current user
    • Loopback Console
    • Current User
  • 4. Multi-tenancy With Loopback
    • What is Multi-Tenancy
    • Architecting with Loopback
    • Define scope for Roles
    • Role Resolvers
    • Access Control For Tenants
    • Better Programming with multi-tenancy
  • 5. The Frontend
    • The Browser
    • Unit Testing
      • Motivation behind this blog
      • How to write a test
      • Karma and Jasmin
      • Writing Tests
    • End-2-End Testing
    • Angular 1.x
    • Angular 2
      • Testing
  • 6. ElasticSearch
    • Better Search with NGram
    • NGram with Elasticsearch
    • Fun with Path Hierarchy Tokenizer
    • Working with Mappings and Analyzers
  • 7. Promises
    • What are Promises
    • Promise Implementations
    • Nuances
    • What should we use
  • 8. Learning Docker
    • Docker Swarm
  • 9. Queues & Workers
    • PHP workers in AWS EBS
    • NodeJS workers in AWS EBS
      • SQS Daemon by AWS
      • SQS Daemon in NodeJS
      • SQS polling by worker
    • Gearman
  • 10. Docker
    • Capabilities
  • Appendix
    • Bug in WebStorm deployments
    • The Perfect Terminal
    • Scalable App Deployment with AWS
    • Chrome Tips & Tricks
    • Host your own Gitbook
    • Gitbook Tips & Tricks
    • How to handle support incidents
    • Dev Resources
    • Debug e2e Tests on CircleCI
    • Logging
    • Authentication Principles
    • Mac
    • nvm
    • Unify testing with npm
      • Debugging Mocha
    • Sequence Diagrams
    • Project Sync via IDE
      • SFTP with WebStorm
      • SFTP with Visual Studio
    • Soft Linking
    • NodeJS Profiling
      • How to find node.js performance optimization killers
    • Setup Packer on Azure
Powered by GitBook
On this page
  1. 3. The Backend

Use Containers

Previous3. The BackendNextSetup a loopback project

Last updated 7 years ago

Use Containers

Let us go with a devops-first approach:

Our smallest experiments, no matter how trivial, will be closest to production best practices!

Note: Even without the video, you can learn all the crucial details from the steps that are documented below

    • Create it if you haven't done so already.

    • This will be a robust environment for learning.

  1. To start with a clean environment, run:

    mkdir -p ~/workspace && \
    cd ~/workspace && \
    rm -rf loopback-zero-to-hero && \
    mkdir -p ~/workspace/loopback-zero-to-hero && \
    cd ~/workspace/loopback-zero-to-hero
    1. Create New Project named loopback-zero-to-hero

    2. For Deployment Path use /root/workspace/loopback-zero-to-hero

  2. In your IDE, create a Dockerfile with the following content:

    # Use latest version 4.x of NodeJS
    # https://hub.docker.com/_/node/
    FROM node:4
    
    # install some useful tools
    RUN apt-get -y update
    RUN apt-get install -y tree
    RUN apt-get install -y vim
    
    # configure terminal access
    # https://github.com/dockerfile/mariadb/issues/3
    ENV TERM=xterm
    
    # configure envirnoment to work with tools used for tailing
    # https://github.com/jfrazelle/dockerfiles/issues/12
    ENV DEBIAN_FRONTEND=noninteractive
    RUN apt-get install -y less
    
    RUN mkdir -p /apps/loopback-zero-to-hero
    WORKDIR /apps/loopback-zero-to-hero
  3. Create a docker-compose.yml file to install and run a reasonably up to date version of NodeJS:

    version: '2'
    services:
      loopback-zero-to-hero:
        build:
          context: ./
        ports:
          - "3000:3000"
        volumes:
          - ~/workspace/loopback-zero-to-hero:/apps/loopback-zero-to-hero
  4. Start the service: docker-compose up and after it finishes running, you should see something like the following at the very end:

    WARNING: Image for service loopback-zero-to-hero was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
    Creating loopbackzerotohero_loopback-zero-to-hero_1
    Attaching to loopbackzerotohero_loopback-zero-to-hero_1
    loopbackzerotohero_loopback-zero-to-hero_1 exited with code 0

Login to your over ssh.

to work with the remote directory on the cloud-box.

cloud-box
https://youtu.be/u1CG-ujpnWkyoutu.be
Setup your IDE