Repos with Multiple Apps

Squash supports multiple applications within the same repository.

  • You can test each app independently off its own virtual machine.
  • You can also define custom PR comments with unique deployment links for each application.
  • This works for apps based on Docker or without it (Squash YAML file based).

Example using Docker/docker-compose

The Squash YAML file sample below shows two separate applications with their own Docker files:

  • CRM App: src/crm/Dockerfile
  • Store App: src/store/docker-compose.yml
deployments:
  CRM:
    filename:
      ./src/crm/Dockerfile
    context_path:
      ./src
    vm_size:
      1GB
  Store:
    filename:
      ./src/store/docker-compose.yml
    context_path:
      ./src
    vm_size:
      1GB

The sample above will automatically generate two unique deployment URLs within a Squash PR comment, like this (assuming branch name is “js_lib_updates):

More information on: Docker support and custom PR comments.

Example without Docker

The example below is very similar to the Docker one, except that the entire app build process for each app is defined in the Squash YAML file:

deployments:
  CRM:
    dockerimage:
      # This is the base OS image we want to use for this app
      ubuntu:14.04
    vm_size:
      2GB
    build_steps:
      # This is where we install all the essential packages needed
      - DEBIAN_FRONTEND=noninteractive apt-get update
      - DEBIAN_FRONTEND=noninteractive apt-get install -y 
      software-properties-common
      - DEBIAN_FRONTEND=noninteractive add-apt-repository 
      ppa:ubuntugis/ubuntugis-unstable
      - DEBIAN_FRONTEND=noninteractive apt-get install -y 
      python python-dev python3.5 python3.5-dev python-pip
        python-virtualenv libssl-dev libpq-dev git ssh 
        build-essential libfontconfig1 libfontconfig1-dev
        locales gcc postgresql postgis postgresql-contrib 
        postgresql-9.3-postgis-2.1 sudo supervisor
      - COPY . /code
      - cd /code
      - bash ./create_venv.sh
    launch_steps:
      # This is where we run the services and our app
      - service postgresql start
      - sleep 90
      - cd /code
      - /code/venv/bin/python /code/manage.py migrate
      - /code/venv/bin/python /code/manage.py runserver 0.0.0.0:3000
    port_forwarding:
      # Squash by default expects an HTTP service running on port 80.
      # For this example the HTTP service is listening to port 3000.
      80:3000
  Store:
    dockerimage: python:latest
    build_steps:
      - apt-get update && apt-get install -y libssl-dev libpq-dev git
      build-essential libfontconfig1 libfontconfig1-dev curl
      - apt install -y nodejs
      - pip install setuptools pip --upgrade --force-reinstall
      - cd /code
      - pip install /code
      - python manage.py migrate
    launch_steps:
      - cd /myproject/mysite
      - python manage.py runserver 0.0.0.0:80
    vm_size:
      1GB

The PR comment for the example above will be the same as the one with Docker: