Skip to content

Instantly share code, notes, and snippets.

@glinton
Last active September 11, 2017 21:00
Show Gist options
  • Select an option

  • Save glinton/fb8b025521886b5e728534a78924defb to your computer and use it in GitHub Desktop.

Select an option

Save glinton/fb8b025521886b5e728534a78924defb to your computer and use it in GitHub Desktop.

Revisions

  1. glinton revised this gist Sep 11, 2017. 1 changed file with 8 additions and 11 deletions.
    19 changes: 8 additions & 11 deletions nanocloud.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    # become root (if not already)
    sudo su
    # must run as root
    if [ "$USER" != "root" ]; then
    echo "Must run as root!"
    exit 1
    fi

    # create user 'nanouser' with password 'password'
    useradd -m -p papAq5PwY/QQM -s /bin/bash nanouser
    @@ -34,12 +37,6 @@ chmod 600 /swapfile
    mkswap /swapfile
    swapon /swapfile

    # login as nanouser
    su - nanouser

    # clone your application (best to login via `ssh -A`)
    git clone https://github.com/nanobox-quickstarts/nanobox-rails.git && cd nanobox-rails

    # run the nanobox!
    nanobox run
    # will have prompts for install and request login to nanobox
    # configure nanobox
    su - nanouser -c "nanobox config set provider native"
    # `su - nanuser` then start nanobox with `nanobox start`
  2. glinton revised this gist Sep 7, 2017. 1 changed file with 31 additions and 0 deletions.
    31 changes: 31 additions & 0 deletions aProxy.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    This guide assumes you have a remote dev server set up and have `deploy[ed] dry-run`, as well as added the `mytest.dev` dns alias to the `dry-run` environment

    Create a config file for portal
    >`portal.json`
    >>```json
    >>{
    >> "api-token": "123",
    >> "api-host": "0.0.0.0",
    >> "api-port": 8443,
    >> "just-proxy": true,
    >> "database-connection": "scribble:///var/db/portal",
    >> "cluster-conection": "none://",
    >> "balancer": "nginx",
    >> "insecure": false,
    >> "proxy-ignore-upstream": true,
    >> "server": true,
    >> "log-level": "info"
    >>}
    >>```
    Start portal on your dev server
    >`portal -c portal.json`
    Add a route to portal (run on your dev server) (use `target:port` if running locally)
    >`portal -i -t 123 add-route -j '{"subdomain":"test1","targets":["http://mytest.dev"]}'`
    Add the hosts entry locally
    >`echo 'my.ser.ver.ip test1.mydomain.com' >> /etc/hosts`
    Connect to your remote app
    >`curl test1.mydomain.com`
  3. glinton revised this gist Jun 13, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions nanocloud.sh
    Original file line number Diff line number Diff line change
    @@ -29,10 +29,10 @@ ln -sf /home/nanouser/Downloads/nano/usr/local/bin/nanobox-vpn /home/nanouser/bi
    echo 'export PATH=$PATH:/home/nanouser/bin' >> /home/nanouser/.bashrc

    # enable swap for larger codebases
    sudo fallocate -l 2G /swapfile
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    fallocate -l 2G /swapfile
    chmod 600 /swapfile
    mkswap /swapfile
    swapon /swapfile

    # login as nanouser
    su - nanouser
  4. glinton revised this gist Jun 12, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions nanocloud.sh
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,12 @@ ln -sf /home/nanouser/Downloads/nano/usr/local/bin/nanobox-vpn /home/nanouser/bi
    # add `bin` to path
    echo 'export PATH=$PATH:/home/nanouser/bin' >> /home/nanouser/.bashrc

    # enable swap for larger codebases
    sudo fallocate -l 2G /swapfile
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile

    # login as nanouser
    su - nanouser

  5. glinton created this gist Jun 5, 2017.
    39 changes: 39 additions & 0 deletions nanocloud.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    # become root (if not already)
    sudo su

    # create user 'nanouser' with password 'password'
    useradd -m -p papAq5PwY/QQM -s /bin/bash nanouser

    # make 'nanouser' a sudoer
    usermod -aG sudo nanouser

    # get docker
    curl -fsSL https://get.docker.com/ | sh

    # add 'nanouser' to docker group
    usermod -aG docker nanouser

    # create some directories
    mkdir -p /home/nanouser/Downloads/nano
    mkdir /home/nanouser/bin

    # download and extract the installer (technically it should be downloaded after logging into the dashboard, but it is open source). Re-run to upgrade
    curl https://d1ormdui8qdvue.cloudfront.net/installers/v2/linux/nanobox-2.tar.gz | tar -C /home/nanouser/Downloads/nano -zxf -

    # link required binaries to `bin` path
    ln -sf /home/nanouser/Downloads/nano/usr/local/bin/nanobox /home/nanouser/bin/nanobox
    ln -sf /home/nanouser/Downloads/nano/usr/local/bin/nanobox-machine /home/nanouser/bin/nanobox-machine
    ln -sf /home/nanouser/Downloads/nano/usr/local/bin/nanobox-vpn /home/nanouser/bin/nanobox-vpn

    # add `bin` to path
    echo 'export PATH=$PATH:/home/nanouser/bin' >> /home/nanouser/.bashrc

    # login as nanouser
    su - nanouser

    # clone your application (best to login via `ssh -A`)
    git clone https://github.com/nanobox-quickstarts/nanobox-rails.git && cd nanobox-rails

    # run the nanobox!
    nanobox run
    # will have prompts for install and request login to nanobox