Skip to content

Instantly share code, notes, and snippets.

View frankmanzhu's full-sized avatar

Frank Zhu frankmanzhu

  • Sydney
View GitHub Profile
package demo.powermock;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import static org.junit.Assert.*;
@frankmanzhu
frankmanzhu / java-8-ami.md
Last active October 7, 2016 09:01 — forked from rtfpessoa/java-8-ami.md
[Guide] Install Oracle Java (JDK) 8 on Amazon EC2 Ami
@frankmanzhu
frankmanzhu / gist:6a528d4840bf794e937b903f7f8c6a31
Created October 27, 2016 13:53
Centos 7 private docker repo
In my CentOS Linux release 7.1.1503 (Core)
The following configuration is working.
file: /lib/systemd/system/docker.service text:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
Download Oracle jdk8
Log-in Raspberry Pi, enter the command to extract jdk-8-linux-arm-vfp-hflt.tar.gz to /opt directory.
$ sudo tar zxvf jdk-8-linux-arm-vfp-hflt.tar.gz -C /opt
Set default java and javac to the new installed jdk8.
$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0/bin/java 1
$ sudo update-alternatives --config javac

相信很多人和我一样,拿到小米路由玩了几天,感觉官方的步伐不够快不够激进。既然如此,何不自己动手丰衣足食呢?

背景知识

首先你得知道Linux的一些基本理论,比如什么是bash啊,cdls这些命令怎么用等等。

其次你还得知道一些编程相关的东西,因为文章专注于Node.js的编译,所以Node.js和C++的一些基本知识是要有的。

热身准备

Quick tutorial for beginners how to easily install Oracle Java JDK8 or JDK9 in Ubuntu 16.04 or Linux Mint 18 via PPA.

Webupd8 Team is maintaining a PPA repository with installer scripts for the latest Java 8 and 9, that automatically downloads the Java archive from Oracle website and sets up everything for you.

  1. Add the PPA.

Open terminal (Ctrl+Alt+T) and run the command:

sudo add-apt-repository ppa:webupd8team/java
Install Cockpit on Ubuntu 16.04:
Cockpit repository for Ubuntu is less tested and irregularly updated, that does not mean it won’t work. Add a Cockpit repository on Ubuntu.
$ sudo add-apt-repository ppa:cockpit-project/cockpit
Update the apt cache database.
$ sudo apt-get update
application.yml
server:
port: 8888
spring:
cloud:
config:
server:
svn:
Share Dir VBox
Share it first as auto mount
sudo usermod -G vboxsf -a frank
restart
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) AlertPublishedFolder /t3Data
@frankmanzhu
frankmanzhu / gist:f55f63989bc5dd6ad04fa836308a2e0b
Created March 23, 2017 23:26
Docker compose doing blue green deployment
I just worked out another flow to have Zero downtime (mainly for web apps).
Proxy
We use jwilder/nginx-proxy to handle routing to app servers, this will assist us in dynamically routing requests to services.
First Deploy
For the first deploy run docker-compose --project-name=app-0001 up -d.
Rolling Update
We edit the docker-compose.yml with the new image id and run docker-compose --project-name=app-0002 up -d. We now have version 0.2 of the app up and running. The load balancer will already begin routing requests, and given we are using nginx LB we will have 0 downtime.