Skip to content

Latest commit

 

History

History
89 lines (60 loc) · 2.17 KB

deploy.md

File metadata and controls

89 lines (60 loc) · 2.17 KB

Deploy

{id: deploy}

Stand-alone Application to deploy

{id: stand-alone-application-to-deploy}

  • A stand-alone Docker image that exposes a single port

Locally

docker build -t flasker .
docker run --rm  -p5000:5000 flasker
http://localhost:5000/

Digital Ocean

{id: digital-ocean}

Deployment on Digital Ocean

{id: deployment-on-digital-ocean}

  • Digital Ocean
  • Go to Marketplace, search for Docker
  • Click on Create Docker Droplet
  • Basic $5/month
  • New York is fine
  • Select SSH key
ssh root@remotehost mkdir /data
DOCKER_HOST=ssh://root@remotehost ./deploy.sh

  • We are going to use the /data directory on the host system as our data volume

  • We use the -d flag to convert it into a daemon

  • We use --restart unless-stopped to tell Docker to restert on reboot

  • We create a volume on the disk

  • restart policy

Multi-container Application to deploy

{id: multi-container-application}

  • A multi-container Docker app using Docker Compose

  • Create Droplet based on Docker

  • ssh to it, apt-get update, apt-get dist-upgrade, reboot

  • DOCKER_HOST="ssh://user@remotehost" docker-compose up -d

Re-deploy

  • DOCKER_HOST="ssh://user@remotehost" docker-compose build web
  • DOCKER_HOST="ssh://user@remotehost" docker-compose up -d web

Digital Ocean with Docker compose

{id: digital-ocean-docker-compose}

Linode

{id: linode}