GithubHelp home page GithubHelp logo

thebergamo / docker-deploy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azukiapp/docker-deploy

0.0 2.0 0.0 131 KB

Easily deploy your app to a remote server using azk

License: Apache License 2.0

Makefile 2.50% Shell 97.50%

docker-deploy's Introduction

Base docker image to deploy an app using azk

Initial Considerations

We strongly recommend you to use Ubuntu 14.04 x86-64 in the target server. Using this image with any other OS in the target server is untested yet and it's potentially broken.

Versions (tags)

- [`latest`](https://github.com/azukiapp/docker-deploy/blob/master/latest/Dockerfile)

Image content:

Configuration

The following environment variables are available for configuring the deployment using this image:

  • REMOTE_HOST: Deploy server's public IP;
  • REMOTE_ROOT_PASS (optional): Deploy server's root password. It's optional because you can have added your public ssh key into the authorized_keys files in the remote server;
  • LOCAL_PROJECT_PATH: (optional, default: /azk/deploy/src) Project source code path;
  • LOCAL_DOT_SSH_PATH (optional, default: /azk/deploy/.ssh): Path containing SSH keys. If no path is given, a new SSH public/private key pair will be generated;
  • REMOTE_USER (optional, default: git): Username created (or used if it exists) in the remote server to deploy files and run the app;
  • REMOTE_PASS (optional): REMOTE_USER's password. If it's a new user, a random password will be generated;
  • REMOTE_ROOT_USER (optional, default: root): Root user in the remote server;
  • REMOTE_PORT (optional, default: 22): SSH remote port;
  • AZK_DOMAIN (optional, default: azk.dev.io): azk domain in the current namespace;
  • HOST_DOMAIN (optional): Domain name which you'll use to access the remote server;
  • AZK_RESTART_COMMAND (optional, default: azk restart): command to executed after each git push;
  • REMOTE_PROJECT_PATH_ID (optional): By default, the project will be placed at /home/REMOTE_USER/REMOTE_PROJECT_PATH_ID (i.e., REMOTE_PROJECT_PATH) in the remote server. If no value is given, a random id will be generated;
  • REMOTE_PROJECT_PATH (optional): The path where the project will be stored in the remote server. If no value is given, it will be /home/REMOTE_USER/REMOTE_PROJECT_PATH_ID;
  • RUN_SETUP (optional, default: true): Boolean variable that defines if the remote server setup step should be run;
  • RUN_CONFIGURE (optional, default: true): Boolean variable that defines if the remote server configuration should be run;
  • RUN_DEPLOY (optional, default: true): Boolean variable that defines if the deploy step should be run;
  • DISABLE_ANALYTICS_TRACKER (optional, default: false): Boolean variable that defines either azk should track deploy anonymous data or not;
  • ENV_FILE (optional, default: .env): The .env file path that will be copied to remote server.;

Usage

Consider you want to deploy your app in a server which public IP is SERVER_PUBLIC_IP and root user's password is SERVER_ROOT_PASS, and your local SSH keys are placed at LOCAL_DOT_SSH_PATH (usually this path is $HOME/.ssh). Remember that passing a root password is optional, since you can always put your local SSH public key into $HOME/.ssh/authorized_keys file in the host server.

Usage with azk

Example of using this image with azk:

  • Add the deploy system to your Azkfile.js:
/**
 * Documentation: http://docs.azk.io/Azkfile.js
 */

// Adds the systems that shape your system
systems({
  // ...

  deploy: {
    image: {"docker": "azukiapp/deploy"},
    mounts: {
      "/azk/deploy/src":  path("."),
      "/azk/deploy/.ssh": path("#{env.HOME}/.ssh")
    },
    scalable: {"default": 0, "limit": 0},
    envs: {
      REMOTE_HOST:        "`SERVER_PUBLIC_IP`",
      REMOTE_ROOT_PASS:   "`SERVER_ROOT_PASS`",
    },
  },
});
  • Add the HOST_DOMAIN (if any) and HOST_IP var to your main system http domains (so you can access it by http://SERVER_PUBLIC_IP or http://YOUR_CUSTOM_DOMAIN). Please note the order matter.
/**
 * Documentation: http://docs.azk.io/Azkfile.js
 */

// Adds the systems that shape your system
systems({
  example: {
    // ...
    http: {
      domains: [
        // ...
        "#{env.HOST_DOMAIN}",
        "#{env.HOST_IP}"
      ]
    },
  },

  // ...
});
  • Run:
$ azk shell deploy
  • Customizing AZK_RESTART_COMMAND for a specific deploy:
$ azk shell deploy -e AZK_RESTART_COMMAND="azk restart -R -vvvv --rebuild"

Usage with docker

To create the image azukiapp/deploy, execute the following command on the deploy image folder:

$ docker build -t azukiapp/deploy .

To run the image:

$ docker run --rm --name deploy-run \
  -v $(pwd):/azk/deploy/src \
  -v $HOME/.ssh:/azk/deploy/.ssh \
  -e "REMOTE_HOST=`SERVER_PUBLIC_IP`" \
  -e "REMOTE_ROOT_PASS=`SERVER_ROOT_PASS`" \
  azukiapp/deploy

Before running, replace SERVER_PUBLIC_IP and SERVER_ROOT_PASS with the actual values.

License

Azuki Dockerfiles distributed under the Apache License.

docker-deploy's People

Contributors

fearenales avatar gullitmiranda avatar saitodisse avatar

Watchers

Marcos Bérgamo avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.