├── .gitignore ├── LICENSE ├── README.md ├── _includes ├── build.sh ├── connect-scope-probe-to-weave-cloud.md ├── deploy-the-demo-app.md ├── hello-world.md ├── install-docker-for-mac.md ├── introduction-weave-cloud-and-the-demo-app.md ├── run-the-load-test.md └── sign-up-to-weave-cloud.md ├── aws-ecs ├── README.md ├── cleanup.sh ├── data │ ├── set-ecs-cluster-name.sh │ ├── weave-ecs-demo-containers.json │ ├── weave-ecs-policy.json │ └── weave-ecs-role.json ├── images │ ├── ecs-weave-diagram.graffle │ ├── ecs-weave-diagram.png │ ├── httpserver.png │ ├── overview-diagram.graffle │ ├── overview-diagram.png │ ├── scope-cloud-main-page.png │ ├── scope-early-access.png │ ├── scope.png │ └── weave-cloud-main-page.png └── setup.sh ├── aws-nginx-ubuntu-simple ├── Dockerfile-simple-apache ├── Dockerfile-simple-nginx ├── README.md ├── access-aws-hosts.sh ├── cleanup-aws.sh ├── data │ └── ami-list.csv ├── demo-aws-setup.sh ├── example │ ├── index.php │ └── nginx.conf └── launch-aws-nginx-demo.sh ├── aws.md ├── centos-simple ├── .gitignore ├── Dockerfile-curl-bash-centos ├── Dockerfile-hw-centos ├── DockerfileREADME.md ├── README.md ├── Vagrantfile ├── config.rb └── example │ ├── index.php │ └── run-httpd.sh ├── coreos-simple ├── README.md ├── Vagrantfile ├── config.rb └── user-data ├── d4m ├── README.md └── images │ ├── docker-for-mac-menu-bar-icon.png │ ├── load-test-messages.png │ ├── socks-shop.png │ └── weave-cloud-token-screenshot.png ├── docker-legacy ├── part-1.md ├── part-2.md └── part-3.md ├── elasticsearch-nodejs-coreos-vagrant.md ├── example-componentized-guide ├── README.md ├── _README │ └── README.md └── build.sh ├── images ├── 2_Node_HAProxy_AWS_Example.png ├── 2_Node_Nginx_AWS_Example.png ├── 3_Node_Nginx_Example.png ├── Microservices_Seneca_Weave.png ├── Simple_Weave.png ├── Weave_LoadBalance.png ├── cloudformation-launch-stack.png ├── hello-screencast.png ├── kubernetes │ └── coreos │ │ └── guestbook.png ├── muticast │ ├── AWS-1-select-template.png │ ├── AWS-2-specify-details-parameters.png │ ├── AWS-3-options.png │ ├── AWS-4-create-stack.png │ ├── add-container.png │ ├── containers-multicast.png │ ├── create-service.png │ ├── create-stack.png │ ├── metrics-multicast.png │ ├── multicast-scope.png │ ├── service-name-definition-instances.png │ └── task-name.png ├── weave-cloud-token.png └── weave-scope │ ├── container-metrics-images.png │ ├── weave-scope-application-layers.png │ ├── weave-scope-applications-view.png │ ├── weave-scope-containers.png │ ├── weave-scope-database-metrics.png │ └── weave-scope-group-containers.png ├── imports ├── coreos-vagrant │ ├── .gitattributes │ ├── .gitignore │ ├── CONTRIBUTING.md │ ├── DCO │ ├── LICENSE │ ├── MAINTAINERS │ ├── NOTICE │ ├── README.md │ ├── Vagrantfile │ ├── config.rb.sample │ └── user-data.sample └── coreos-vagrant_subtree_pull.sh ├── index.md ├── kubernetes └── coreos │ ├── .gitattributes │ ├── .gitignore │ ├── README.md │ ├── Vagrantfile │ ├── addons │ ├── skydns-rc.yaml │ └── skydns-svc.yaml │ ├── config.rb │ ├── kubernetes-cluster.yaml │ └── network.graffle ├── mesos-marathon └── centos │ ├── .gitattributes │ ├── .gitignore │ ├── README.md │ ├── Vagrantfile │ ├── deploy_on_marathon.sh │ ├── diagrams.graffle │ ├── images │ ├── diagram-1.png │ ├── diagram-2.png │ ├── marathon-1.png │ └── marathon-2.png │ ├── install_mesosphere_packages.sh │ ├── install_weave.sh │ ├── launch_mesos_master_services.sh │ ├── mesos-slave-containerizers.conf │ ├── nodejs │ ├── Dockerfile │ ├── index.js │ └── marathon-app.json │ ├── outyet.json │ ├── setup_and_launch_mesos_slave.sh │ ├── setup_and_launch_weave.sh │ ├── weave.service │ ├── weave.target │ └── weaveproxy.service ├── microservices-demo-app └── docker-compose.yml ├── microservices-seneca-ubuntu-simple ├── README.md ├── Vagrantfile ├── dockerfiles │ ├── Dockerfile.seneca_offer │ ├── Dockerfile.seneca_user │ ├── Dockerfile.seneca_webapp │ └── README.md ├── example │ └── micro-services │ │ ├── README.md │ │ ├── lib │ │ ├── api.js │ │ └── offer.js │ │ ├── package.json │ │ ├── public │ │ ├── index.html │ │ ├── index.js │ │ └── jquery-2.1.1.min.js │ │ └── services │ │ ├── offer-service.js │ │ ├── user-details.js │ │ └── web-app.js └── launch-senca-demo.sh ├── nginx-ubuntu-simple ├── 3_Node_Nginx_Example.png ├── Dockerfile-simple-apache ├── Dockerfile-simple-nginx ├── README.md ├── Vagrantfile ├── access-hosts.sh ├── example │ ├── check-ws.sh │ ├── index.php │ └── nginx.conf └── launch-nginx-demo.sh ├── rails-ubuntu-simple ├── .gitignore ├── Dockerfile ├── README.md ├── Vagrantfile └── config.rb ├── rkt ├── README.md ├── Vagrantfile ├── config.rb └── user-data ├── screencasts ├── hello-weave │ ├── create-infra.sh │ ├── delete-infra.sh │ ├── fancy-rec-weave-01.json │ ├── fancy-rec-weave-02.json │ ├── highlight.py │ ├── provision.sh │ ├── rec-weave-01.json │ ├── rec-weave-02.json │ ├── record.sh │ ├── script.md │ ├── thumb.png │ ├── thumb.psd │ ├── tmux-player.sh │ └── tmux-record.sh ├── kubernetes-anywhere │ ├── create.sh │ ├── kubernetes-anywhere-p1.json │ └── record_p1.sh └── misc │ ├── Screencast YT.terminal │ ├── YouTube-icon-full_color.eps │ └── weave-screencast-terminal-background.psd ├── spark-coreos-vagrant.md ├── spring-boot-weave-microservices ├── README.md ├── Vagrantfile └── images │ ├── all-containers-communicating.png │ ├── backend-containers.png │ ├── containerized-microservices-spring-boot.png │ ├── email-registration.png │ ├── restful-rabbit-eureka.png │ └── two-peered-vms.png ├── spring-boot-weave-service-discovery ├── README.md ├── Vagrantfile └── demo │ ├── Dockerfile │ ├── README.md │ ├── build.gradle │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── pom.xml │ └── src │ └── main │ └── java │ └── hello │ └── Application.java ├── terraform-coreos-gce-and-aws.md ├── tools └── Dockerfile ├── ubuntu-all-in-one ├── README.md ├── Vagrantfile ├── config.rb └── launch-simple-demo.sh ├── ubuntu-interactive ├── Dockerfile └── README.md ├── ubuntu-simple ├── .gitignore ├── Dockerfile ├── README.md ├── Vagrantfile ├── config.rb └── example │ └── index.php ├── vagrant.md ├── weave-and-docker-platform ├── app │ ├── Dockerfile │ ├── app.py │ ├── build.sh │ ├── docker-compose.yml │ └── requirements.txt └── scripts │ ├── 1-machine-create.sh │ ├── 2-weave-launch.sh │ ├── 3-replace-swarm-agents.sh │ └── weave ├── weave-ansible-haproxy-aws ├── 2_Node_HAProxy_AWS_Example.png ├── README.md ├── access-aws-hosts.sh ├── ansible.cfg ├── ansible_aws_variables.yml ├── check-region.sh ├── data │ └── ami-list.csv ├── inventory ├── launch-weave-haproxy-aws-demo.yml ├── remove-instances.yml ├── roles │ ├── common │ │ └── tasks │ │ │ ├── create_sshkey.yml │ │ │ └── main.yml │ ├── dockerinstall │ │ ├── README.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ └── tasks │ │ │ └── main.yml │ ├── ubuntuinstall │ │ ├── tasks │ │ │ ├── create_inv.yml │ │ │ ├── create_secgroup.yml │ │ │ ├── create_vm.yml │ │ │ └── main.yml │ │ └── templates │ │ │ └── inventory.j2 │ ├── weavehaproxydemo │ │ ├── files │ │ │ └── haproxy.cfg │ │ └── tasks │ │ │ └── main.yml │ └── weaveinstall │ │ ├── README.md │ │ ├── defaults │ │ └── main.yml │ │ └── tasks │ │ └── main.yml └── setup-weave-ubunu-aws.yml ├── weave-kubernetes └── README.md ├── weave-loadbalance ├── README.md ├── Vagrantfile ├── example │ └── src │ │ └── myip │ │ ├── Dockerfile │ │ ├── README.md │ │ └── myip.go ├── launch-demo-containers.sh └── setup-weave.sh ├── weave-multicast └── weave-multicast.md ├── weave-scope-cloud-service └── README.md └── weave-scope └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .*sw* 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Legacy Weave Getting Started Guides 2 | 3 | **Note:** The guides in here haven't been updated in a while. 4 | They might or might not work for you. We are keeping them around for informational purposes. 5 | 6 | For up-to-date documentation around products and projects started by Weaveworks, please refer to: 7 | 8 | Weaveworks products: 9 | 10 | Open Source projects started at Weaveworks: 11 | 12 | - Cortex (CNCF): 13 | - Flagger (CNCF): 14 | - Flux (CNCF): 15 | - Grafanalib: 16 | - Ignite: 17 | - Weave GitOps: 18 | - wksctl: 19 | -------------------------------------------------------------------------------- /_includes/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | GIT_ROOT="$(cd "$(git rev-parse --show-toplevel)" && pwd -P)" 3 | # PWD is e.g. /Users/luke/Projects/Weave/guides/foo-guide/x/y/z 4 | # GIT_ROOT is e.g. /Users/luke/Projects/Weave/guides 5 | # GIT_SUFFIX_PATH needs to be "foo-guide/x/y/z", 6 | # e.g. GIT_ROOT.replace(PWD, "") 7 | GIT_SUFFIX_PATH="$(echo "$(pwd -P)" | sed "s|$GIT_ROOT||")" 8 | docker run -ti -v $GIT_ROOT:/guides \ 9 | -w /guides$GIT_SUFFIX_PATH lmarsden/gitdown \ 10 | ./_README/README.md \ 11 | --output-file ./README.md 12 | -------------------------------------------------------------------------------- /_includes/connect-scope-probe-to-weave-cloud.md: -------------------------------------------------------------------------------- 1 | ### Connect Scope Probe to Weave Cloud 2 | 3 | Install and launch Weave Scope Probe: 4 | ``` 5 | sudo curl --silent --location https://git.io/scope --output /usr/local/bin/scope 6 | sudo chmod +x /usr/local/bin/scope 7 | scope launch --service-token= 8 | ``` 9 | -------------------------------------------------------------------------------- /_includes/deploy-the-demo-app.md: -------------------------------------------------------------------------------- 1 | ### Deploy the Demo App 2 | 3 | In this guide you will deploy a microservices app that [we have built](demo-app). The app is a full-blown 4 | online store, which sells socks. 5 | 6 | Get the code: 7 | ``` 8 | git clone https://github.com/weaveworks/guides 9 | cd microservices-demo-app 10 | ``` 11 | Deploy the shop app: 12 | ``` 13 | docker-compose pull 14 | docker-compose -p shop up -d 15 | open http://localhost 16 | ``` 17 | 18 | Once the app has been loaded in your browser, you can test the functionality. The user interface should be 19 | self-explanatory. Login using `user1`/`password1`, put an item in the basket and proceed to checkout. 20 | 21 | [demo-app]: https://github.com/weaveworks/weaveDemo 22 | -------------------------------------------------------------------------------- /_includes/hello-world.md: -------------------------------------------------------------------------------- 1 | # Hello, world. 2 | 3 | I got included! 4 | -------------------------------------------------------------------------------- /_includes/install-docker-for-mac.md: -------------------------------------------------------------------------------- 1 | ### Install Docker for Mac 2 | 3 | If you haven't installed Docker for Mac, please follow the installation instructions on [Docker website][install-d4m]. 4 | 5 | Once it's runing you should see Docker Icon in the Mac OS menu bar in your menu bar. 7 | 8 | [install-d4m]: https://docs.docker.com/docker-for-mac/ 9 | -------------------------------------------------------------------------------- /_includes/introduction-weave-cloud-and-the-demo-app.md: -------------------------------------------------------------------------------- 1 | ### Introduction: Weave Cloud and the Demo App 2 | 3 | In this guide you will learn how Weave Cloud can help you to understand a microservices app. You will deploy 4 | an app consisting of several microservices written in different languages (Node.js, Java and Go) as well as 5 | data services (RabbitMQ and MongoDB). You will use Docker for Docker Compose to deploy this app on 6 | your local machine, and then use the Weave Scope Probe to push metrics to Weave Cloud to observe the 7 | topology of the app and explore how it works. Weave Scope Probe monitors the network traffic and builds the 8 | topology graph in real-time, augmented with metadata from Docker API along with various system metrics. 9 | -------------------------------------------------------------------------------- /_includes/run-the-load-test.md: -------------------------------------------------------------------------------- 1 | ### Run the Load Test 2 | 3 | Unless there is load on the app, you cannot see full topology in Weave Cloud. To observe the topology, 4 | you will need to run a load test: 5 | ``` 6 | docker run -ti --rm --name=LOAD_TEST \ 7 | --net=shop_external \ 8 | weaveworksdemos/load-test -h edge-router -r 100 -c 2 9 | ``` 10 | 11 | While the load test is running, you should see how different services communicate, and the topology 12 | graph in Weave Cloud console will form. 13 | -------------------------------------------------------------------------------- /_includes/sign-up-to-weave-cloud.md: -------------------------------------------------------------------------------- 1 | ### Sign Up to Weave Cloud 2 | 3 | You will use Weave Cloud to see what the application does. If you haven't yet sign up, here is what you need to do. 4 | 5 | 1. Go to ***[cloud.weave.works](https://cloud.weave.works)*** 6 | 2. Sign up with either Github, Google or email 7 | 3. Obtain service token as shown below 8 | 9 | ![Obtain service token for Weave Cloud](weave-cloud-token-screenshot.png) 10 | -------------------------------------------------------------------------------- /aws-ecs/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # Check that we have everything we need 5 | 6 | if [ -z "$(which aws)" ]; then 7 | echo "error: Cannot find AWS-CLI, please make sure it's installed" 8 | exit 1 9 | fi 10 | 11 | REGION=$(aws configure list 2> /dev/null | grep region | awk '{ print $2 }') 12 | if [ -z "$REGION" ]; then 13 | echo "error: Region not set, please make sure to run 'aws configure'" 14 | exit 1 15 | fi 16 | 17 | if [ -n "$(aws ecs describe-clusters --clusters weave-ecs-demo-cluster --query 'failures' --output text)" ]; then 18 | echo "error: ECS cluster weave-ecs-demo-cluster doesn't exist, nothing to clean up" 19 | exit 1 20 | fi 21 | 22 | # Delete service 23 | echo -n "Deleting ECS Service (weave-ecs-demo-service) .. " 24 | aws ecs update-service --cluster weave-ecs-demo-cluster --service weave-ecs-demo-service --desired-count 0 > /dev/null 25 | aws ecs delete-service --cluster weave-ecs-demo-cluster --service weave-ecs-demo-service > /dev/null 26 | echo "done" 27 | 28 | # Task definition 29 | echo -n "De-registering ECS Task Definition (weave-ecs-demo-task) .. " 30 | REVISION=$(aws ecs describe-task-definition --task-definition weave-ecs-demo-task --query 'taskDefinition.revision' --output text) 31 | aws ecs deregister-task-definition --task-definition "weave-ecs-demo-task:${REVISION}" > /dev/null 32 | echo "done" 33 | 34 | # Auto Scaling Group 35 | echo -n "Deleting Auto Scaling Group (weave-ecs-demo-group) .. " 36 | # Save Auto Scaling Group instances to wait for them to terminate 37 | INSTANCE_IDS=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names weave-ecs-demo-group --query 'AutoScalingGroups[0].Instances[*].InstanceId' --output text) 38 | aws autoscaling delete-auto-scaling-group --force-delete --auto-scaling-group-name weave-ecs-demo-group 39 | echo "done" 40 | 41 | # Wait for instances to terminate 42 | echo -n "Waiting for instances to terminate (this may take a few minutes) .. " 43 | STATE="foo" 44 | while [ -n "$STATE" -a "$STATE" != "terminated terminated terminated" ]; do 45 | STATE=$(aws ec2 describe-instances --instance-ids ${INSTANCE_IDS} --query 'Reservations[0].Instances[*].State.Name' --output text) 46 | # Remove spacing 47 | STATE=$(echo $STATE) 48 | sleep 2 49 | done 50 | echo "done" 51 | 52 | # Launch configuration 53 | echo -n "Deleting Launch Configuration (weave-ecs-launch-configuration) .. " 54 | aws autoscaling delete-launch-configuration --launch-configuration-name weave-ecs-launch-configuration 55 | echo "done" 56 | 57 | # IAM role 58 | echo -n "Deleting weave-ecs-role IAM role (weave-ecs-role) .. " 59 | aws iam remove-role-from-instance-profile --instance-profile-name weave-ecs-instance-profile --role-name weave-ecs-role 60 | aws iam delete-instance-profile --instance-profile-name weave-ecs-instance-profile 61 | aws iam delete-role-policy --role-name weave-ecs-role --policy-name weave-ecs-policy 62 | aws iam delete-role --role-name weave-ecs-role 63 | echo "done" 64 | 65 | 66 | # Key pair 67 | echo -n "Deleting Key Pair (weave-ecs-demo-key, deleting file weave-ecs-demo-key.pem) .. " 68 | aws ec2 delete-key-pair --key-name weave-ecs-demo-key 69 | rm -f weave-ecs-demo-key.pem 70 | echo "done" 71 | 72 | # Security group 73 | echo -n "Deleting Security Group (weave-ecs-demo) .. " 74 | GROUP_ID=$(aws ec2 describe-security-groups --query 'SecurityGroups[?GroupName==`weave-ecs-demo`].GroupId' --output text) 75 | aws ec2 delete-security-group --group-id "$GROUP_ID" 76 | echo "done" 77 | 78 | # Internet Gateway 79 | echo -n "Deleting Internet gateway .. " 80 | VPC_ID=$(aws ec2 describe-tags --filters Name=resource-type,Values=vpc,Name=tag:Name,Values=weave-ecs-demo-vpc --query 'Tags[0].ResourceId' --output text) 81 | GW_ID=$(aws ec2 describe-tags --filters Name=resource-type,Values=internet-gateway,Name=tag:Name,Values=weave-ecs-demo --query 'Tags[0].ResourceId' --output text) 82 | aws ec2 detach-internet-gateway --internet-gateway-id $GW_ID --vpc-id $VPC_ID 83 | aws ec2 delete-internet-gateway --internet-gateway-id $GW_ID 84 | echo "done" 85 | 86 | # Subnet 87 | echo -n "Deleting Subnet (weave-ecs-demo-subnet) .. " 88 | SUBNET_ID=$(aws ec2 describe-tags --filters Name=resource-type,Values=subnet,Name=tag:Name,Values=weave-ecs-demo-subnet --query 'Tags[0].ResourceId' --output text) 89 | aws ec2 delete-subnet --subnet-id $SUBNET_ID 90 | echo "done" 91 | 92 | # VPC 93 | echo -n "Deleting VPC (weave-ecs-demo-vpc) .. " 94 | aws ec2 delete-vpc --vpc-id $VPC_ID 95 | echo "done" 96 | 97 | # Cluster 98 | echo -n "Deleting ECS cluster (weave-ecs-demo-cluster) .. " 99 | aws ecs delete-cluster --cluster weave-ecs-demo-cluster > /dev/null 100 | echo "done" 101 | -------------------------------------------------------------------------------- /aws-ecs/data/set-ecs-cluster-name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo ECS_CLUSTER=weave-ecs-demo-cluster >> /etc/ecs/ecs.config 3 | -------------------------------------------------------------------------------- /aws-ecs/data/weave-ecs-demo-containers.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "dataproducer", 4 | "entryPoint": [ 5 | "sh", 6 | "-c" 7 | ], 8 | "command": [ 9 | "while true; do echo 'Hi, this is the data producer in' `hostname -i | awk '{ print $1 }'` | nc -q 0 -l -p 4540; done" 10 | ], 11 | "essential": true, 12 | "memory": 300, 13 | "cpu": 10, 14 | "image": "2opremio\/weaveecsdemo" 15 | }, 16 | { 17 | "name": "httpserver", 18 | "environment": [ 19 | { 20 | "name": "DATA_PRODUCER_NAME", 21 | "value": "dataproducer" 22 | } 23 | ], 24 | "portMappings": [ 25 | { 26 | "hostPort": 80, 27 | "containerPort": 80, 28 | "protocol": "tcp" 29 | } 30 | ], 31 | "entryPoint": [ 32 | "bash", 33 | "-c" 34 | ], 35 | "command": [ 36 | "set -x; sleep 7; while true; do DATA_PRODUCER_MESSAGE=`nc ${DATA_PRODUCER_NAME} 4540`; HTML=\" Weaveworks Amazon ECS Sample App<\/title> <style>body {margin-top: 40px; background-color: #333;} <\/style> <\/head><body> <div style=color:white;text-align:center><h1>Chosen data producer message:<\/h1> <h2>${DATA_PRODUCER_MESSAGE}<\/h2> <\/div>\"; echo -e \"HTTP/1.1 200 OK\\r\\nContent-Type: text/html\\r\\nConnection: close\\r\\nContent-Length: $(echo $HTML | wc -c)\\r\\n\\r\\n$HTML\" | nc -q 0 -l -p 80; done" 37 | ], 38 | "essential": true, 39 | "memory": 300, 40 | "cpu": 10, 41 | "image": "2opremio\/weaveecsdemo" 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /aws-ecs/data/weave-ecs-policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": [ 4 | { 5 | "Effect": "Allow", 6 | "Action": [ 7 | "ecs:CreateCluster", 8 | "ecs:DeregisterContainerInstance", 9 | "ecs:DiscoverPollEndpoint", 10 | "ecs:Poll", 11 | "ecs:RegisterContainerInstance", 12 | "ecs:Submit*", 13 | "ecs:ListClusters", 14 | "ecs:ListContainerInstances", 15 | "ecs:DescribeContainerInstances", 16 | "ecs:ListServices", 17 | "ecs:DescribeTasks", 18 | "ecs:DescribeServices", 19 | "ec2:DescribeInstances", 20 | "ec2:DescribeTags", 21 | "autoscaling:DescribeAutoScalingInstances" 22 | ], 23 | "Resource": [ 24 | "*" 25 | ] 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /aws-ecs/data/weave-ecs-role.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": { 4 | "Effect": "Allow", 5 | "Principal": {"Service": "ec2.amazonaws.com"}, 6 | "Action": "sts:AssumeRole" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /aws-ecs/images/ecs-weave-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/aws-ecs/images/ecs-weave-diagram.png -------------------------------------------------------------------------------- /aws-ecs/images/httpserver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/aws-ecs/images/httpserver.png -------------------------------------------------------------------------------- /aws-ecs/images/overview-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/aws-ecs/images/overview-diagram.png -------------------------------------------------------------------------------- /aws-ecs/images/scope-cloud-main-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/aws-ecs/images/scope-cloud-main-page.png -------------------------------------------------------------------------------- /aws-ecs/images/scope-early-access.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/aws-ecs/images/scope-early-access.png -------------------------------------------------------------------------------- /aws-ecs/images/scope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/aws-ecs/images/scope.png -------------------------------------------------------------------------------- /aws-ecs/images/weave-cloud-main-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/aws-ecs/images/weave-cloud-main-page.png -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/Dockerfile-simple-apache: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | MAINTAINER fintan@weave.works 3 | RUN apt-get -y update 4 | RUN apt-get -y install apache2 5 | RUN apt-get -y install php5 libapache2-mod-php5 php5-mcrypt 6 | RUN sed -e "s/DirectoryIndex/DirectoryIndex index.php/" < /etc/apache2/mods-enabled/dir.conf > /tmp/foo.sed 7 | RUN mv /tmp/foo.sed /etc/apache2/mods-enabled/dir.conf 8 | ADD example/index.php /var/www/html/ 9 | CMD ["/usr/sbin/apache2ctl", "-D FOREGROUND" ] 10 | -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/Dockerfile-simple-nginx: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | RUN rm /etc/nginx/conf.d/default.conf 3 | RUN rm /etc/nginx/conf.d/example_ssl.conf 4 | COPY nginx.conf /etc/nginx/conf.d/default.conf 5 | -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/access-aws-hosts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIRNAME=`dirname $0` 4 | 5 | if [ $DIRNAME = "." ]; then 6 | DIRNAME=`pwd` 7 | fi 8 | 9 | MY_KEY=$DIRNAME/$WEAVEDEMO_GROUPNAME-key.pem 10 | WEAVEDEMO_ENVFILE=$DIRNAME/weavedemo.env 11 | 12 | if [ ! -f $WEAVEDEMO_ENVFILE ]; then 13 | echo "Unable to find weavedemo.env, exiting" 14 | exit 1 15 | fi 16 | 17 | . $WEAVEDEMO_ENVFILE 18 | 19 | CURL=curl 20 | 21 | type -P "$CURL" >/dev/null 2>&1 && echo "Connecting to Nginx in Weave on AWS demo" || { echo "curl not found, exiting"; exit 1; } 22 | 23 | for i in `seq 1 6` 24 | do 25 | curl $WEAVE_AWS_DEMO_HOST1 26 | done 27 | -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/cleanup-aws.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Weave Demo Quick Cleanup Script 4 | # 5 | 6 | # 7 | # This script will cleanup a weavedemo AWS environment, please use with care. 8 | # if you have any doubts at all as to what this script does use the AWS console 9 | # to shutdown and remove these demo instances. 10 | # 11 | 12 | WEAVEDEMO_GROUPNAME=${WEAVEDEMO_GROUPNAME:-weavedemo} 13 | WEAVEDEMO_KEY=${MY_KEY:-$WEAVEDEMO_GROUPNAME-key} 14 | MY_SLEEP=0 15 | 16 | DIRNAME=`dirname $0` 17 | 18 | if [ $DIRNAME = "." ]; then 19 | DIRNAME=`pwd` 20 | fi 21 | 22 | MY_KEY=$DIRNAME/$WEAVEDEMO_GROUPNAME-key.pem 23 | 24 | AWS=aws 25 | 26 | type -P "$AWS" >/dev/null 2>&1 && echo "Cleaning up Weave AWS Demo environment" || { echo "aws not found, exiting"; exit 1; } 27 | 28 | MY_R_FILTER="Name=instance-state-name,Values=running" 29 | MY_GROUP_FILTER="Name=instance.group-name,Values=$WEAVEDEMO_GROUPNAME" 30 | 31 | for i in `aws ec2 describe-instances --filters $MY_R_FILTER $MY_GROUP_FILTER --output text | grep ^INSTANCES | awk '{print $8}'` 32 | do 33 | echo "Terminating AWS Instance $i" 34 | aws ec2 terminate-instances --instance-ids $i 35 | MY_SLEEP=60 36 | done 37 | 38 | # We need to wait a bit for the instances to disapper, so we just sleep" 39 | 40 | if [ $MY_SLEEP -gt 0 ]; then 41 | echo "Sleeping for $MY_SLEEP seconds to allow all instances to terminate" 42 | sleep $MY_SLEEP 43 | fi 44 | 45 | aws ec2 describe-key-pairs --key-names $WEAVEDEMO_KEY >/dev/null 2>&1 46 | if [ $? == 0 ]; then 47 | echo "Deleting AWS key pair $WEAVEDEMO_KEY" 48 | aws ec2 delete-key-pair --key-name $WEAVEDEMO_KEY 49 | fi 50 | 51 | aws ec2 describe-security-groups --group-names $WEAVEDEMO_GROUPNAME >/dev/null 2>&1 52 | if [ $? == 0 ]; then 53 | echo "Deleting AWS security group $WEAVEDEMO_GROUPNAME" 54 | aws ec2 delete-security-group --group-name $WEAVEDEMO_GROUPNAME 55 | fi 56 | 57 | rm -f $MY_KEY 58 | -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/data/ami-list.csv: -------------------------------------------------------------------------------- 1 | # region, ami 2 | eu-west-1,ami-7dc8ab0a 3 | ap-northeast-1,ami-3b71953b 4 | ap-southeast-1,ami-d4f1c486 5 | ap-southeast-2,ami-a5b2c59f 6 | eu-central-1,ami-b683b0ab 7 | sa-east-1,ami-c744fbda 8 | us-east-1,ami-08f8b160 9 | us-west-1,ami-7e9d863b 10 | us-west-2,ami-830a2fb3 11 | -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/demo-aws-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Weave Nginx AWS Demo Setup 4 | # 5 | # This demo is self contained, but for real world work you should provision and 6 | # manage your amazon environment with something like chef or puppet. 7 | # 8 | # We also interact with the aws cli output using their --output text interface 9 | # which you really want to avoid 10 | # 11 | 12 | AWS=aws 13 | WEAVEDEMO_CIDR=${WEAVEDEMO_CIDR:-0.0.0.0/0} 14 | WEAVEDEMO_GROUPNAME=${WEAVEDEMO_GROUPNAME:-weavedemo} 15 | WEAVEDEMO_HOSTCOUNT=${WEAVEDEMO_HOSTCOUNT:-2} 16 | AWS_AMI=${AWS_AMI:-} 17 | SSH_OPTS=${SSH_OPTS:-"-o StrictHostKeyChecking=no"} 18 | DIRNAME=`dirname $0` 19 | 20 | if [ $DIRNAME = "." ]; then 21 | DIRNAME=`pwd` 22 | fi 23 | 24 | AMI_LIST=$DIRNAME/data/ami-list.csv 25 | MY_KEY=$DIRNAME/$WEAVEDEMO_GROUPNAME-key.pem 26 | WEAVEDEMO_ENVFILE=$DIRNAME/weavedemo.env 27 | KEYPAIR=$WEAVEDEMO_GROUPNAME-key 28 | MY_R_FILTER="Name=instance-state-name,Values=running" 29 | MY_G_FILTER="Name=instance.group-name,Values=$WEAVEDEMO_GROUPNAME" 30 | MY_SSH="ssh -i $MY_KEY" 31 | HOSTCOUNT=0 32 | 33 | type -P "$AWS" >/dev/null 2>&1 && echo "Setting up Weave, Docker and Nginx on AWS Demo" || { echo "aws not found, exiting"; exit 1; } 34 | 35 | # we keep a list of ami's that we use, this is pulled from 36 | # http://cloud-images.ubuntu.com/locator/ec2/ 37 | # but you really should check for an update 38 | 39 | if [ ! -f $AMI_LIST ]; then 40 | echo "No AMI List found, exiting" 41 | exit 1 42 | fi 43 | 44 | if [ -f $MY_KEY ]; then 45 | echo "Found a prexisting weavedemo key, exiting" 46 | echo "You could try running cleanup-weave-aws-demo.sh in this directory" 47 | exit 1 48 | fi 49 | 50 | REGION=$(aws configure list | grep region | awk '{print $2}') 51 | 52 | if [ -z $AWS_AMI ]; then 53 | echo "Selecting an AMI to use for the $REGION region" 54 | AWS_AMI=$(grep $REGION $AMI_LIST | cut -d"," -f2) 55 | echo "Using AMI $AWS_AMI" 56 | else 57 | echo "Using user provided AMI of ${AWS_AMI}" 58 | fi 59 | 60 | # 61 | # this is just a quick check, if we see a weavedemo account assume we have been 62 | # run already, and exit asking the user to clean up things before running 63 | # 64 | 65 | THIS_DEMO=$(aws ec2 describe-security-groups --filters "Name=group-name,Values=$WEAVEDEMO_GROUPNAME" | grep weavedemo) 66 | 67 | if [ ! -z $THIS_DEMO ]; then 68 | echo "You appear to have a $WEAVEDEMO_GROUPNAME group setup on AWS already" 69 | echo "Please clean up any pre existing runs of the demo before proceeding" 70 | exit 1 71 | else 72 | echo "Creating a weavedemo security group" 73 | aws ec2 create-security-group --group-name $WEAVEDEMO_GROUPNAME --description "Weave Demo" 74 | fi 75 | 76 | aws ec2 authorize-security-group-ingress --group-name $WEAVEDEMO_GROUPNAME --protocol tcp --port 22 --cidr $WEAVEDEMO_CIDR 77 | aws ec2 authorize-security-group-ingress --group-name $WEAVEDEMO_GROUPNAME --protocol tcp --port 80 --cidr $WEAVEDEMO_CIDR 78 | aws ec2 authorize-security-group-ingress --group-name $WEAVEDEMO_GROUPNAME --protocol tcp --port 6783 --cidr $WEAVEDEMO_CIDR 79 | aws ec2 authorize-security-group-ingress --group-name $WEAVEDEMO_GROUPNAME --protocol udp --port 6783 --cidr $WEAVEDEMO_CIDR 80 | aws ec2 create-key-pair --key-name $KEYPAIR --query 'KeyMaterial' --output text > $MY_KEY 81 | aws ec2 run-instances --image-id $AWS_AMI --count $WEAVEDEMO_HOSTCOUNT --instance-type t1.micro --key-name $KEYPAIR --security-groups $WEAVEDEMO_GROUPNAME 82 | 83 | chmod 400 $MY_KEY 84 | 85 | echo "Waiting for one minute for our instances to initialize" 86 | sleep 60 87 | 88 | OUR_IP_ADDRESSES=$(aws ec2 describe-instances --output text --filters $MY_R_FILTER $MY_G_FILTER | grep ^ASSOCIATION | awk '{print $4}' | sort -u) 89 | 90 | if [ -f $WEAVEDEMO_ENVFILE ]; then 91 | rm -f $WEAVEDEMO_ENVFILE 92 | fi 93 | 94 | HOSTS_ARRAY= 95 | 96 | for i in $OUR_IP_ADDRESSES 97 | do 98 | echo "Installing Weave and Docker on host $i" 99 | $MY_SSH $SSH_OPTS ubuntu@$i "sudo apt-get install -y apt-transport-https" 100 | $MY_SSH $SSH_OPTS ubuntu@$i "sudo sh -c 'echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list'" 101 | $MY_SSH $SSH_OPTS ubuntu@$i "sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9" 102 | $MY_SSH $SSH_OPTS ubuntu@$i "sudo apt-get update" 103 | $MY_SSH $SSH_OPTS ubuntu@$i "sudo apt-get install -y lxc-docker" 104 | $MY_SSH $SSH_OPTS ubuntu@$i "sudo wget -O /usr/local/bin/weave https://github.com/weaveworks/weave/releases/download/latest_release/weave" 105 | $MY_SSH $SSH_OPTS ubuntu@$i "sudo chmod a+x /usr/local/bin/weave" 106 | HOSTCOUNT=`expr $HOSTCOUNT + 1` 107 | echo "export WEAVE_AWS_DEMO_HOST$HOSTCOUNT=$i" >> $WEAVEDEMO_ENVFILE 108 | HOSTS_ARRAY=$(echo "$HOSTS_ARRAY $i") 109 | done 110 | 111 | HOSTS_ARRAY=$(echo $HOSTS_ARRAY | sed -e "s/^\s+//") 112 | echo "export WEAVE_AWS_DEMO_HOSTCOUNT=$WEAVEDEMO_HOSTCOUNT" >> $WEAVEDEMO_ENVFILE 113 | echo "export WEAVE_AWS_DEMO_HOSTS=($HOSTS_ARRAY)" >> $WEAVEDEMO_ENVFILE 114 | -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/example/index.php: -------------------------------------------------------------------------------- 1 | { 2 | "message" : "Hello Weave - nginx example", 3 | "hostname" : "<?php echo gethostname() ?>", 4 | "date" : "<?php echo date('Y-m-d H:i:s') ?>" 5 | } 6 | 7 | -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/example/nginx.conf: -------------------------------------------------------------------------------- 1 | upstream weavedemo { 2 | server ws1.weave.local; 3 | server ws2.weave.local; 4 | server ws3.weave.local; 5 | server ws4.weave.local; 6 | server ws5.weave.local; 7 | server ws6.weave.local; 8 | } 9 | 10 | server { 11 | listen 80; 12 | 13 | location / { 14 | proxy_pass http://weavedemo; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /aws-nginx-ubuntu-simple/launch-aws-nginx-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Weave Nginx AWS Demo - Setup Weave and our containers 4 | # 5 | 6 | WEAVEDEMO_GROUPNAME=${WEAVEDEMO_GROUPNAME:-weavedemo} 7 | WEAVEDEMO_HOSTCOUNT=${WEAVEDEMO_HOSTCOUNT:-2} 8 | AWS_AMI=${AWS_AMI:-} 9 | SSH_OPTS=${SSH_OPTS:-"-o StrictHostKeyChecking=no"} 10 | DIRNAME=`dirname $0` 11 | 12 | if [ $DIRNAME = "." ]; then 13 | DIRNAME=`pwd` 14 | fi 15 | 16 | MY_KEY=$DIRNAME/$WEAVEDEMO_GROUPNAME-key.pem 17 | WEAVEDEMO_ENVFILE=$DIRNAME/weavedemo.env 18 | KEYPAIR=$WEAVEDEMO_GROUPNAME-key 19 | 20 | MY_R_FILTER="Name=instance-state-name,Values=running" 21 | MY_SSH="ssh -i $MY_KEY" 22 | DNS_OFFSET=1 23 | CONTAINER_OFFSET=1 24 | DNS_BASE=10.2.1 25 | APP_BASE=10.3.1 26 | 27 | function launchWeave() { 28 | 29 | myHostIP=$1 30 | myWeaveDnsPeer=$2 31 | myDnsOffSet=$3 32 | 33 | myDnsIp=$(echo "$DNS_BASE.$myDnsOffSet") 34 | 35 | echo "Launching Weave and WeaveDNS on $myHostIP" 36 | 37 | if [ $myHostIP == $myWeaveDnsPeer ]; then 38 | $MY_SSH $SSH_OPTS ubuntu@$myHostIP "sudo weave launch" 39 | else 40 | $MY_SSH $SSH_OPTS ubuntu@$myHostIP "sudo weave launch $myWeaveDnsPeer" 41 | fi 42 | 43 | $MY_SSH $SSH_OPTS ubuntu@$myHostIP "sudo weave launch-dns $myDnsIp/24" 44 | 45 | } 46 | 47 | function launchApacheDemo() { 48 | 49 | myHostIP=$1 50 | myContainerOffSet=$2 51 | 52 | myContainerIP=$(echo "$APP_BASE.$myContainerOffSet") 53 | myDnsName=$(echo "ws$myContainerOffSet.weave.local") 54 | 55 | echo "Launching php app container $myDnsName on $myHostIP with $myContainerIP" 56 | 57 | $MY_SSH $SSH_OPTS ubuntu@$myHostIP "sudo weave run --with-dns $myContainerIP/24 -h $myDnsName fintanr/weave-gs-nginx-apache" 58 | } 59 | 60 | function launchNginx() { 61 | 62 | myHostIP=$1 63 | myContainerOffSet=$2 64 | 65 | myContainerIP=$(echo "$APP_BASE.$myContainerOffSet") 66 | myDnsName=nginx.weave.local 67 | 68 | echo "Launching nginx front end app container $myDnsName on $myHostIP with $myContainerIP" 69 | $MY_SSH $SSH_OPTS ubuntu@$myHostIP "sudo weave run --with-dns $myContainerIP/24 -ti -h $myDnsName -d -p 80:80 fintanr/weave-gs-nginx-simple" 70 | 71 | } 72 | 73 | echo "Launching Weave and WeaveDNS on each AWS host" 74 | 75 | . $WEAVEDEMO_ENVFILE 76 | 77 | TMP_HOSTCOUNT=0 78 | 79 | while [ $TMP_HOSTCOUNT -lt $WEAVE_AWS_DEMO_HOSTCOUNT ]; do 80 | HOST_IP=${WEAVE_AWS_DEMO_HOSTS[$TMP_HOSTCOUNT]} 81 | launchWeave $HOST_IP $WEAVE_AWS_DEMO_HOST1 $DNS_OFFSET 82 | DNS_OFFSET=$(expr $DNS_OFFSET + 1) 83 | TMP_HOSTCOUNT=$(expr $TMP_HOSTCOUNT + 1) 84 | done 85 | 86 | echo "Launching 3 Simple PHP App Containers on each AWS host" 87 | 88 | TMP_HOSTCOUNT=0 89 | 90 | while [ $TMP_HOSTCOUNT -lt $WEAVE_AWS_DEMO_HOSTCOUNT ]; do 91 | HOST_IP=${WEAVE_AWS_DEMO_HOSTS[$TMP_HOSTCOUNT]} 92 | 93 | while [ `expr $CONTAINER_OFFSET % 3` -ne 0 ]; do 94 | launchApacheDemo $HOST_IP $CONTAINER_OFFSET 95 | CONTAINER_OFFSET=$(expr $CONTAINER_OFFSET + 1 ) 96 | done 97 | 98 | if [ `expr $CONTAINER_OFFSET % 3` -eq 0 ]; then 99 | launchApacheDemo $HOST_IP $CONTAINER_OFFSET 100 | fi 101 | 102 | CONTAINER_OFFSET=$(expr $CONTAINER_OFFSET + 1 ) 103 | TMP_HOSTCOUNT=$(expr $TMP_HOSTCOUNT + 1) 104 | done 105 | 106 | echo "Launching our Nginx front end" 107 | 108 | launchNginx $WEAVE_AWS_DEMO_HOST1 $CONTAINER_OFFSET 109 | -------------------------------------------------------------------------------- /aws.md: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /guides/about/aws.html 3 | title: Some notes on using AWS 4 | layout: guides 5 | --- 6 | 7 | We make use of the [Amazon Web Services (AWS) CLI 8 | tool](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) 9 | to manage and access AWS. You will need to have a valid [Amazon Web 10 | Services](http://aws.amazon.com) account, and the AWS CLI setup and 11 | configured before working through this getting started guide. Amazon 12 | provide an extensive guide on how to setup the [AWS 13 | CLI](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html). 14 | 15 | To get the correct spelling of your Amazon region, check [the 16 | list](http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region). 17 | 18 | If you aren't already using the AWS CLI, you will want to [create a 19 | user](http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_WorkingWithGroupsAndUsers.html) 20 | to run it. 21 | 22 | Then, you have to give permissions to the AWS user - this is done by 23 | [creating a 24 | group](http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_CreatingAndListingGroups.html), 25 | then assigning the user to that group, then assigning a Permission 26 | Policy to the group. AWS provide [pre-defined 27 | policies](http://docs.aws.amazon.com/IAM/latest/UserGuide/policies_managed-vs-inline.html) 28 | such as `PowerUserAccess` that will work for these guides. 29 | -------------------------------------------------------------------------------- /centos-simple/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | -------------------------------------------------------------------------------- /centos-simple/Dockerfile-curl-bash-centos: -------------------------------------------------------------------------------- 1 | FROM centos 2 | MAINTAINER ilya@weave.works 3 | CMD yum install -y curl 4 | CMD ["/bin/bash"] 5 | -------------------------------------------------------------------------------- /centos-simple/Dockerfile-hw-centos: -------------------------------------------------------------------------------- 1 | FROM centos 2 | MAINTAINER ilya@weave.works 3 | RUN yum install -y httpd 4 | RUN yum install -y php 5 | ADD example/index.php /var/www/html/ 6 | ADD example/run-httpd.sh /run-httpd.sh 7 | RUN chmod -v +x /run-httpd.sh 8 | CMD ["/run-httpd.sh"] 9 | -------------------------------------------------------------------------------- /centos-simple/DockerfileREADME.md: -------------------------------------------------------------------------------- 1 | # Getting started with Weave and Docker on CentOS - Dockerfile # 2 | 3 | For our getting started with Weave and Docker on Ubuntu, we created a small docker image, `weaveworks/weave-gs-centos-hw`. We have included the Dockerfile we used for creating this Docker image in our repo. While this is a very simple example it demonstrates how easy it is to create Docker images. 4 | 5 | ```bash 6 | MAINTAINER ilya@weave.works 7 | FROM centos 8 | RUN yum install -y httpd 9 | RUN yum install -y php 10 | ADD example/index.php /var/www/html/ 11 | ADD example/run-httpd.sh /run-httpd.sh 12 | RUN chmod -v +x /run-httpd.sh 13 | CMD ["/run-httpd.sh"] 14 | ``` 15 | 16 | A quick explanation of the Dockerfile 17 | 18 | - `FROM` - this is the image we have used as the basis for our image 19 | - `MAINTAINER` - the name and/or e-mail address of the maintainer of this image 20 | - `RUN` - a command or commands to run when creating the image 21 | - `ADD` - add a file to the docker image you are creating 22 | - `CMD` - a command or commands to run when the docker image is launched 23 | 24 | As you can see here we are using the CentOS Docker image as our basis, updating this image, installing and configuring `apache2` and `php`. We then copy a new default Apache page into place. Finally when a container is launched with this image we start an Apache webserver. 25 | 26 | The Docker documentation provides a lot more detail on [building docker images](https://docs.docker.com/reference/builder/) 27 | 28 | If you have worked through the steps in this guide you will find that this Dockerfile has been placed in the `/home/vagrant` directory on each host you created earlier. 29 | -------------------------------------------------------------------------------- /centos-simple/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic CentOS and Docker setup Vagrantfile 2 | # 3 | # Weave Getting Started Guides 4 | # 5 | 6 | require 'fileutils' 7 | require 'ipaddr' 8 | 9 | Vagrant.require_version ">= 1.6.0" 10 | 11 | VAGRANTFILE_API_VERSION = "2" 12 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 13 | SIMPLE_DOCKER_HW = File.join(File.dirname(__FILE__), "Dockerfile-hw-centos") 14 | 15 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 16 | 17 | # Defaults for config options defined in CONFIG 18 | # 19 | 20 | $num_instances = 2 21 | $instance_name_prefix = "weave-gs" 22 | $share_home = false 23 | $vm_gui = false 24 | $vm_memory = 1024 25 | $vm_cpus = 1 26 | $vm_starting_ip = "172.17.8.100" 27 | 28 | if File.exist?(CONFIG) 29 | require CONFIG 30 | end 31 | 32 | $vm_ip = $vm_starting_ip 33 | 34 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 35 | config.vm.box = "bento/centos-7.1" 36 | config.ssh.insert_key = true 37 | 38 | if Vagrant.has_plugin?("vagrant-cachier") 39 | config.cache.scope = :box 40 | end 41 | 42 | (1..$num_instances).each do |i| 43 | 44 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 45 | config.vm.hostname = vm_name 46 | 47 | # just split out the ip 48 | # 49 | 50 | ip = IPAddr.new($vm_ip) 51 | $vm_ip = ip.succ.to_s 52 | config.vm.network "private_network", ip: $vm_ip 53 | end 54 | end 55 | 56 | config.vm.provider :virtualbox do |vb| 57 | vb.gui = $vm_gui 58 | vb.memory = $vm_memory 59 | vb.cpus = $vm_cpus 60 | end 61 | 62 | # install docker packages 63 | # 64 | # https://docs.docker.com/installation/ubuntulinux/ 65 | # 66 | 67 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 68 | sudo yum -y install docker 69 | sudo systemctl start docker 70 | sudo systemctl enable docker 71 | SHELL 72 | 73 | # CentOS Sudoers file does not have /usr/local/bin in its path 74 | # by defualt 75 | # 76 | 77 | config.vm.provision "shell", privileged:true, inline: <<-SHELL 78 | sudo cat /etc/sudoers | sed "s|.*secure_path.*|&:/usr/local/bin|" > /tmp/sudoers.sed 79 | mv /tmp/sudoers.sed /etc/sudoers 80 | SHELL 81 | 82 | # for the purposes of our example we create a dockerfile to install apache 83 | 84 | if File.exist?(SIMPLE_DOCKER_HW) 85 | config.vm.provision "file", :source => "#{SIMPLE_DOCKER_HW}", :destination => "/home/vagrant/Dockerfile" 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /centos-simple/config.rb: -------------------------------------------------------------------------------- 1 | $num_instances = 2 2 | -------------------------------------------------------------------------------- /centos-simple/example/index.php: -------------------------------------------------------------------------------- 1 | { 2 | "message" : "Hello World", 3 | "date" : "<?php echo date('Y-m-d H:i:s') ?>" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /centos-simple/example/run-httpd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # forked from 4 | # https://github.com/CentOS/CentOS-Dockerfiles/blob/master/httpd/centos7/run-httpd.sh 5 | # 6 | 7 | # Make sure we're not confused by old, incompletely-shutdown httpd 8 | # context after restarting the container. httpd won't start correctly 9 | # if it thinks it is already running. 10 | rm -rf /run/httpd/* 11 | 12 | exec /usr/sbin/apachectl -D FOREGROUND 13 | -------------------------------------------------------------------------------- /coreos-simple/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic CoreOS and Docker setup Vagrantfile 2 | # 3 | # Weave Getting Started Guides 4 | # 5 | # Derived in part from CoreOS Vagrant Repo 6 | # https://github.com/coreos/coreos-vagrant 7 | # 8 | 9 | require 'fileutils' 10 | require 'ipaddr' 11 | 12 | Vagrant.require_version ">= 1.6.0" 13 | 14 | VAGRANTFILE_API_VERSION = "2" 15 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 16 | SIMPLE_DOCKER_APACHE = File.join(File.dirname(__FILE__), "Dockerfile-simple-apache") 17 | CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data") 18 | 19 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 20 | 21 | # Defaults for config options defined in CONFIG 22 | # 23 | 24 | $num_instances = 2 25 | $instance_name_prefix = "weave-gs" 26 | $share_home = false 27 | $vm_gui = false 28 | $vm_memory = 1024 29 | $vm_cpus = 1 30 | $vm_starting_ip = "172.17.8.100" 31 | 32 | if File.exist?(CONFIG) 33 | require CONFIG 34 | end 35 | 36 | $vm_ip = $vm_starting_ip 37 | 38 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 39 | config.vm.box = "coreos-stable" 40 | config.vm.box_version = ">308.0.1" 41 | config.vm.box_url = "http://stable.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json" 42 | config.ssh.insert_key = true 43 | 44 | if Vagrant.has_plugin?("vagrant-cachier") 45 | config.cache.scope = :box 46 | end 47 | 48 | (1..$num_instances).each do |i| 49 | 50 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 51 | config.vm.hostname = vm_name 52 | 53 | # just split out the ip 54 | # 55 | 56 | ip = IPAddr.new($vm_ip) 57 | $vm_ip = ip.succ.to_s 58 | config.vm.network :private_network, ip: $vm_ip 59 | end 60 | end 61 | 62 | config.vm.provider :virtualbox do |vb| 63 | vb.gui = $vm_gui 64 | vb.memory = $vm_memory 65 | vb.cpus = $vm_cpus 66 | end 67 | 68 | if File.exist?(CLOUD_CONFIG_PATH) 69 | config.vm.provision :file, :source => "#{CLOUD_CONFIG_PATH}", :destination => "/tmp/vagrantfile-user-data" 70 | config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true 71 | end 72 | 73 | # for the purposes of our example we create a dockerfile to install apache 74 | 75 | if File.exist?(SIMPLE_DOCKER_APACHE) 76 | config.vm.provision "file", :source => "#{SIMPLE_DOCKER_APACHE}", :destination => "/home/core/Dockerfile" 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /coreos-simple/config.rb: -------------------------------------------------------------------------------- 1 | $num_instances = 2 2 | -------------------------------------------------------------------------------- /coreos-simple/user-data: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | coreos: 4 | units: 5 | - name: 10-weave.network 6 | runtime: false 7 | content: | 8 | [Match] 9 | Type=bridge 10 | Name=weave* 11 | 12 | [Network] 13 | 14 | - name: install-weave.service 15 | command: start 16 | enable: true 17 | content: | 18 | [Unit] 19 | After=network-online.target 20 | After=docker.service 21 | Description=Install Weave 22 | Documentation=http://zettio.github.io/weave/ 23 | Requires=network-online.target 24 | Requires=docker.service 25 | 26 | [Service] 27 | Type=oneshot 28 | RemainAfterExit=yes 29 | ExecStartPre=/bin/mkdir -p /opt/bin/ 30 | ExecStartPre=/usr/bin/curl \ 31 | --silent \ 32 | --location \ 33 | https://github.com/weaveworks/weave/releases/download/latest_release/weave \ 34 | --output /opt/bin/weave 35 | ExecStartPre=/usr/bin/chmod +x /opt/bin/weave 36 | ExecStartPre=/usr/bin/docker pull zettio/weave:latest 37 | ExecStartPre=/usr/bin/docker pull zettio/weavetools:latest 38 | ExecStartPre=/usr/bin/docker pull zettio/weavedns:latest 39 | ExecStartPre=/usr/bin/docker pull weaveworks/weaveexec:latest 40 | ExecStart=/bin/echo Weave Installed 41 | -------------------------------------------------------------------------------- /d4m/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Visualizing Microservices with Weave Cloud on Docker for Mac 3 | --- 4 | 5 | **Note:** You are looking at our `old-guides` repository. The guides in here haven't been updated in a while. 6 | They might or might not work for you. We are keeping them around for informational purposes. 7 | 8 | --- 9 | 10 | In this guide you will learn how Weave Cloud can help you understand and troubleshoot a microservices-based app. The app you will deploy is an online store, called the Socks Shop that consists of several microservices written in three different languages: Node.js, Spring Boot and Go Kit, and which also uses the data services, RabbitMQ and MongoDB. 11 | 12 | Docker and Docker Compose will be used to deploy the Socks Shop onto your local machine, and then you will launch Weave Scope probes to push metrics to Weave Cloud so that you can observe the topology of the app and explore how it works. Weave Scope probes monitor network traffic and builds a topology graph in real-time. The view in Weave Cloud is augmented with metadata from the Docker API along with several different systems metrics that allow you to troubleshoot your app. 13 | 14 | The following topics are discussed: 15 | 16 | * [Installing Docker for Mac](#install-docker-for-mac) 17 | * [Deploying the Socks Shop App](#deploy-the-demo-app) 18 | * [Signing Up for Weave Cloud](#sign-up-to-weave-cloud) 19 | * [Connecting the Scope Probes to Weave Cloud](#connect-scope-probe-to-weave-cloud) 20 | 21 | 22 | <h3 id="install-docker-for-mac">Installing Docker for Mac</h3> 23 | 24 | If you haven't installed Docker for Mac, please follow the installation instructions on <a href="https://docs.docker.com/docker-for-mac/" target="_blank"> Docker website </a>. 25 | 26 | Once it's running you will see <img alt="Docker Icon in the Mac OS menu bar" src="./images/docker-for-mac-menu-bar-icon.png" 27 | style="height: 1em;" /> in your menu bar. 28 | 29 | 30 | <h3 id="deploy-the-demo-app">Deploying the Socks Shop App</h3> 31 | 32 | To deploy The Socks Shop: 33 | 34 | **1. Get the code:** 35 | 36 | ~~~bash 37 | git clone https://github.com/microservices-demo/microservices-demo.git 38 | cd microservices-demo/deploy/docker-compose 39 | ~~~ 40 | 41 | **2. Deploy the Socks Shop app:** 42 | 43 | ~~~bash 44 | docker-compose up -d 45 | open http://localhost 46 | ~~~ 47 | 48 | >**Note:** If localhost does not load the Socks Shop, then use the IP `127.0.0.1` instead. 49 | 50 | Once the app displays in your browser, you can test the functionality. Login using `user1`/`password1`, and then put an item in the basket and proceed to the checkout. 51 | 52 | ![The Socks Shop](./images/socks-shop.png) 53 | 54 | 55 | [demo-app]: https://github.com/weaveworks/weaveDemo 56 | 57 | 58 | <h3 id="sign-up-to-weave-cloud">Signing Up for Weave Cloud</h3> 59 | 60 | To visualize microservices, first sign up for Weave Cloud: 61 | 62 | 1. Go to <a href="https://cloud.weave.works" target="_blank"> Weave Cloud </a> 63 | 2. Sign up using either a Github, or Google account or use an email address. 64 | 3. Obtain the cloud service token from the User settings screen: 65 | 66 | ![Obtain service token for Weave Cloud](./images/weave-cloud-token-screenshot.png) 67 | 68 | <h3 id="connect-scope-probe-to-weave-cloud">Connecting the Scope Probes to Weave Cloud</h3> 69 | 70 | Install and launch the Weave Scope probes: 71 | 72 | ~~~bash 73 | sudo curl --silent --location https://git.io/scope --output /usr/local/bin/scope 74 | sudo chmod +x /usr/local/bin/scope 75 | scope launch --service-token=<WEAVE_CLOUD_TOKEN> 76 | ~~~ 77 | 78 | **Where,** 79 | 80 | * `<WEAVE_CLOUD_TOKEN>` - is the token that appears on the settings page, once you’ve logged into Weave Cloud. 81 | 82 | **Note:** To set the Weave Cloud controls to read-only for all users, you can launch scope with the --probe.no-controls flag. In this demo, you will be launching a terminal window and viewing messages between microservices, and so this flag is not necessary. However, you may want to keep this flag in mind when using Weave Cloud and sharing your infrastructure views with others outside of your organization. 83 | 84 | Weave Cloud controls allow you to stop, start and pause containers. They also enable you to launch a terminal and interact directly with your containers. 85 | 86 | 87 | <h3 id="run-the-load-test">Running the Load Test</h3> 88 | 89 | To fully appreciate the topology of this app, you will need to run a load on the app. 90 | 91 | Run a load test with the following: 92 | 93 | ~~~bash 94 | docker run -ti --rm --name=LOAD_TEST --net=dockercompose_default \ 95 | --net=shop_external \ 96 | weaveworksdemos/load-test -h edge-router -r 100 -c 2 97 | ~~~ 98 | 99 | With the load test running, you can observe the different services communicating by clicking on the Load Test container in Weave Cloud. From the metrics panel, open Load Test's terminal to view the messages. With the load test running, the Sock Shop topology will form in Weave Cloud. 100 | 101 | ![Weave Load Test](./images/load-test-messages.png) 102 | 103 | ### Tearing Down the App 104 | 105 | To clean up the app from your system: 106 | 107 | ~~~bash 108 | docker-compose down 109 | ~~~ 110 | 111 | ### Conclusions 112 | 113 | In this guide, an online store using a microservices-based approach was launched into the Weave Cloud, where you could observe communication events and also interact with the topology of the microservices app. 114 | 115 | If you have any questions or comments, we would be happy to hear from you, visit [Weave Help & Support](/help/) for information on ways to contact us. 116 | 117 | **Further Reading** 118 | 119 | * [Introducing Weave Cloud](/docs/scope/latest/introducing/) 120 | * [Installing Weave Scope](/docs/scope/latest/installing/) 121 | 122 | 123 | -------------------------------------------------------------------------------- /d4m/images/docker-for-mac-menu-bar-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/d4m/images/docker-for-mac-menu-bar-icon.png -------------------------------------------------------------------------------- /d4m/images/load-test-messages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/d4m/images/load-test-messages.png -------------------------------------------------------------------------------- /d4m/images/socks-shop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/d4m/images/socks-shop.png -------------------------------------------------------------------------------- /d4m/images/weave-cloud-token-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/d4m/images/weave-cloud-token-screenshot.png -------------------------------------------------------------------------------- /example-componentized-guide/README.md: -------------------------------------------------------------------------------- 1 | <h1 id="content-before-the-include">Content before the include</h1> 2 | 3 | Here is some content before the include. 4 | 5 | And now for the include. 6 | 7 | * Not real HTML 8 | 9 | <h1 id="hello-world">Hello, world.</h1> 10 | 11 | I got included! 12 | 13 | 14 | <h1 id="content-after-the-include">Content after the include</h1> 15 | 16 | Here is some content after the include. 17 | -------------------------------------------------------------------------------- /example-componentized-guide/_README/README.md: -------------------------------------------------------------------------------- 1 | # Content before the include 2 | 3 | Here is some content before the include. 4 | 5 | And now for the include. 6 | 7 | {"gitdown": "include", "file": "../../_includes/hello-world.md"} 8 | 9 | # Content after the include 10 | 11 | Here is some content after the include. 12 | -------------------------------------------------------------------------------- /example-componentized-guide/build.sh: -------------------------------------------------------------------------------- 1 | ../_includes/build.sh -------------------------------------------------------------------------------- /images/2_Node_HAProxy_AWS_Example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/2_Node_HAProxy_AWS_Example.png -------------------------------------------------------------------------------- /images/2_Node_Nginx_AWS_Example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/2_Node_Nginx_AWS_Example.png -------------------------------------------------------------------------------- /images/3_Node_Nginx_Example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/3_Node_Nginx_Example.png -------------------------------------------------------------------------------- /images/Microservices_Seneca_Weave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/Microservices_Seneca_Weave.png -------------------------------------------------------------------------------- /images/Simple_Weave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/Simple_Weave.png -------------------------------------------------------------------------------- /images/Weave_LoadBalance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/Weave_LoadBalance.png -------------------------------------------------------------------------------- /images/cloudformation-launch-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/cloudformation-launch-stack.png -------------------------------------------------------------------------------- /images/hello-screencast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/hello-screencast.png -------------------------------------------------------------------------------- /images/kubernetes/coreos/guestbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/kubernetes/coreos/guestbook.png -------------------------------------------------------------------------------- /images/muticast/AWS-1-select-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/AWS-1-select-template.png -------------------------------------------------------------------------------- /images/muticast/AWS-2-specify-details-parameters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/AWS-2-specify-details-parameters.png -------------------------------------------------------------------------------- /images/muticast/AWS-3-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/AWS-3-options.png -------------------------------------------------------------------------------- /images/muticast/AWS-4-create-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/AWS-4-create-stack.png -------------------------------------------------------------------------------- /images/muticast/add-container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/add-container.png -------------------------------------------------------------------------------- /images/muticast/containers-multicast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/containers-multicast.png -------------------------------------------------------------------------------- /images/muticast/create-service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/create-service.png -------------------------------------------------------------------------------- /images/muticast/create-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/create-stack.png -------------------------------------------------------------------------------- /images/muticast/metrics-multicast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/metrics-multicast.png -------------------------------------------------------------------------------- /images/muticast/multicast-scope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/multicast-scope.png -------------------------------------------------------------------------------- /images/muticast/service-name-definition-instances.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/service-name-definition-instances.png -------------------------------------------------------------------------------- /images/muticast/task-name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/muticast/task-name.png -------------------------------------------------------------------------------- /images/weave-cloud-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/weave-cloud-token.png -------------------------------------------------------------------------------- /images/weave-scope/container-metrics-images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/weave-scope/container-metrics-images.png -------------------------------------------------------------------------------- /images/weave-scope/weave-scope-application-layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/weave-scope/weave-scope-application-layers.png -------------------------------------------------------------------------------- /images/weave-scope/weave-scope-applications-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/weave-scope/weave-scope-applications-view.png -------------------------------------------------------------------------------- /images/weave-scope/weave-scope-containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/weave-scope/weave-scope-containers.png -------------------------------------------------------------------------------- /images/weave-scope/weave-scope-database-metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/weave-scope/weave-scope-database-metrics.png -------------------------------------------------------------------------------- /images/weave-scope/weave-scope-group-containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/images/weave-scope/weave-scope-group-containers.png -------------------------------------------------------------------------------- /imports/coreos-vagrant/.gitattributes: -------------------------------------------------------------------------------- 1 | # Detect text files automatically 2 | * text=auto 3 | 4 | # Force Unix-style line endings on these files 5 | user-data* text eol=lf 6 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant/ 2 | log/ 3 | user-data 4 | config.rb 5 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | CoreOS projects are [Apache 2.0 licensed](LICENSE) and accept contributions via 4 | GitHub pull requests. This document outlines some of the conventions on 5 | development workflow, commit message formatting, contact points and other 6 | resources to make it easier to get your contribution accepted. 7 | 8 | # Certificate of Origin 9 | 10 | By contributing to this project you agree to the Developer Certificate of 11 | Origin (DCO). This document was created by the Linux Kernel community and is a 12 | simple statement that you, as a contributor, have the legal right to make the 13 | contribution. See the [DCO](DCO) file for details. 14 | 15 | # Email and Chat 16 | 17 | The project currently uses the general CoreOS email list and IRC channel: 18 | - Email: [coreos-dev](https://groups.google.com/forum/#!forum/coreos-dev) 19 | - IRC: #[coreos](irc://irc.freenode.org:6667/#coreos) IRC channel on freenode.org 20 | 21 | Please avoid emailing maintainers found in the MAINTAINERS file directly. They 22 | are very busy and read the mailing lists. 23 | 24 | ## Getting Started 25 | 26 | - Fork the repository on GitHub 27 | - Read the [README](README.md) for build and test instructions 28 | - Play with the project, submit bugs, submit patches! 29 | 30 | ## Contribution Flow 31 | 32 | This is a rough outline of what a contributor's workflow looks like: 33 | 34 | - Create a topic branch from where you want to base your work (usually master). 35 | - Make commits of logical units. 36 | - Make sure your commit messages are in the proper format (see below). 37 | - Push your changes to a topic branch in your fork of the repository. 38 | - Make sure the tests pass, and add any new tests as appropriate. 39 | - Submit a pull request to the original repository. 40 | 41 | Thanks for your contributions! 42 | 43 | ### Format of the Commit Message 44 | 45 | We follow a rough convention for commit messages that is designed to answer two 46 | questions: what changed and why. The subject line should feature the what and 47 | the body of the commit should describe the why. 48 | 49 | ``` 50 | scripts: add the test-cluster command 51 | 52 | this uses tmux to setup a test cluster that you can easily kill and 53 | start for debugging. 54 | 55 | Fixes #38 56 | ``` 57 | 58 | The format can be described more formally as follows: 59 | 60 | ``` 61 | <subsystem>: <what changed> 62 | <BLANK LINE> 63 | <why this change was made> 64 | <BLANK LINE> 65 | <footer> 66 | ``` 67 | 68 | The first line is the subject and should be no longer than 70 characters, the 69 | second line is always blank, and other lines should be wrapped at 80 characters. 70 | This allows the message to be easier to read on GitHub as well as in various 71 | git tools. 72 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/DCO: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 660 York Street, Suite 102, 6 | San Francisco, CA 94110 USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this 9 | license document, but changing it is not allowed. 10 | 11 | 12 | Developer's Certificate of Origin 1.1 13 | 14 | By making a contribution to this project, I certify that: 15 | 16 | (a) The contribution was created in whole or in part by me and I 17 | have the right to submit it under the open source license 18 | indicated in the file; or 19 | 20 | (b) The contribution is based upon previous work that, to the best 21 | of my knowledge, is covered under an appropriate open source 22 | license and I have the right under that license to submit that 23 | work with modifications, whether created in whole or in part 24 | by me, under the same open source license (unless I am 25 | permitted to submit under a different license), as indicated 26 | in the file; or 27 | 28 | (c) The contribution was provided directly to me by some other 29 | person who certified (a), (b) or (c) and I have not modified 30 | it. 31 | 32 | (d) I understand and agree that this project and the contribution 33 | are public and that a record of the contribution (including all 34 | personal information I submit with it, including my sign-off) is 35 | maintained indefinitely and may be redistributed consistent with 36 | this project or the open source license(s) involved. 37 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/MAINTAINERS: -------------------------------------------------------------------------------- 1 | Jon Boulle <jonathan.boulle@coreos.com> (@jonboulle) 2 | Brian Waldon <brian.waldon@coreos.com> (@bcwaldon) 3 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/NOTICE: -------------------------------------------------------------------------------- 1 | CoreOS Project 2 | Copyright 2014 CoreOS, Inc 3 | 4 | This product includes software developed at CoreOS, Inc. 5 | (http://www.coreos.com/). 6 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/README.md: -------------------------------------------------------------------------------- 1 | # CoreOS Vagrant 2 | 3 | This repo provides a template Vagrantfile to create a CoreOS virtual machine using the VirtualBox software hypervisor. 4 | After setup is complete you will have a single CoreOS virtual machine running on your local machine. 5 | 6 | ## Streamlined setup 7 | 8 | 1) Install dependencies 9 | 10 | * [VirtualBox][virtualbox] 4.3.10 or greater. 11 | * [Vagrant][vagrant] 1.6 or greater. 12 | 13 | 2) Clone this project and get it running! 14 | 15 | ``` 16 | git clone https://github.com/coreos/coreos-vagrant/ 17 | cd coreos-vagrant 18 | ``` 19 | 20 | 3) Startup and SSH 21 | 22 | There are two "providers" for Vagrant with slightly different instructions. 23 | Follow one of the following two options: 24 | 25 | **VirtualBox Provider** 26 | 27 | The VirtualBox provider is the default Vagrant provider. Use this if you are unsure. 28 | 29 | ``` 30 | vagrant up 31 | vagrant ssh 32 | ``` 33 | 34 | **VMware Provider** 35 | 36 | The VMware provider is a commercial addon from Hashicorp that offers better stability and speed. 37 | If you use this provider follow these instructions. 38 | 39 | VMware Fusion: 40 | ``` 41 | vagrant up --provider vmware_fusion 42 | vagrant ssh 43 | ``` 44 | 45 | VMware Workstation: 46 | ``` 47 | vagrant up --provider vmware_workstation 48 | vagrant ssh 49 | ``` 50 | 51 | ``vagrant up`` triggers vagrant to download the CoreOS image (if necessary) and (re)launch the instance 52 | 53 | ``vagrant ssh`` connects you to the virtual machine. 54 | Configuration is stored in the directory so you can always return to this machine by executing vagrant ssh from the directory where the Vagrantfile was located. 55 | 56 | 4) Get started [using CoreOS][using-coreos] 57 | 58 | [virtualbox]: https://www.virtualbox.org/ 59 | [vagrant]: https://www.vagrantup.com/downloads.html 60 | [using-coreos]: http://coreos.com/docs/using-coreos/ 61 | 62 | #### Shared Folder Setup 63 | 64 | There is optional shared folder setup. 65 | You can try it out by adding a section to your Vagrantfile like this. 66 | 67 | ``` 68 | config.vm.network "private_network", ip: "172.17.8.150" 69 | config.vm.synced_folder ".", "/home/core/share", id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp'] 70 | ``` 71 | 72 | After a 'vagrant reload' you will be prompted for your local machine password. 73 | 74 | #### Provisioning with user-data 75 | 76 | The Vagrantfile will provision your CoreOS VM(s) with [coreos-cloudinit][coreos-cloudinit] if a `user-data` file is found in the project directory. 77 | coreos-cloudinit simplifies the provisioning process through the use of a script or cloud-config document. 78 | 79 | To get started, copy `user-data.sample` to `user-data` and make any necessary modifications. 80 | Check out the [coreos-cloudinit documentation][coreos-cloudinit] to learn about the available features. 81 | 82 | [coreos-cloudinit]: https://github.com/coreos/coreos-cloudinit 83 | 84 | #### Configuration 85 | 86 | The Vagrantfile will parse a `config.rb` file containing a set of options used to configure your CoreOS cluster. 87 | See `config.rb.sample` for more information. 88 | 89 | ## Cluster Setup 90 | 91 | Launching a CoreOS cluster on Vagrant is as simple as configuring `$num_instances` in a `config.rb` file to 3 (or more!) and running `vagrant up`. 92 | Make sure you provide a fresh discovery URL in your `user-data` if you wish to bootstrap etcd in your cluster. 93 | 94 | ## New Box Versions 95 | 96 | CoreOS is a rolling release distribution and versions that are out of date will automatically update. 97 | If you want to start from the most up to date version you will need to make sure that you have the latest box file of CoreOS. 98 | Simply remove the old box file and vagrant will download the latest one the next time you `vagrant up`. 99 | 100 | ``` 101 | vagrant box remove coreos --provider vmware_fusion 102 | vagrant box remove coreos --provider vmware_workstation 103 | vagrant box remove coreos --provider virtualbox 104 | ``` 105 | 106 | ## Docker Forwarding 107 | 108 | By setting the `$expose_docker_tcp` configuration value you can forward a local TCP port to docker on 109 | each CoreOS machine that you launch. The first machine will be available on the port that you specify 110 | and each additional machine will increment the port by 1. 111 | 112 | Follow the [Enable Remote API instructions][coreos-enabling-port-forwarding] to get the CoreOS VM setup to work with port forwarding. 113 | 114 | [coreos-enabling-port-forwarding]: https://coreos.com/docs/launching-containers/building/customizing-docker/#enable-the-remote-api-on-a-new-socket 115 | 116 | Then you can then use the `docker` command from your local shell by setting `DOCKER_HOST`: 117 | 118 | export DOCKER_HOST=tcp://localhost:2375 119 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # # vi: set ft=ruby : 3 | 4 | require 'fileutils' 5 | 6 | Vagrant.require_version ">= 1.6.0" 7 | 8 | CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data") 9 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 10 | 11 | # Defaults for config options defined in CONFIG 12 | $num_instances = 1 13 | $instance_name_prefix = "core" 14 | $update_channel = "alpha" 15 | $image_version = "current" 16 | $enable_serial_logging = false 17 | $share_home = false 18 | $vm_gui = false 19 | $vm_memory = 1024 20 | $vm_cpus = 1 21 | $shared_folders = {} 22 | $forwarded_ports = {} 23 | 24 | # Attempt to apply the deprecated environment variable NUM_INSTANCES to 25 | # $num_instances while allowing config.rb to override it 26 | if ENV["NUM_INSTANCES"].to_i > 0 && ENV["NUM_INSTANCES"] 27 | $num_instances = ENV["NUM_INSTANCES"].to_i 28 | end 29 | 30 | if File.exist?(CONFIG) 31 | require CONFIG 32 | end 33 | 34 | # Use old vb_xxx config variables when set 35 | def vm_gui 36 | $vb_gui.nil? ? $vm_gui : $vb_gui 37 | end 38 | 39 | def vm_memory 40 | $vb_memory.nil? ? $vm_memory : $vb_memory 41 | end 42 | 43 | def vm_cpus 44 | $vb_cpus.nil? ? $vm_cpus : $vb_cpus 45 | end 46 | 47 | Vagrant.configure("2") do |config| 48 | # always use Vagrants insecure key 49 | config.ssh.insert_key = false 50 | 51 | config.vm.box = "coreos-%s" % $update_channel 52 | if $image_version != "current" 53 | config.vm.box_version = $image_version 54 | end 55 | config.vm.box_url = "http://%s.release.core-os.net/amd64-usr/%s/coreos_production_vagrant.json" % [$update_channel, $image_version] 56 | 57 | ["vmware_fusion", "vmware_workstation"].each do |vmware| 58 | config.vm.provider vmware do |v, override| 59 | override.vm.box_url = "http://%s.release.core-os.net/amd64-usr/%s/coreos_production_vagrant_vmware_fusion.json" % [$update_channel, $image_version] 60 | end 61 | end 62 | 63 | config.vm.provider :virtualbox do |v| 64 | # On VirtualBox, we don't have guest additions or a functional vboxsf 65 | # in CoreOS, so tell Vagrant that so it can be smarter. 66 | v.check_guest_additions = false 67 | v.functional_vboxsf = false 68 | end 69 | 70 | # plugin conflict 71 | if Vagrant.has_plugin?("vagrant-vbguest") then 72 | config.vbguest.auto_update = false 73 | end 74 | 75 | (1..$num_instances).each do |i| 76 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 77 | config.vm.hostname = vm_name 78 | 79 | if $enable_serial_logging 80 | logdir = File.join(File.dirname(__FILE__), "log") 81 | FileUtils.mkdir_p(logdir) 82 | 83 | serialFile = File.join(logdir, "%s-serial.txt" % vm_name) 84 | FileUtils.touch(serialFile) 85 | 86 | ["vmware_fusion", "vmware_workstation"].each do |vmware| 87 | config.vm.provider vmware do |v, override| 88 | v.vmx["serial0.present"] = "TRUE" 89 | v.vmx["serial0.fileType"] = "file" 90 | v.vmx["serial0.fileName"] = serialFile 91 | v.vmx["serial0.tryNoRxLoss"] = "FALSE" 92 | end 93 | end 94 | 95 | config.vm.provider :virtualbox do |vb, override| 96 | vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"] 97 | vb.customize ["modifyvm", :id, "--uartmode1", serialFile] 98 | end 99 | end 100 | 101 | if $expose_docker_tcp 102 | config.vm.network "forwarded_port", guest: 2375, host: ($expose_docker_tcp + i - 1), auto_correct: true 103 | end 104 | 105 | $forwarded_ports.each do |guest, host| 106 | config.vm.network "forwarded_port", guest: guest, host: host, auto_correct: true 107 | end 108 | 109 | ["vmware_fusion", "vmware_workstation"].each do |vmware| 110 | config.vm.provider vmware do |v| 111 | v.gui = vm_gui 112 | v.vmx['memsize'] = vm_memory 113 | v.vmx['numvcpus'] = vm_cpus 114 | end 115 | end 116 | 117 | config.vm.provider :virtualbox do |vb| 118 | vb.gui = vm_gui 119 | vb.memory = vm_memory 120 | vb.cpus = vm_cpus 121 | end 122 | 123 | ip = "172.17.8.#{i+100}" 124 | config.vm.network :private_network, ip: ip 125 | 126 | # Uncomment below to enable NFS for sharing the host machine into the coreos-vagrant VM. 127 | #config.vm.synced_folder ".", "/home/core/share", id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp'] 128 | $shared_folders.each_with_index do |(host_folder, guest_folder), index| 129 | config.vm.synced_folder host_folder.to_s, guest_folder.to_s, id: "core-share%02d" % index, nfs: true, mount_options: ['nolock,vers=3,udp'] 130 | end 131 | 132 | if $share_home 133 | config.vm.synced_folder ENV['HOME'], ENV['HOME'], id: "home", :nfs => true, :mount_options => ['nolock,vers=3,udp'] 134 | end 135 | 136 | if File.exist?(CLOUD_CONFIG_PATH) 137 | config.vm.provision :file, :source => "#{CLOUD_CONFIG_PATH}", :destination => "/tmp/vagrantfile-user-data" 138 | config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true 139 | end 140 | 141 | end 142 | end 143 | end 144 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/config.rb.sample: -------------------------------------------------------------------------------- 1 | # Size of the CoreOS cluster created by Vagrant 2 | $num_instances=1 3 | 4 | # Used to fetch a new discovery token for a cluster of size $num_instances 5 | $new_discovery_url="https://discovery.etcd.io/new?size=#{$num_instances}" 6 | 7 | # To automatically replace the discovery token on 'vagrant up', uncomment 8 | # the lines below: 9 | # 10 | #if File.exists?('user-data') && ARGV[0].eql?('up') 11 | # require 'open-uri' 12 | # require 'yaml' 13 | # 14 | # token = open($new_discovery_url).read 15 | # 16 | # data = YAML.load(IO.readlines('user-data')[1..-1].join) 17 | # if data['coreos'].key? 'etcd' 18 | # data['coreos']['etcd']['discovery'] = token 19 | # end 20 | # if data['coreos'].key? 'etcd2' 21 | # data['coreos']['etcd2']['discovery'] = token 22 | # end 23 | # 24 | # # Fix for YAML.load() converting reboot-strategy from 'off' to `false` 25 | # if data['coreos'].key? 'update' 26 | # if data['coreos']['update'].key? 'reboot-strategy' 27 | # if data['coreos']['update']['reboot-strategy'] == false 28 | # data['coreos']['update']['reboot-strategy'] = 'off' 29 | # end 30 | # end 31 | # end 32 | # 33 | # yaml = YAML.dump(data) 34 | # File.open('user-data', 'w') { |file| file.write("#cloud-config\n\n#{yaml}") } 35 | #end 36 | # 37 | 38 | # 39 | # coreos-vagrant is configured through a series of configuration 40 | # options (global ruby variables) which are detailed below. To modify 41 | # these options, first copy this file to "config.rb". Then simply 42 | # uncomment the necessary lines, leaving the $, and replace everything 43 | # after the equals sign.. 44 | 45 | # Change basename of the VM 46 | # The default value is "core", which results in VMs named starting with 47 | # "core-01" through to "core-${num_instances}". 48 | #$instance_name_prefix="core" 49 | 50 | # Change the version of CoreOS to be installed 51 | # To deploy a specific version, simply set $image_version accordingly. 52 | # For example, to deploy version 709.0.0, set $image_version="709.0.0". 53 | # The default value is "current", which points to the current version 54 | # of the selected channel 55 | #$image_version = "current" 56 | 57 | # Official CoreOS channel from which updates should be downloaded 58 | #$update_channel='alpha' 59 | 60 | # Log the serial consoles of CoreOS VMs to log/ 61 | # Enable by setting value to true, disable with false 62 | # WARNING: Serial logging is known to result in extremely high CPU usage with 63 | # VirtualBox, so should only be used in debugging situations 64 | #$enable_serial_logging=false 65 | 66 | # Enable port forwarding of Docker TCP socket 67 | # Set to the TCP port you want exposed on the *host* machine, default is 2375 68 | # If 2375 is used, Vagrant will auto-increment (e.g. in the case of $num_instances > 1) 69 | # You can then use the docker tool locally by setting the following env var: 70 | # export DOCKER_HOST='tcp://127.0.0.1:2375' 71 | #$expose_docker_tcp=2375 72 | 73 | # Enable NFS sharing of your home directory ($HOME) to CoreOS 74 | # It will be mounted at the same path in the VM as on the host. 75 | # Example: /Users/foobar -> /Users/foobar 76 | #$share_home=false 77 | 78 | # Customize VMs 79 | #$vm_gui = false 80 | #$vm_memory = 1024 81 | #$vm_cpus = 1 82 | 83 | # Share additional folders to the CoreOS VMs 84 | # For example, 85 | # $shared_folders = {'/path/on/host' => '/path/on/guest', '/home/foo/app' => '/app'} 86 | # or, to map host folders to guest folders of the same name, 87 | # $shared_folders = Hash[*['/home/foo/app1', '/home/foo/app2'].map{|d| [d, d]}.flatten] 88 | #$shared_folders = {} 89 | 90 | # Enable port forwarding from guest(s) to host machine, syntax is: { 80 => 8080 }, auto correction is enabled by default. 91 | #$forwarded_ports = {} 92 | -------------------------------------------------------------------------------- /imports/coreos-vagrant/user-data.sample: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | coreos: 4 | etcd: 5 | # generate a new token for each unique cluster from https://discovery.etcd.io/new 6 | # WARNING: replace each time you 'vagrant destroy' 7 | #discovery: https://discovery.etcd.io/<token> 8 | addr: $public_ipv4:4001 9 | peer-addr: $public_ipv4:7001 10 | etcd2: 11 | #generate a new token for each unique cluster from https://discovery.etcd.io/new 12 | #discovery: https://discovery.etcd.io/<token> 13 | # multi-region and multi-cloud deployments need to use $public_ipv4 14 | advertise-client-urls: http://$public_ipv4:2379 15 | initial-advertise-peer-urls: http://$private_ipv4:2380 16 | # listen on both the official ports and the legacy ports 17 | # legacy ports can be omitted if your application doesn't depend on them 18 | listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 19 | listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001 20 | fleet: 21 | public-ip: $public_ipv4 22 | flannel: 23 | interface: $public_ipv4 24 | units: 25 | - name: etcd.service 26 | command: start 27 | # To use etcd2, comment out the above service and uncomment these 28 | # Note: this requires a release that contains etcd2 29 | #- name: etcd2.service 30 | # command: start 31 | - name: fleet.service 32 | command: start 33 | - name: docker-tcp.socket 34 | command: start 35 | enable: true 36 | content: | 37 | [Unit] 38 | Description=Docker Socket for the API 39 | 40 | [Socket] 41 | ListenStream=2375 42 | Service=docker.service 43 | BindIPv6Only=both 44 | 45 | [Install] 46 | WantedBy=sockets.target 47 | -------------------------------------------------------------------------------- /imports/coreos-vagrant_subtree_pull.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | git ls-remote https://github.com/coreos/coreos-vagrant master \ 3 | | awk '{ system( "git subtree pull --message=\"Subtree merge of coreos/coreos-vagrant@" $1 "\" --prefix=imports/coreos-vagrant https://github.com/coreos/coreos-vagrant " $1) }' 4 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | <!-- 2 | This is content for the guides homepage. 3 | It should be manually pasted in to the correct cells of 4 | https://www.weave.works/wp-admin/admin.php?page=dd_layouts_edit&action=edit&layout_id=2129 5 | --> 6 | 7 | <h2>Getting Started Guides</h2> 8 | <hr> 9 | 10 | <!-- NEXT CELL --> 11 | 12 | <h4>Test Drive Weave Products</h4> 13 | <p>These scenarios run entirely in your browser, but allow you to remotely control real Docker resources. Learn about Weave products by trying a scenario!</p> 14 | 15 | <div id="katacoda-terminal" data-katacoda-id="weave/dashboard" data-katacoda-color="32324B" data-katacoda-secondary="#4ec6fa" data-katacoda-background="#fff" data-katacoda-hideprogress="true" style="height:450px"></div> 16 | 17 | <!-- NEXT CELL --> 18 | 19 | <hr> 20 | <h4>Getting Started with Docker and Weave Net</h4> 21 | <p>After <a href="http://www.weave.works/install-weave-net/" target="_blank">installing Weave Net</a>, these three guides are the fastest way to get started with Docker and Weave Net:</p> 22 | <p><a href="./docker-legacy/guides/part-1.md">Part 1: Weave Net with Docker Machine</a></p> 23 | <p><a href="./docker-legacy/guides/part-2.md">Part 2: Weave Net with Docker Machine and Swarm</a></p> 24 | <p><a href="./docker-legacy/guides/part-3.md">Part 3: Scaling with Docker Swarm and Docker Compose</a></p> 25 | <p> </p> 26 | <h4>Getting Started with Docker and Weave Scope</h4> 27 | <p>After <a href="http://www.weave.works/install-weave-scope/" target="_blank">installing Weave Scope</a>, these guides are the fastest way to visualize your Docker containers and their interactions using Weave Scope</p> 28 | <p>Weave Cloud: <a href="http://www.weave.works/guides/using-weave-scope-cloud-service-to-visualize-and-monitor-docker-containers/">Visualizing Docker Containers With Weave Cloud</a></p> 29 | <p>Weave Scope:<a href="http://www.weave.works/guides/using-weave-scope-standalone-to-visualize-and-monitor-docker-containers/">Using Weave Scope to Visualize Docker Containers</a></p> 30 | -------------------------------------------------------------------------------- /kubernetes/coreos/.gitattributes: -------------------------------------------------------------------------------- 1 | # Detect text files automatically 2 | * text=auto 3 | 4 | # Force Unix-style line endings on these files 5 | addons/*.yaml text eol=lf 6 | -------------------------------------------------------------------------------- /kubernetes/coreos/.gitignore: -------------------------------------------------------------------------------- 1 | user-data 2 | .vagrant 3 | -------------------------------------------------------------------------------- /kubernetes/coreos/Vagrantfile: -------------------------------------------------------------------------------- 1 | eval(File.open(File.join('..', '..', 'imports', 'coreos-vagrant', 'Vagrantfile')).read) 2 | -------------------------------------------------------------------------------- /kubernetes/coreos/addons/skydns-rc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ReplicationController 3 | metadata: 4 | name: kube-dns-v8 5 | namespace: kube-system 6 | labels: 7 | k8s-app: kube-dns 8 | version: v8 9 | kubernetes.io/cluster-service: "true" 10 | spec: 11 | replicas: 3 12 | selector: 13 | k8s-app: kube-dns 14 | version: v8 15 | template: 16 | metadata: 17 | labels: 18 | k8s-app: kube-dns 19 | version: v8 20 | kubernetes.io/cluster-service: "true" 21 | spec: 22 | containers: 23 | - name: etcd 24 | image: gcr.io/google_containers/etcd:2.0.9 25 | #resources: 26 | # limits: 27 | # cpu: 100m 28 | # memory: 50Mi 29 | command: 30 | - /usr/local/bin/etcd 31 | - -data-dir 32 | - /var/etcd/data 33 | - -listen-client-urls 34 | - http://127.0.0.1:2379,http://127.0.0.1:4001 35 | - -advertise-client-urls 36 | - http://127.0.0.1:2379,http://127.0.0.1:4001 37 | - -initial-cluster-token 38 | - skydns-etcd 39 | volumeMounts: 40 | - name: etcd-storage 41 | mountPath: /var/etcd/data 42 | - name: kube2sky 43 | image: gcr.io/google_containers/kube2sky:1.11 44 | #resources: 45 | # limits: 46 | # cpu: 100m 47 | # memory: 50Mi 48 | args: 49 | # command = "/kube2sky" 50 | - -domain=kube.local 51 | - -kube_master_url=http://172.17.8.101:8080 52 | - name: skydns 53 | image: gcr.io/google_containers/skydns:2015-03-11-001 54 | #resources: 55 | # limits: 56 | # cpu: 100m 57 | # memory: 50Mi 58 | args: 59 | # command = "/skydns" 60 | - -machines=http://localhost:4001 61 | - -addr=0.0.0.0:53 62 | - -domain=kube.local 63 | ports: 64 | - containerPort: 53 65 | name: dns 66 | protocol: UDP 67 | - containerPort: 53 68 | name: dns-tcp 69 | protocol: TCP 70 | livenessProbe: 71 | httpGet: 72 | path: /healthz 73 | port: 8080 74 | scheme: HTTP 75 | initialDelaySeconds: 30 76 | timeoutSeconds: 5 77 | - name: healthz 78 | image: gcr.io/google_containers/exechealthz:1.0 79 | #resources: 80 | # limits: 81 | # cpu: 10m 82 | # memory: 20Mi 83 | args: 84 | - -cmd=nslookup kubernetes.default.svc.kube.local localhost >/dev/null 85 | - -port=8080 86 | ports: 87 | - containerPort: 8080 88 | protocol: TCP 89 | volumes: 90 | - name: etcd-storage 91 | emptyDir: {} 92 | dnsPolicy: Default # Don't use cluster DNS. 93 | -------------------------------------------------------------------------------- /kubernetes/coreos/addons/skydns-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: kube-dns 5 | namespace: kube-system 6 | labels: 7 | k8s-app: kube-dns 8 | kubernetes.io/cluster-service: "true" 9 | kubernetes.io/name: "KubeDNS" 10 | spec: 11 | selector: 12 | k8s-app: kube-dns 13 | clusterIP: 10.16.0.3 14 | ports: 15 | - name: dns 16 | port: 53 17 | protocol: UDP 18 | - name: dns-tcp 19 | port: 53 20 | protocol: TCP 21 | -------------------------------------------------------------------------------- /kubernetes/coreos/config.rb: -------------------------------------------------------------------------------- 1 | if File.exists?('kubernetes-cluster.yaml') && ARGV[0].eql?('up') 2 | require 'open-uri' 3 | require 'yaml' 4 | 5 | data = YAML.load(IO.readlines('kubernetes-cluster.yaml')[1..-1].join) 6 | 7 | if Dir.exists?('addons') 8 | Dir.foreach('addons').select {|x| x =~ /.*\.yaml/}.each do |f| 9 | data['write_files'] << { 10 | 'path' => "/etc/kubernetes/addons/#{f}", 11 | 'owner' => 'root', 12 | 'permissions' => '0644', 13 | 'content' => open(File.join('addons', f)).readlines.join 14 | } 15 | end 16 | end 17 | 18 | lines = YAML.dump(data).split("\n") 19 | lines[0] = '#cloud-config' 20 | 21 | open('user-data', 'w') do |f| 22 | f.puts(lines.join("\n")) 23 | end 24 | end 25 | 26 | $instance_name_prefix = 'kube' 27 | $num_instances = 3 28 | $vb_memory = 2048 29 | $vb_cpus = 2 30 | $update_channel = 'stable' 31 | -------------------------------------------------------------------------------- /mesos-marathon/centos/.gitattributes: -------------------------------------------------------------------------------- 1 | # Detect text files automatically 2 | * text=auto 3 | 4 | # Force Unix-style line endings on these files 5 | weave text eol=lf 6 | *.sh text eol=lf 7 | *.service text eol=lf 8 | *.target text eol=lf 9 | *.conf text eol=lf 10 | -------------------------------------------------------------------------------- /mesos-marathon/centos/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | config.rb 3 | -------------------------------------------------------------------------------- /mesos-marathon/centos/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | ## The variables bellow can be overriden in `config.rb` file 5 | $mesos_slaves = 1 6 | $memory = 1024*2 7 | $cpus = 2 8 | $network = [172, 17, 85] 9 | 10 | CONFIG = File.join(File.dirname(__FILE__), 'config.rb') 11 | 12 | if File.exist?(CONFIG) 13 | require CONFIG 14 | end 15 | 16 | Vagrant.configure(2) do |config| 17 | config.vm.box = 'bento/centos-7.1' 18 | 19 | vms = (0..$mesos_slaves).map{ |a| 'mesos-%02d' % [a] } 20 | 21 | ips = {} 22 | 23 | vms.each_with_index{ |i, x| ips[i] = ($network + [x+100]).join('.') } 24 | 25 | vms.each_with_index do |i, x| 26 | 27 | config.vm.define vm_name = i do |config| 28 | 29 | config.vm.network :private_network, ip: ips[vm_name] 30 | 31 | config.vm.provision :shell, inline: <<-SHELL 32 | hostnamectl set-hostname #{vm_name} 33 | echo #{ips[vm_name]} #{vm_name} >> /etc/hosts 34 | SHELL 35 | 36 | # Disable automatic box update checking. If you disable this, then 37 | # boxes will only be checked for updates when the user runs 38 | # `vagrant box outdated`. This is not recommended. 39 | # config.vm.box_check_update = false 40 | 41 | # Create a forwarded port mapping which allows access to a specific port 42 | # within the machine from a port on the host machine. In the example below, 43 | # accessing "localhost:8080" will access port 80 on the guest machine. 44 | # config.vm.network "forwarded_port", guest: 80, host: 8080 45 | 46 | config.vm.provider :virtualbox do |vb| 47 | vb.gui = false 48 | # vb.check_guest_additions = false 49 | # vb.functional_vboxsf = false 50 | 51 | vb.memory = $memory 52 | vb.cpus = $cpus 53 | end 54 | 55 | 56 | ## Compile a list of IP addresses modulo one for this VM 57 | weave_peers = ips.select{|host, addr| addr if host != vm_name}.values 58 | 59 | ## Base provisioning script is like this, it's generally the same an all the nodes, 60 | ## accept for the list of Weave peers being defined dynamically 61 | do_provisioning = <<-SCRIPT 62 | set -e 63 | set -x 64 | yum -q -y install docker 65 | cd /vagrant 66 | ./install_weave.sh 67 | ./setup_and_launch_weave.sh #{weave_peers.join(' ')} 68 | ./install_mesosphere_packages.sh 69 | SCRIPT 70 | 71 | ## Below is what's different denpending on the number of the machine 72 | if x == 0 73 | ## Master is on the head node (mesos-00) 74 | do_provisioning << "./launch_mesos_master_services.sh" 75 | elsif x > 0 76 | ## Slaves are an all remaing nodes 77 | do_provisioning << "./setup_and_launch_mesos_slave.sh zk://#{ips['mesos-00']}:2181/mesos" 78 | end 79 | 80 | config.vm.provision :shell, inline: do_provisioning 81 | end 82 | end 83 | end 84 | -------------------------------------------------------------------------------- /mesos-marathon/centos/deploy_on_marathon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | MARATHON=http://172.17.85.100:8080 3 | 4 | curl -X POST $MARATHON/v2/apps -d @$1 -H "Content-type: application/json" 5 | -------------------------------------------------------------------------------- /mesos-marathon/centos/images/diagram-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/mesos-marathon/centos/images/diagram-1.png -------------------------------------------------------------------------------- /mesos-marathon/centos/images/diagram-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/mesos-marathon/centos/images/diagram-2.png -------------------------------------------------------------------------------- /mesos-marathon/centos/images/marathon-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/mesos-marathon/centos/images/marathon-1.png -------------------------------------------------------------------------------- /mesos-marathon/centos/images/marathon-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/mesos-marathon/centos/images/marathon-2.png -------------------------------------------------------------------------------- /mesos-marathon/centos/install_mesosphere_packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | cd $(dirname $0) 4 | 5 | rpm -i http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm 6 | yum -q -y install mesos-0.27.0 marathon-0.15.0 mesosphere-zookeeper-3.4.6 7 | -------------------------------------------------------------------------------- /mesos-marathon/centos/install_weave.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | cd $(dirname $0) 4 | 5 | curl -L -s -o weave https://git.io/weave 6 | install -o root -g root -m 0755 weave /usr/bin/ 7 | install -o root -g root -m 0644 weave.target weave.service weaveproxy.service /etc/systemd/system/ 8 | -------------------------------------------------------------------------------- /mesos-marathon/centos/launch_mesos_master_services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | systemctl -q start zookeeper.service 3 | sleep 5 4 | systemctl -q start mesos-master.service marathon.service 5 | -------------------------------------------------------------------------------- /mesos-marathon/centos/mesos-slave-containerizers.conf: -------------------------------------------------------------------------------- 1 | [Service] 2 | Environment=MESOS_CONTAINERIZERS=docker,mesos 3 | Environment=MESOS_DOCKER_SOCKET=/var/run/weave/weave.sock 4 | -------------------------------------------------------------------------------- /mesos-marathon/centos/nodejs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:4.0 2 | ADD index.js /srv/index.js 3 | CMD ["node", "/srv/index.js"] 4 | -------------------------------------------------------------------------------- /mesos-marathon/centos/nodejs/index.js: -------------------------------------------------------------------------------- 1 | // Load the http module to create an http server. 2 | var http = require('http'); 3 | 4 | // Configure our HTTP server to respond with Hello World to all requests. 5 | var server = http.createServer(function (request, response) { 6 | response.writeHead(200, {"Content-Type": "text/plain"}); 7 | response.end("Hello, Weave!\n"); 8 | }); 9 | 10 | // Listen on port 80 11 | server.listen(80); 12 | 13 | // Put a friendly message on the terminal 14 | console.log("Server running at http://0.0.0.0:8000/"); 15 | -------------------------------------------------------------------------------- /mesos-marathon/centos/nodejs/marathon-app.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "hello-weave-node", 3 | "cpus": 0.2, 4 | "mem": 20.0, 5 | "instances": 4, 6 | "container": { 7 | "type": "DOCKER", 8 | "docker": { 9 | "image": "docker.io/errordeveloper/hello-weave-node", 10 | "network": "BRIDGE", 11 | "parameters": [ 12 | { "key": "hostname", "value": "hello.weave.local" } 13 | ] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mesos-marathon/centos/outyet.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "outyet", 3 | "cpus": 0.2, 4 | "mem": 20.0, 5 | "instances": 4, 6 | "container": { 7 | "type": "DOCKER", 8 | "docker": { 9 | "image": "docker.io/goexample/outyet", 10 | "network": "BRIDGE", 11 | "parameters": [ 12 | { "key": "hostname", "value": "outyet.weave.local" } 13 | ] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mesos-marathon/centos/setup_and_launch_mesos_slave.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | cd $(dirname $0) 4 | 5 | ## This configures Mesos slave to use Docker containerizer and points it to Weave proxy 6 | install -o root -g root -d /etc/systemd/system/mesos-slave.service.d 7 | install -o root -g root mesos-slave-containerizers.conf /etc/systemd/system/mesos-slave.service.d 8 | 9 | printf '%s\n' "$*" > /etc/mesos/zk 10 | 11 | systemctl -q daemon-reload 12 | systemctl -q start mesos-slave.service 13 | -------------------------------------------------------------------------------- /mesos-marathon/centos/setup_and_launch_weave.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | printf 'WEAVE_PEERS="%s"\n' "$*" > /etc/weave.env 3 | systemctl -q --no-block start weaveproxy weave.service 4 | -------------------------------------------------------------------------------- /mesos-marathon/centos/weave.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Weave Net 3 | Documentation=http://weave.works/docs 4 | After=docker.service 5 | Before=weaveproxy.service 6 | Requires=docker.service 7 | [Service] 8 | TimeoutStartSec=0 9 | EnvironmentFile=-/etc/weave.env 10 | EnvironmentFile=-/etc/weave.%H.env 11 | ExecStartPre=/usr/bin/weave launch-router $WEAVE_PEERS 12 | ExecStart=/usr/bin/docker attach weave 13 | Restart=on-failure 14 | ExecStop=/usr/bin/weave stop-router 15 | [Install] 16 | WantedBy=weave.target 17 | -------------------------------------------------------------------------------- /mesos-marathon/centos/weave.target: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Weave 3 | Documentation=man:systemd.special(7) 4 | RefuseManualStart=no 5 | After=network-online.target 6 | Requires=weave.service weavedns.service weaveproxy.service 7 | [Install] 8 | WantedBy=multi-user.target 9 | -------------------------------------------------------------------------------- /mesos-marathon/centos/weaveproxy.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Weave Docker API proxy 3 | Documentation=http://weave.works/docs 4 | After=docker.service 5 | Requires=docker.service 6 | [Service] 7 | TimeoutStartSec=0 8 | EnvironmentFile=-/etc/weave.env 9 | EnvironmentFile=-/etc/weave.%H.env 10 | ExecStartPre=/usr/bin/weave launch-proxy 11 | ExecStart=/usr/bin/docker attach weaveproxy 12 | Restart=on-failure 13 | ExecStop=/usr/bin/weave stop-proxy 14 | [Install] 15 | WantedBy=weave.target 16 | -------------------------------------------------------------------------------- /microservices-demo-app/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | front-end: 5 | image: weaveworksdemos/front-end 6 | hostname: front-end 7 | restart: always 8 | environment: 9 | - reschedule:on-node-failure 10 | edge-router: 11 | image: weaveworksdemos/edge-router 12 | ports: 13 | - '80:80' 14 | hostname: edge-router 15 | restart: always 16 | environment: 17 | - reschedule:on-node-failure 18 | catalogue: 19 | image: weaveworksdemos/catalogue 20 | hostname: catalogue 21 | restart: always 22 | environment: 23 | - reschedule:on-node-failure 24 | accounts: 25 | image: weaveworksdemos/accounts 26 | hostname: accounts 27 | restart: always 28 | environment: 29 | - reschedule:on-node-failure 30 | accounts-db: 31 | image: mongo 32 | hostname: accounts-db 33 | restart: always 34 | environment: 35 | - reschedule:on-node-failure 36 | cart: 37 | image: weaveworksdemos/cart 38 | hostname: cart 39 | restart: always 40 | environment: 41 | - reschedule:on-node-failure 42 | cart-db: 43 | image: mongo 44 | hostname: cart-db 45 | restart: always 46 | environment: 47 | - reschedule:on-node-failure 48 | orders: 49 | image: weaveworksdemos/orders 50 | hostname: orders 51 | restart: always 52 | environment: 53 | - reschedule:on-node-failure 54 | orders-db: 55 | image: mongo 56 | hostname: orders-db 57 | restart: always 58 | environment: 59 | - reschedule:on-node-failure 60 | shipping: 61 | image: weaveworksdemos/shipping 62 | hostname: shipping 63 | restart: always 64 | environment: 65 | - reschedule:on-node-failure 66 | queue-master: 67 | image: weaveworksdemos/queue-master 68 | hostname: queue-master 69 | volumes: 70 | - /var/run/docker.sock:/var/run/docker.sock 71 | restart: always 72 | environment: 73 | - reschedule:on-node-failure 74 | rabbitmq: 75 | image: rabbitmq:3 76 | hostname: rabbitmq 77 | restart: always 78 | environment: 79 | - reschedule:on-node-failure 80 | payment: 81 | image: weaveworksdemos/payment 82 | hostname: payment 83 | restart: always 84 | environment: 85 | - reschedule:on-node-failure 86 | login: 87 | image: weaveworksdemos/login 88 | hostname: login 89 | restart: always 90 | environment: 91 | - reschedule:on-node-failure 92 | user-sim: 93 | image: weaveworksdemos/load-test 94 | hostname: user-simulator 95 | command: "-d 60 -r 200 -c 2 -h edge-router" 96 | 97 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic Ubuntu, Senenca, Node and Docker setup 2 | # 3 | # Weave Getting Started Guides 4 | 5 | require 'fileutils' 6 | require 'ipaddr' 7 | 8 | Vagrant.require_version ">= 1.6.0" 9 | 10 | VAGRANTFILE_API_VERSION = "2" 11 | 12 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 13 | 14 | # Defaults for config options defined in CONFIG 15 | 16 | $num_instances = 2 17 | $instance_name_prefix = "weave-gs" 18 | $share_home = false 19 | $vm_gui = false 20 | $vm_memory = 512 21 | $vm_cpus = 1 22 | $vm_starting_ip = "172.17.8.100" 23 | 24 | $vm_ip = $vm_starting_ip 25 | 26 | 27 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 28 | config.vm.box = "ubuntu/trusty64" 29 | config.ssh.insert_key = true 30 | 31 | if Vagrant.has_plugin?("vagrant-cachier") 32 | config.cache.scope = :box 33 | end 34 | 35 | (1..$num_instances).each do |i| 36 | 37 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 38 | config.vm.hostname = vm_name 39 | if i == 1 40 | config.vm.network "forwarded_port", guest: 80, host: 8080 41 | end 42 | 43 | ip = IPAddr.new($vm_ip) 44 | $vm_ip = ip.succ.to_s 45 | config.vm.network "private_network", ip: $vm_ip 46 | end 47 | end 48 | 49 | config.vm.provider :virtualbox do |vb| 50 | vb.gui = $vm_gui 51 | vb.memory = $vm_memory 52 | vb.cpus = $vm_cpus 53 | end 54 | 55 | config.vm.provision "docker", images: [ 56 | "ubuntu", 57 | "weaveworks/seneca_user", 58 | "weaveworks/seneca_webapp", 59 | "weaveworks/seneca_offer", 60 | ] 61 | 62 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 63 | sudo curl -s -L git.io/weave -o /usr/local/bin/weave 64 | sudo chmod a+x /usr/local/bin/weave 65 | SHELL 66 | end 67 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/dockerfiles/Dockerfile.seneca_offer: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | MAINTAINER ilya@weave.works 3 | 4 | RUN apt-get -y update 5 | RUN apt-get -y install nodejs 6 | RUN apt-get -y install npm 7 | 8 | # add our app 9 | RUN mkdir -p /opt/app 10 | COPY app/. /opt/app 11 | RUN cd /opt/app && npm install 12 | 13 | # and run our offer-service 14 | 15 | CMD ["nodejs", "/opt/app/services/offer-service.js" ] 16 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/dockerfiles/Dockerfile.seneca_user: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | MAINTAINER ilya@weave.works 3 | 4 | RUN apt-get -y update 5 | RUN apt-get -y install nodejs 6 | RUN apt-get -y install npm 7 | 8 | # add our app 9 | RUN mkdir -p /opt/app 10 | COPY app/. /opt/app 11 | RUN cd /opt/app && npm install 12 | 13 | # and run our offer-service 14 | 15 | CMD ["nodejs", "/opt/app/services/user-details.js" ] 16 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/dockerfiles/Dockerfile.seneca_webapp: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | MAINTAINER ilya@weave.works 3 | 4 | RUN apt-get -y update 5 | RUN apt-get -y install nodejs 6 | RUN apt-get -y install npm 7 | 8 | # add our app 9 | RUN mkdir -p /opt/app 10 | COPY app/. /opt/app 11 | RUN cd /opt/app && npm install 12 | 13 | # and run our offer-service 14 | 15 | CMD ["nodejs", "/opt/app/services/web-app.js" ] 16 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/dockerfiles/README.md: -------------------------------------------------------------------------------- 1 | # Weave, Seneca and Docker buildfiles 2 | 3 | If you would like to recreate these images, create a sudirectory app inside the dockerfiles directory and then copy the contents of ../example/micro-services into it. 4 | 5 | Build the docker images using the following commands: 6 | 7 | ```bash 8 | docker build -f ./Dockerfile.seneca_webapp -t yourtag_webapp . 9 | docker build -f ./Dockerfile.seneca_offer -t yourtag_offer . 10 | docker build -f ./Dockerfile.seneca_user -t yourtag_user . 11 | ``` 12 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/README.md: -------------------------------------------------------------------------------- 1 | # Seneca Microservices Example 2 | 3 | This example is derived from the microservices example at 4 | [https://github.com/rjrodger/seneca-examples/tree/master/micro-services](https://github.com/rjrodger/seneca-examples/tree/master/micro-services). We have stripped the example down further for use with Weave and Docker. 5 | 6 | The only significant code changes are 7 | 8 | * the removal of specific port numbers in services/web-app.js 9 | * the addition of dns hostnames in services/web-app.js 10 | * updating seneca.client.listen to use the default port of 10101 11 | * updating app.listen to use port 80 12 | 13 | Details on the Dockerfiles we used for generating our containers are in the 14 | dockerfiles directory for this example. 15 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/lib/api.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = function( options ) { 3 | var seneca = this 4 | var plugin = 'api' 5 | 6 | 7 | seneca.add( {role:plugin, end:'offer'}, end_offer) 8 | 9 | 10 | function end_offer( args, done ) { 11 | var user = args.req$.seneca.user || {} 12 | 13 | this.act('role:offer,cmd:provide',{nick:user.nick},done) 14 | } 15 | 16 | 17 | seneca.act({role:'web', use:{ 18 | prefix:'/api/', 19 | pin:{role:plugin,end:'*'}, 20 | map:{ 21 | 'offer': { GET:true }, 22 | } 23 | }}) 24 | 25 | 26 | return {name:plugin}; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/lib/offer.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = function( options ) { 3 | var seneca = this 4 | var plugin = 'offer' 5 | 6 | 7 | seneca.add( {role:plugin, cmd:'provide'}, cmd_provide) 8 | 9 | 10 | function cmd_provide( args, done ) { 11 | if( args.nick ) return done(null,{product:'Apple'}); 12 | 13 | return done(null,{product:'Orange'}); 14 | } 15 | 16 | 17 | return {name:plugin}; 18 | } 19 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "micro-services", 3 | "version": "0.1.0", 4 | "description": "Seneca micro-services example", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "body-parser": "~1.11.0", 13 | "express": "~4.11.2", 14 | "seneca": "plugin", 15 | "seneca-auth": "~0.4.0", 16 | "seneca-user": "~0.2.10" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/public/index.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <html> 3 | <head> 4 | <script src="jquery-2.1.1.min.js"></script> 5 | <script src="index.js"></script> 6 | </head> 7 | <body> 8 | 9 | 10 | <p>Micro-Services</p> 11 | 12 | 13 | <h1>Hi There!</h1> 14 | <h2>Have an <span id="offer"></span>!</h2> 15 | 16 | 17 | <div id="content_login" class="content"> 18 | 19 | <h1>Login</h1> 20 | <form id="login" action="/auth/login" method="post"> 21 | 22 | <p> 23 | <label for="username">Username:</label><br /> 24 | <input id="username" name="username" /> 25 | </p> 26 | 27 | <p> 28 | <label for="username">Password:</label><br /> 29 | <input type="password" id="password" name="password" /> 30 | </p> 31 | 32 | <p> 33 | <input type="submit" value="login"> 34 | </p> 35 | </form> 36 | 37 | </div> 38 | 39 | 40 | <div id="content_account" class="content" style="display:none"> 41 | 42 | 43 | <h1>Account</h1> 44 | 45 | Username: <span id="user_nick"></span><br /> 46 | Name: <span id="user_name"></span><br /> 47 | 48 | <button id="logout">logout</button> 49 | 50 | </div> 51 | 52 | 53 | 54 | </body> 55 | </html> 56 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/public/index.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | 3 | $('#login').submit(function(){ 4 | var data = { 5 | username: $('#username').val(), 6 | password: $('#password').val() 7 | } 8 | 9 | $.ajax({ 10 | type: 'POST', 11 | url: '/auth/login', 12 | data: JSON.stringify(data), 13 | dataType: 'json', 14 | contentType: 'application/json', 15 | success: showAccount 16 | }) 17 | 18 | return false 19 | }) 20 | 21 | $('#logout').click(function(){ 22 | $.ajax({ 23 | type: 'POST', 24 | url: '/auth/logout', 25 | data: '{}', 26 | dataType: 'json', 27 | contentType: 'application/json', 28 | success: showLogin 29 | }) 30 | }) 31 | 32 | 33 | $.ajax({type:'GET',url:'/auth/instance',success:showLogin}) 34 | $.ajax({type:'GET',url:'/api/offer',success:showOffer}) 35 | }) 36 | 37 | 38 | function showAccount(instance) { 39 | if( instance.user ) { 40 | $('#user_nick').text(instance.user.nick) 41 | $('#user_name').text(instance.user.name) 42 | 43 | $('#content_login').slideUp() 44 | $('#content_account').slideDown() 45 | 46 | $.ajax({type:'GET',url:'/api/offer',success:showOffer}) 47 | } 48 | } 49 | 50 | function showLogin(instance) { 51 | if( instance.user ) return showAccount(instance) 52 | 53 | $('#content_login').slideDown() 54 | $('#content_account').slideUp() 55 | 56 | $.ajax({type:'GET',url:'/api/offer',success:showOffer}) 57 | } 58 | 59 | 60 | function showOffer(offer) { 61 | $('#offer').text(offer.product) 62 | } 63 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/services/offer-service.js: -------------------------------------------------------------------------------- 1 | require('seneca')() 2 | .use('../lib/offer') 3 | .listen() 4 | .ready(function(){ 5 | this.act({role:'offer',cmd:'provide'},console.log) 6 | }) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/services/user-details.js: -------------------------------------------------------------------------------- 1 | 2 | require('seneca')() 3 | .use('user') 4 | .listen() 5 | .ready(function(){ 6 | this.act({role:'user',cmd:'register',nick:'u1',name:'U1',password:'u1'}) 7 | }) 8 | 9 | 10 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/example/micro-services/services/web-app.js: -------------------------------------------------------------------------------- 1 | 2 | var express = require('express') 3 | var bodyParser = require('body-parser') 4 | var seneca = require('seneca')() 5 | 6 | 7 | seneca 8 | .use('user') 9 | .use('auth') 10 | .use('../lib/api.js') 11 | .client({host:offer-ms.weave.local,pin:{role:'offer',cmd:'*'}}) 12 | .client({host:user-ms.weave.local,pin:{role:'user',cmd:'*'}}) 13 | 14 | var app = express() 15 | 16 | app.use( bodyParser.json() ) 17 | app.use( seneca.export('web') ) 18 | app.use( express.static('/opt/app/public') ) 19 | 20 | app.listen(80) 21 | 22 | -------------------------------------------------------------------------------- /microservices-seneca-ubuntu-simple/launch-senca-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | echo "Launching Weave" 4 | 5 | vagrant ssh weave-gs-01 -c "weave launch 172.17.8.102" 6 | vagrant ssh weave-gs-02 -c "weave launch 172.17.8.101" 7 | 8 | echo "Launching our Node.js application" 9 | 10 | vagrant ssh weave-gs-01 -c 'docker $(weave config) run -d --name=offer-ms weaveworks/seneca_offer' >/dev/null 2>&1 11 | vagrant ssh weave-gs-02 -c 'docker $(weave config) run -d --name=user-ms weaveworks/seneca_user' >/dev/null 2>&1 12 | vagrant ssh weave-gs-01 -c 'docker $(weave config) run -d --name=web -p 80:80 weaveworks/seneca_webapp' >/dev/null 2>&1 13 | -------------------------------------------------------------------------------- /nginx-ubuntu-simple/3_Node_Nginx_Example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/nginx-ubuntu-simple/3_Node_Nginx_Example.png -------------------------------------------------------------------------------- /nginx-ubuntu-simple/Dockerfile-simple-apache: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | MAINTAINER fintan@weave.works 3 | RUN apt-get -y update 4 | RUN apt-get -y install apache2 5 | RUN apt-get -y install php5 libapache2-mod-php5 php5-mcrypt 6 | RUN sed -e "s/DirectoryIndex/DirectoryIndex index.php/" < /etc/apache2/mods-enabled/dir.conf > /tmp/foo.sed 7 | RUN mv /tmp/foo.sed /etc/apache2/mods-enabled/dir.conf 8 | ADD example/index.php /var/www/html/ 9 | CMD ["/usr/sbin/apache2ctl", "-D FOREGROUND" ] 10 | -------------------------------------------------------------------------------- /nginx-ubuntu-simple/Dockerfile-simple-nginx: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | RUN rm /etc/nginx/conf.d/default.conf 3 | RUN rm /etc/nginx/conf.d/example_ssl.conf 4 | COPY nginx.conf /etc/nginx/conf.d/default.conf 5 | -------------------------------------------------------------------------------- /nginx-ubuntu-simple/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic Ubuntu and Docker setup Vagrantfile 2 | # 3 | # Weave Getting Started Guides 4 | # 5 | 6 | require 'fileutils' 7 | require 'ipaddr' 8 | 9 | Vagrant.require_version ">= 1.6.0" 10 | 11 | VAGRANTFILE_API_VERSION = "2" 12 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 13 | SIMPLE_DOCKER_NGINX = File.join(File.dirname(__FILE__), "Dockerfile-simple-nginx") 14 | SIMPLE_DOCKER_APACHE = File.join(File.dirname(__FILE__), "Dockerfile-simple-apache") 15 | NGINX_CONF = File.join(File.dirname(__FILE__), "example/nginx.conf") 16 | PHP_EXAMPLE = File.join(File.dirname(__FILE__), "example/index.php") 17 | CHECK_WS = File.join(File.dirname(__FILE__), "example/check-ws.sh") 18 | 19 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 20 | 21 | # Defaults for config options defined in CONFIG 22 | # 23 | 24 | $num_instances = 3 25 | $instance_name_prefix = "weave-gs" 26 | $share_home = false 27 | $vm_gui = false 28 | $vm_memory = 512 29 | $vm_cpus = 1 30 | $vm_starting_ip = "172.17.8.100" 31 | 32 | if File.exist?(CONFIG) 33 | require CONFIG 34 | end 35 | 36 | $vm_ip = $vm_starting_ip 37 | 38 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 39 | config.vm.box = "ubuntu/trusty64" 40 | config.ssh.insert_key = true 41 | 42 | if Vagrant.has_plugin?("vagrant-cachier") 43 | config.cache.scope = :box 44 | end 45 | 46 | (1..$num_instances).each do |i| 47 | 48 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 49 | config.vm.hostname = vm_name 50 | if i == 1 51 | config.vm.network "forwarded_port", guest: 80, host: 8080 52 | end 53 | 54 | ip = IPAddr.new($vm_ip) 55 | $vm_ip = ip.succ.to_s 56 | config.vm.network "private_network", ip: $vm_ip 57 | end 58 | end 59 | 60 | config.vm.provider :virtualbox do |vb| 61 | vb.gui = $vm_gui 62 | vb.memory = $vm_memory 63 | vb.cpus = $vm_cpus 64 | end 65 | 66 | config.vm.provision "docker" do |d| 67 | d.pull_images "ubuntu" 68 | d.pull_images "nginx" 69 | d.pull_images "weaveworks/weave" 70 | d.pull_images "fintanr/weave-gs-nginx-apache" 71 | d.pull_images "fintanr/weave-gs-nginx-simple" 72 | end 73 | 74 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 75 | sudo curl -L git.io/weave -o /usr/local/bin/weave 76 | sudo chmod a+x /usr/local/bin/weave 77 | SHELL 78 | 79 | if File.exist?(SIMPLE_DOCKER_NGINX) 80 | config.vm.provision "shell", inline: "mkdir /home/vagrant/nginx-example; chown -R vagrant:vagrant /home/vagrant/nginx-example" 81 | config.vm.provision "file", :source => "#{SIMPLE_DOCKER_NGINX}", :destination => "/home/vagrant/nginx-example/Dockerfile" 82 | end 83 | 84 | if File.exist?(NGINX_CONF) 85 | config.vm.provision "file", :source => "#{NGINX_CONF}", :destination => "/home/vagrant/nginx-example/nginx.conf" 86 | end 87 | 88 | if File.exists?(SIMPLE_DOCKER_APACHE) 89 | config.vm.provision "shell", inline: "mkdir -p /home/vagrant/apache-php-example/example; chown -R vagrant:vagrant /home/vagrant/apache-php-example" 90 | config.vm.provision "file", :source => "#{SIMPLE_DOCKER_NGINX}", :destination => "/home/vagrant/apache-php-example/Dockerfile" 91 | end 92 | 93 | if File.exist?(PHP_EXAMPLE) 94 | config.vm.provision "file", :source => "#{PHP_EXAMPLE}", :destination => "/home/vagrant/apache-php-example/example/index.php" 95 | end 96 | 97 | if File.exist?(CHECK_WS) 98 | config.vm.provision "file", :source => "#{CHECK_WS}", :destination => "/home/vagrant/check-ws.sh" 99 | end 100 | end 101 | -------------------------------------------------------------------------------- /nginx-ubuntu-simple/access-hosts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CURL=curl 4 | 5 | type -P "$CURL" >/dev/null 2>&1 && echo "Connecting to Nginx in Weave demo" || { echo "curl not found, exiting"; exit 1; } 6 | 7 | for i in `seq 1 6` 8 | do 9 | curl localhost:8080 10 | done 11 | -------------------------------------------------------------------------------- /nginx-ubuntu-simple/example/check-ws.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | HOST_SUFFIX=0 4 | HOST_BASE=weave-gs-0 5 | 6 | CONTAINER=$(sudo weave run --with-dns 10.3.1.100/24 -ti -h pinger.weave.local ubuntu) 7 | 8 | for i in `seq 1 6` 9 | do 10 | if [ `expr $i % 2` == 1 ]; then 11 | HOST_SUFFIX=`expr $HOST_SUFFIX + 1` 12 | fi 13 | 14 | echo "" 15 | echo "Ping ws$i.weave.local which is on host ${HOST_BASE}${HOST_SUFFIX}" 16 | echo "" 17 | sudo docker exec -ti $CONTAINER ping -c 1 -t 1 ws$i.weave.local 18 | done 19 | 20 | sudo docker stop $CONTAINER >/dev/null 2>&1 21 | -------------------------------------------------------------------------------- /nginx-ubuntu-simple/example/index.php: -------------------------------------------------------------------------------- 1 | { 2 | "message" : "Hello Weave - nginx example", 3 | "hostname" : "<?php echo gethostname() ?>", 4 | "date" : "<?php echo date('Y-m-d H:i:s') ?>" 5 | } 6 | 7 | -------------------------------------------------------------------------------- /nginx-ubuntu-simple/example/nginx.conf: -------------------------------------------------------------------------------- 1 | upstream weavedemo { 2 | server ws1.weave.local; 3 | server ws2.weave.local; 4 | server ws3.weave.local; 5 | server ws4.weave.local; 6 | server ws5.weave.local; 7 | server ws6.weave.local; 8 | } 9 | 10 | server { 11 | listen 80; 12 | 13 | location / { 14 | proxy_pass http://weavedemo; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nginx-ubuntu-simple/launch-nginx-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | echo "Launching Weave and WeaveDNS on each vagrant host" 4 | 5 | vagrant ssh weave-gs-01 -c "sudo weave launch -initpeercount 3" >/dev/null 2>&1 6 | vagrant ssh weave-gs-02 -c "sudo weave launch -initpeercount 3 172.17.8.101" >/dev/null 2>&1 7 | vagrant ssh weave-gs-03 -c "sudo weave launch -initpeercount 3 172.17.8.101" >/dev/null 2>&1 8 | vagrant ssh weave-gs-01 -c "sudo weave launch-dns; sudo weave launch-proxy" >/dev/null 2>&1 9 | vagrant ssh weave-gs-02 -c "sudo weave launch-dns; sudo weave launch-proxy" >/dev/null 2>&1 10 | vagrant ssh weave-gs-03 -c "sudo weave launch-dns; sudo weave launch-proxy" >/dev/null 2>&1 11 | 12 | echo "Launching our example application in two containers on each vagrant host" 13 | 14 | vagrant ssh weave-gs-01 -c "eval \$(weave proxy-env); docker run -d --name ws1 fintanr/weave-gs-nginx-apache" >/dev/null 2>&1 15 | vagrant ssh weave-gs-01 -c "eval \$(weave proxy-env); docker run -d --name ws2 fintanr/weave-gs-nginx-apache" >/dev/null 2>&1 16 | vagrant ssh weave-gs-02 -c "eval \$(weave proxy-env); docker run -d --name ws3 fintanr/weave-gs-nginx-apache" >/dev/null 2>&1 17 | vagrant ssh weave-gs-02 -c "eval \$(weave proxy-env); docker run -d --name ws4 fintanr/weave-gs-nginx-apache" >/dev/null 2>&1 18 | vagrant ssh weave-gs-03 -c "eval \$(weave proxy-env); docker run -d --name ws5 fintanr/weave-gs-nginx-apache" >/dev/null 2>&1 19 | vagrant ssh weave-gs-03 -c "eval \$(weave proxy-env); docker run -d --name ws6 fintanr/weave-gs-nginx-apache" >/dev/null 2>&1 20 | 21 | echo "Launching nginx" 22 | 23 | vagrant ssh weave-gs-01 -c "eval \$(weave proxy-env); docker run -ti --name nginx -d -p 80:80 fintanr/weave-gs-nginx-simple" 24 | -------------------------------------------------------------------------------- /rails-ubuntu-simple/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | -------------------------------------------------------------------------------- /rails-ubuntu-simple/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rails:onbuild 2 | RUN apt-get update -qq && apt-get install -y build-essential libpq-dev -------------------------------------------------------------------------------- /rails-ubuntu-simple/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic Ubuntu and Docker setup Vagrantfile 2 | # 3 | # Weave Getting Started Guides 4 | # 5 | 6 | require 'fileutils' 7 | require 'ipaddr' 8 | 9 | Vagrant.require_version ">= 1.6.0" 10 | 11 | VAGRANTFILE_API_VERSION = "2" 12 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 13 | 14 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 15 | 16 | # Defaults for config options defined in CONFIG 17 | # 18 | 19 | $num_instances = 1 20 | $instance_name_prefix = "weave-rails" 21 | $share_home = false 22 | $vm_gui = false 23 | $vm_memory = 512 24 | $vm_cpus = 1 25 | $vm_starting_ip = "172.17.8.100" 26 | 27 | if File.exist?(CONFIG) 28 | require CONFIG 29 | end 30 | 31 | $vm_ip = $vm_starting_ip 32 | 33 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 34 | config.vm.box = "ubuntu/trusty64" 35 | config.ssh.insert_key = true 36 | 37 | if Vagrant.has_plugin?("vagrant-cachier") 38 | config.cache.scope = :box 39 | end 40 | 41 | (1..$num_instances).each do |i| 42 | 43 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 44 | config.vm.hostname = vm_name 45 | config.vm.network "forwarded_port", guest: 3000, host: 3000 46 | 47 | # just split out the ip 48 | # 49 | 50 | ip = IPAddr.new($vm_ip) 51 | $vm_ip = ip.succ.to_s 52 | config.vm.network :private_network, ip: $vm_ip 53 | end 54 | end 55 | 56 | config.vm.provider :virtualbox do |vb| 57 | vb.gui = $vm_gui 58 | vb.memory = $vm_memory 59 | vb.cpus = $vm_cpus 60 | end 61 | 62 | # install docker packages 63 | # 64 | # https://docs.docker.com/installation/ubuntulinux/ 65 | # 66 | 67 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 68 | [ -e /usr/lib/apt/methods/https ] || { 69 | 70 | apt-get update 71 | apt-get install apt-transport-https 72 | } 73 | 74 | echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list 75 | sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 76 | apt-get update 77 | apt-get install -y lxc-docker 78 | 79 | sudo wget -O /usr/local/bin/weave https://github.com/weaveworks/weave/releases/download/latest_release/weave 80 | sudo chmod a+x /usr/local/bin/weave 81 | SHELL 82 | 83 | # Pre-pull images to make running the examples faster 84 | config.vm.provision "docker", images: %w( 85 | weaveworks/weave 86 | weaveworks/weaveexec 87 | postgres 88 | ruby:2.2 89 | rails 90 | rails:onbuild 91 | ) 92 | 93 | end 94 | -------------------------------------------------------------------------------- /rails-ubuntu-simple/config.rb: -------------------------------------------------------------------------------- 1 | $num_instances = 1 2 | -------------------------------------------------------------------------------- /rkt/README.md: -------------------------------------------------------------------------------- 1 | Bring a couple of Vagrant VMs up: 2 | ``` 3 | git clone \ 4 | https://github.com/weaveworks/guides \ 5 | weave-guides 6 | cd weave-guides/rkt 7 | vagrant up 8 | ``` 9 | 10 | First, login to one of the Vagrant VMs: 11 | ``` 12 | vagrant ssh core-01 13 | ``` 14 | 15 | Start a console container: 16 | ``` 17 | core@core-01 ~ $ sudo rkt run \ 18 | --insecure-skip-verify=true \ 19 | --mds-register=false \ 20 | --interactive \ 21 | --private-net \ 22 | docker://ubuntu 23 | ``` 24 | 25 | Set DNS IP address manually (not yet supported in rkt): 26 | ``` 27 | root@rkt-48e60c5f-c461-4d82-b6a0-22bee4feea36:/# echo 'nameserver 10.22.1.251' > /etc/resolv.conf 28 | ``` 29 | 30 | On the second machine, wait for Redis container to boot: 31 | ``` 32 | core@core-02 ~ $ journalctl -f -u redis 33 | ``` 34 | 35 | Hit `^C` once done and run `weave-rkt-dns-add redis`. 36 | 37 | Now, try ping it from the interactive container (TODO: automate this): 38 | ``` 39 | root@rkt-48e60c5f-c461-4d82-b6a0-22bee4feea36:/# ping -c3 redis 40 | PING redis (10.22.2.1) 56(84) bytes of data. 41 | 64 bytes from redis.weave.local (10.22.2.1): icmp_seq=1 ttl=64 time=1.03 ms 42 | 64 bytes from redis.weave.local (10.22.2.1): icmp_seq=2 ttl=64 time=0.904 ms 43 | 64 bytes from redis.weave.local (10.22.2.1): icmp_seq=3 ttl=64 time=1.32 ms 44 | 45 | --- redis ping statistics --- 46 | 3 packets transmitted, 3 received, 0% packet loss, time 2002ms 47 | rtt min/avg/max/mdev = 0.904/1.086/1.323/0.177 ms 48 | ``` 49 | 50 | Then install Redis client: 51 | ``` 52 | root@rkt-48e60c5f-c461-4d82-b6a0-22bee4feea36:/# apt-get update 53 | root@rkt-48e60c5f-c461-4d82-b6a0-22bee4feea36:/# apt-get install redis-tools 54 | ``` 55 | 56 | And use it: 57 | ``` 58 | root@rkt-48e60c5f-c461-4d82-b6a0-22bee4feea36:/# redis-cli -h redis 59 | ``` 60 | 61 | That's it! 62 | -------------------------------------------------------------------------------- /rkt/Vagrantfile: -------------------------------------------------------------------------------- 1 | eval(File.open(File.join('..', 'imports', 'coreos-vagrant', 'Vagrantfile')).read) 2 | -------------------------------------------------------------------------------- /rkt/config.rb: -------------------------------------------------------------------------------- 1 | $num_instances = 2 2 | -------------------------------------------------------------------------------- /rkt/user-data: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | write_files: 3 | - path: /etc/weave.env 4 | permissions: '0600' 5 | owner: root 6 | content: | 7 | WEAVE_PEERS="172.17.8.101 172.17.8.102" 8 | # Uncomment and make it more secure 9 | # WEAVE_PASSWORD="aVeryLongString" 10 | - path: /etc/weave.core-01.env 11 | permissions: '0600' 12 | owner: root 13 | content: | 14 | WEAVEDNS_SUBNET="10.22.1.251/16" 15 | - path: /etc/weave.core-02.env 16 | permissions: '0600' 17 | owner: root 18 | content: | 19 | WEAVEDNS_SUBNET="10.22.2.251/16" 20 | - path: /etc/rkt/weave/core-01.conf 21 | permissions: '0600' 22 | owner: root 23 | content: | 24 | { 25 | "name": "default", 26 | "type": "bridge", 27 | "bridge": "weave", 28 | "isGateway": true, 29 | "ipMasq": true, 30 | "ipam": { 31 | "type": "host-local", 32 | "subnet": "10.22.0.0/16", 33 | "rangeStart": "10.22.1.1", 34 | "rangeEnd": "10.22.1.250", 35 | "gateway": "10.22.0.1", 36 | "routes": [ 37 | { "dst": "0.0.0.0/0" } 38 | ] 39 | } 40 | } 41 | 42 | - path: /etc/rkt/weave/core-02.conf 43 | permissions: '0600' 44 | owner: root 45 | content: | 46 | { 47 | "name": "default", 48 | "type": "bridge", 49 | "bridge": "weave", 50 | "isGateway": true, 51 | "ipMasq": true, 52 | "ipam": { 53 | "type": "host-local", 54 | "subnet": "10.22.0.0/16", 55 | "rangeStart": "10.22.2.1", 56 | "rangeEnd": "10.22.2.250", 57 | "gateway": "10.22.0.2", 58 | "routes": [ 59 | { "dst": "0.0.0.0/0" } 60 | ] 61 | } 62 | } 63 | 64 | - path: /opt/bin/weave-rkt-dns-add 65 | permissions: '0755' 66 | owner: root 67 | content: | 68 | #!/bin/bash 69 | expr=$(printf '{ if ( $2 == "%s" && $4 == "running" ) { split($5, a, "=") ; print a[2] } }' $1) 70 | ip=$(sudo rkt list | awk "${expr}") 71 | /opt/bin/weave dns-add $ip weave -h "${1}.weave.local" 72 | 73 | coreos: 74 | update: 75 | #group: stable 76 | reboot-strategy: 'off' 77 | units: 78 | - name: systemd-networkd-wait-online.service 79 | drop-ins: 80 | - name: 50-check-github-is-reachable.conf 81 | content: | 82 | [Service] 83 | ExecStart=/bin/sh -x -c \ 84 | 'until curl --silent --fail https://status.github.com/api/status.json | grep -q \"good\"; do sleep 2; done' 85 | - name: weave-network.target 86 | enable: true 87 | command: start 88 | content: | 89 | [Unit] 90 | Description=Weave Network Setup Complete 91 | Documentation=man:systemd.special(7) 92 | RefuseManualStart=no 93 | After=network-online.target 94 | Requires=weave.service 95 | #Requires=weaveproxy.service 96 | [Install] 97 | WantedBy=multi-user.target 98 | - name: 10-weave.network 99 | runtime: false 100 | content: | 101 | [Match] 102 | Type=bridge 103 | Name=weave* 104 | [Network] 105 | - name: install-weave.service 106 | enable: true 107 | content: | 108 | [Unit] 109 | After=network-online.target 110 | After=docker.service 111 | Before=weave.service 112 | Description=Install Weave 113 | Documentation=http://weave.works/docs 114 | Requires=network-online.target 115 | [Service] 116 | EnvironmentFile=-/etc/weave.%H.env 117 | EnvironmentFile=-/etc/weave.env 118 | Type=oneshot 119 | RemainAfterExit=yes 120 | TimeoutStartSec=0 121 | ExecStartPre=/bin/mkdir -p /opt/bin/ 122 | ExecStartPre=/usr/bin/curl \ 123 | --silent \ 124 | --location \ 125 | git.io/weave-snapshot \ 126 | --output /opt/bin/weave 127 | ExecStartPre=/usr/bin/chmod +x /opt/bin/weave 128 | ExecStartPre=/usr/bin/mkdir -p /etc/rkt/net.d/ 129 | ExecStartPre=/usr/bin/ln -s /etc/rkt/weave/%H.conf /etc/rkt/net.d/10-weave.conf 130 | ExecStart=/opt/bin/weave setup 131 | [Install] 132 | WantedBy=weave-network.target 133 | WantedBy=weave.service 134 | #WantedBy=weaveproxy.service 135 | - name: weaveproxy.service 136 | enable: false 137 | content: | 138 | [Unit] 139 | After=install-weave.service 140 | After=docker.service 141 | Description=Weave proxy for Docker API 142 | Documentation=http://weave.works/docs 143 | Requires=docker.service 144 | Requires=install-weave.service 145 | [Service] 146 | EnvironmentFile=-/etc/weave.%H.env 147 | EnvironmentFile=-/etc/weave.env 148 | ExecStartPre=/opt/bin/weave launch-proxy 149 | ExecStart=/usr/bin/docker attach weaveproxy 150 | Restart=on-failure 151 | ExecStop=/opt/bin/weave stop-proxy 152 | [Install] 153 | WantedBy=weave-network.target 154 | - name: weave.service 155 | enable: true 156 | content: | 157 | [Unit] 158 | After=install-weave.service 159 | After=docker.service 160 | Description=Weave Network Router 161 | Documentation=http://weave.works/docs 162 | Requires=docker.service 163 | Requires=install-weave.service 164 | [Service] 165 | TimeoutStartSec=0 166 | EnvironmentFile=-/etc/weave.%H.env 167 | EnvironmentFile=-/etc/weave.env 168 | ExecStartPre=/opt/bin/weave launch-router $WEAVE_PEERS $WEAVE_HOST_ARGS 169 | ExecStart=/usr/bin/docker attach weave 170 | ExecStartPost=/opt/bin/weave attach $WEAVEDNS_SUBNET weave 171 | Restart=on-failure 172 | ExecStop=/opt/bin/weave stop-router 173 | [Install] 174 | WantedBy=weave-network.target 175 | - name: redis.service 176 | enable: true 177 | content: | 178 | [Unit] 179 | After=weave-network.target 180 | Description=Redis 181 | Requires=weave-network.target 182 | ConditionHost=core-02 183 | [Service] 184 | TimeoutStartSec=0 185 | ExecStartPre=/bin/mkdir /tmp/redis 186 | ExecStart=/usr/bin/rkt run --insecure-skip-verify=true --mds-register=false --private-net --volume volume-data,kind=host,source=/tmp/redis docker://redis 187 | #TODO: ExecStartPost=/opt/bin/weave-rkt-dns-add redis 188 | Restart=on-failure 189 | ExecStop=/opt/bin/weave stop-router 190 | [Install] 191 | WantedBy=weave-network.target 192 | -------------------------------------------------------------------------------- /screencasts/hello-weave/create-infra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | p="--project weave-testing-1" 3 | z="--zone europe-west1-c" 4 | 5 | gcloud compute networks create $p \ 6 | 'test-net-1' 7 | gcloud compute firewall-rules create $p \ 8 | 'test-net-1-fw' \ 9 | --network 'test-net-1' \ 10 | --allow 'icmp,tcp:22,tcp:6783,udp:6783' 11 | gcloud compute instances create $p $z \ 12 | 'weave-01' 'weave-02' \ 13 | --image 'container-vm' \ 14 | --preemptible \ 15 | --network 'test-net-1' \ 16 | --metadata-from-file 'startup-script=provision.sh' 17 | -------------------------------------------------------------------------------- /screencasts/hello-weave/delete-infra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | p="--project weave-testing-1" 3 | z="--zone europe-west1-c" 4 | 5 | gcloud compute instances delete -q $p $z \ 6 | 'weave-01' 'weave-02' 7 | gcloud compute firewall-rules delete -q $p \ 8 | 'test-net-1-fw' 9 | gcloud compute networks delete -q $p \ 10 | 'test-net-1' 11 | -------------------------------------------------------------------------------- /screencasts/hello-weave/highlight.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import json 4 | 5 | from django.utils.termcolors import colorize 6 | 7 | prompts = ['ilya@weave-01:~$ ', 'ilya@weave-02:~$ '] 8 | 9 | ## Cheatsheet: (https://github.com/django/django/blob/master/django/utils/termcolors.py) 10 | # colours: black, red, green, yellow, blue, magenta, cyan, white 11 | # opts: bold, underscore, blink, reverse, conceal 12 | 13 | highlight = { 14 | 'weave-01': ['red', 'bold'], 15 | 'weave-02': ['red', 'bold'], 16 | 'docker': ['blue'], 17 | 'run': ['blue'], 18 | '-ti': ['blue'], 19 | '--name': ['red'], 20 | 'hello': ['red', 'bold'], 21 | 'ubuntu': ['blue'], 22 | 'netcat': ['green'], 23 | '-lk': ['green'], 24 | '1234': ['green'], 25 | 'Hello, Weave!\r\n': ['black', 'bold'], 26 | '\'Hello,': ['black', 'bold'], 27 | 'Weave!\'': ['black', 'bold'], 28 | 'export DOCKER_HOST=tcp://127.0.0.1:12375\r\n': ['cyan', 'bold'], 29 | 'weave': ['black', 'bold'], 30 | 'launch': ['black', 'bold'], 31 | 'launch-dns': ['black', 'bold'], 32 | 'launch-proxy': ['black', 'bold'], 33 | 'launch-proxy': ['black', 'bold'], 34 | 'proxy-env': ['black', 'bold'], 35 | 'env': ['black', 'bold'], 36 | '$(weave': ['black', 'bold'], 37 | 'proxy-env)': ['black', 'bold'], 38 | 'env)': ['black', 'bold'], 39 | } 40 | 41 | def get_colour(k): 42 | desc = highlight[k].copy() 43 | fg = desc.pop(0) 44 | opts=('noreset',)+ tuple(desc) 45 | return [0, colorize(fg=fg, opts=opts)] 46 | 47 | def start_colour(x, o): 48 | return (x[1] + o, get_colour(x[0])) 49 | 50 | def term_colour(x, o): 51 | l = len(x[0]) if x[2] else 1 52 | return (x[1] + l + o, [0, colorize()]) 53 | 54 | for f in ['rec-weave-01.json', 'rec-weave-02.json']: 55 | with open(f) as json_data: 56 | tokens = [] 57 | d = json.load(json_data) 58 | json_data.close() 59 | commands = d['stdout'] 60 | word = '' 61 | word_start = 0 62 | for i,x in enumerate(commands): 63 | curr = x[1] 64 | if curr in prompts: 65 | x[1] = colorize(curr, fg='yellow') 66 | elif curr != '\r\n' and curr != ' ' and len(curr) == 1: 67 | if word_start == 0: 68 | word_start = i 69 | word = curr 70 | else: 71 | word += curr 72 | elif (curr == '\r\n' or curr == ' ') and word_start != 0: 73 | tokens.append((word, word_start, True)) 74 | word_start = 0 75 | elif curr != '\r\n' and len(curr) > 1: 76 | tokens.append((curr, i, False)) 77 | 78 | offset = 0 79 | for x in tokens: 80 | if x[0] in highlight.keys(): 81 | commands.insert(*(start_colour(x, offset))) 82 | offset += 1 83 | commands.insert(*(term_colour(x, offset))) 84 | offset += 1 85 | 86 | d['commands'] = commands 87 | 88 | with open('fancy-' + f, 'w') as json_output: 89 | json_output.write(json.dumps(d)) 90 | json_output.close() 91 | -------------------------------------------------------------------------------- /screencasts/hello-weave/provision.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | gpasswd -a ilya docker 4 | 5 | for i in \ 6 | weaveworks/weave:1.1.1 \ 7 | weaveworks/weaveexec:1.1.1 \ 8 | weaveworks/weavedns:1.1.1 \ 9 | ubuntu ; 10 | do docker pull $i 11 | done 12 | -------------------------------------------------------------------------------- /screencasts/hello-weave/record.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | asciinema rec \ 3 | -c "gcloud compute ssh --project weave-testing-1 --zone europe-west1-c $1" \ 4 | -y "rec-$1.json" 5 | -------------------------------------------------------------------------------- /screencasts/hello-weave/script.md: -------------------------------------------------------------------------------- 1 | Hi, it’s Ilya from Weaveworks team! Today I am going to show you how easy it is to get started with Weave 1.1 and later versions. 2 | 3 | I have two machines here that had just been provisioned with a Linux base image that includes Docker. 4 | 5 | Firstly, I am installing Weave using the instructions from the docs — download it into `/usr/local/bin` using `curl` and set the executable permission, same on both machines. Next I will launch all of Weave Net & Run services. 6 | 7 | Here I have native host-level DNS provided for me, so I can simply type `weave launch weave-02`, which is the hostname of the second machine. Then I will run, `weave launch weave-01` on the other machine. 8 | 9 | Now the Weave cluster is fully connected and I have WeaveDNS for simple container discovery as well as the Docker API proxy, which will allow me to use Docker `run` command directly. 10 | 11 | Next, I will need to set `DOCKER_HOST` environment variable, for which there is a command — `weave env`. So I am going to evaluate this in the current shell. 12 | 13 | Same on the second machine - `eval $(weave env)`. 14 | 15 | Done with the setup, clear the output. 16 | 17 | Now I am all set to run some containers! 18 | 19 | Here, on the first host I will run a netcat server named “hello“, using plain ubuntu image, really nothing special. The server will listen on port 1234 and will print message to the standard output. 20 | 21 | And, on the other host, I want to run an interactive container to test the server. For this I want to use the same ubuntu image... 22 | 23 | First, I’ll ping the server... Great, that worked! 24 | 25 | Let's just send it a message across, “Hello, Weave!” — Excellent, this works! 26 | 27 | Thank you for watching! Do make sure to subscribe to our YouTube channel and follow us on Twitter @weaveworks ;v) 28 | -------------------------------------------------------------------------------- /screencasts/hello-weave/thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/screencasts/hello-weave/thumb.png -------------------------------------------------------------------------------- /screencasts/hello-weave/thumb.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/screencasts/hello-weave/thumb.psd -------------------------------------------------------------------------------- /screencasts/hello-weave/tmux-player.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo -n -e "\033]0;Containers. Containers. Containers. Made Simple!\007" 3 | 4 | s=hello-weave-screencast 5 | 6 | tmux -2 new-session -d -s $s -x 160 -y 90 7 | 8 | tmux set -t $s status off 9 | 10 | tmux set -t $s pane-border-fg black 11 | tmux set -t $s pane-active-border-fg black 12 | tmux set -t $s pane-active-border-bg default 13 | 14 | tmux split-window -v 15 | 16 | tmux select-pane -t 0 17 | tmux send-keys 'clear; asciinema play fancy-rec-weave-01.json; exit' C-m 18 | 19 | tmux select-pane -t 1 20 | tmux send-keys 'clear; asciinema play fancy-rec-weave-02.json; exit' C-m 21 | 22 | tmux -2 attach-session -t $s 23 | -------------------------------------------------------------------------------- /screencasts/hello-weave/tmux-record.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo -n -e "\033]0;Containers. Containers. Containers. Made Simple!\007" 3 | 4 | s=hello-weave-screencast 5 | 6 | tmux -2 new-session -d -s $s -x 160 -y 90 7 | 8 | tmux set -t $s status off 9 | 10 | tmux set -t $s pane-border-fg black 11 | tmux set -t $s pane-active-border-fg black 12 | tmux set -t $s pane-active-border-bg default 13 | 14 | tmux split-window -v 15 | 16 | tmux select-pane -t 0 17 | tmux send-keys 'clear; ./record.sh weave-01; exit' C-m 18 | 19 | tmux select-pane -t 1 20 | tmux send-keys 'clear; ./record.sh weave-02; exit' C-m 21 | 22 | tmux select-pane -t 0 23 | 24 | tmux -2 attach-session -t $s 25 | -------------------------------------------------------------------------------- /screencasts/kubernetes-anywhere/create.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | docker-machine create -d vmwarefusion kubedev 3 | docker-machine ssh kubedev 'img=weaveworks/kubernetes-anywhere ; for i in $img:tools $img:scheduler $img:apiserver $img:controller-manager $img:proxy $img:kubelet $img:etcd weaveworks/weaveexec:1.3.0 weaveworks/weave:1.3.0 weaveworks/scope:0.10.0 ; do docker pull $i ; done' 4 | -------------------------------------------------------------------------------- /screencasts/kubernetes-anywhere/record_p1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | asciinema rec -c "docker-machine ssh kubedev" -y kubernetes-anywhere-p1.json 3 | -------------------------------------------------------------------------------- /screencasts/misc/Screencast YT.terminal: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 | <plist version="1.0"> 4 | <dict> 5 | <key>ANSIBrightBlackColor</key> 6 | <data> 7 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 8 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw 9 | LjE0OTAxOTYwNzggMC4xNDUwOTgwMzkyIDAuMjIzNTI5NDExOAAQAYAC0hAREhNaJGNs 10 | YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp 11 | dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA 12 | AAAZAAAAAAAAAAAAAAAAAAAA2Q== 13 | </data> 14 | <key>ANSIBrightCyanColor</key> 15 | <data> 16 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 17 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEB0w 18 | LjA5ODAzOTIxNTY5IDAuNzg0MzEzNzI1NSAxABABgALSEBESE1okY2xhc3NuYW1lWCRj 19 | bGFzc2VzV05TQ29sb3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9v 20 | dIABCBEaIy0yNztBSE5bYoKEhouWn6eqs8XIzQAAAAAAAAEBAAAAAAAAABkAAAAAAAAA 21 | AAAAAAAAAADP 22 | </data> 23 | <key>ANSIBrightRedColor</key> 24 | <data> 25 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 26 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw 27 | Ljk4NDMxMzcyNTUgMC4xOTIxNTY4NjI3IDAuMDg2Mjc0NTA5OAAQAYAC0hAREhNaJGNs 28 | YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp 29 | dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA 30 | AAAZAAAAAAAAAAAAAAAAAAAA2Q== 31 | </data> 32 | <key>BackgroundColor</key> 33 | <data> 34 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 35 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMSAx 36 | IDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj 37 | dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa 38 | rK+0AAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY= 39 | </data> 40 | <key>BackgroundImageBookmark</key> 41 | <data> 42 | YnBsaXN0MDDUAQIDBAUGFBVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 43 | AAGGoKMHCA1VJG51bGzSCQoLDFdOUy5kYXRhViRjbGFzc08RBCRib29rJAQAAAAABBAw 44 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAwAABQAAAAEBAABVc2Vy 45 | cwAAAAQAAAABAQAAaWx5YQQAAAABAQAAQ29kZQYAAAABAQAAZ3VpZGVzAAALAAAAAQEA 46 | AHNjcmVlbmNhc3RzAAQAAAABAQAAbWlzYygAAAABAQAAd2VhdmUtc2NyZWVuY2FzdC10 47 | ZXJtaW5hbC1iYWNrZ3JvdW5kLnBzZBwAAAABBgAABAAAABQAAAAgAAAALAAAADwAAABQ 48 | AAAAXAAAAAgAAAAEAwAA+WYCAAAAAAAIAAAABAMAAKozCQAAAAAACAAAAAQDAAAwoQ8A 49 | AAAAAAgAAAAEAwAAWLraAgAAAAAIAAAABAMAAF3J2gIAAAAACAAAAAQDAABrydoCAAAA 50 | AAgAAAAEAwAAbcnaAgAAAAAcAAAAAQYAALAAAADAAAAA0AAAAOAAAADwAAAAAAEAABAB 51 | AAAIAAAAAAQAAEG7VCF8AAAAGAAAAAECAAABAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAI 52 | AAAABAMAAAUAAAAAAAAABAAAAAMDAAD1AQAACAAAAAEJAABmaWxlOi8vLwwAAAABAQAA 53 | TWFjaW50b3NoIEhECAAAAAQDAAAAYKIzdAAAAAgAAAAABAAAQblescYAAAAkAAAAAQEA 54 | ADI5MjBGNDc0LUNEN0MtMzQ0MC1CMThCLUIyODUwQkJDODlDNhgAAAABAgAAgQAAAAEA 55 | CADvFwAAAQAIAAAAAAAAAAAAAQAAAAEBAAAvAAAAAAAAAAEFAADiAAAAAQIAAGRiOTA1 56 | NDFlYzYxZWJjMmM2NGVkNjVkMGVmM2EyZTc1ZDU0NjRjMTg7MDAwMDAwMDA7MDAwMDAw 57 | MDA7MDAwMDAwMDAwMDAwMDAyMDtjb20uYXBwbGUuYXBwLXNhbmRib3gucmVhZC13cml0 58 | ZTswMDAwMDAwMTswMTAwMDAwNDswMDAwMDAwMDAyZGFjOTZkOy91c2Vycy9pbHlhL2Nv 59 | ZGUvZ3VpZGVzL3NjcmVlbmNhc3RzL21pc2Mvd2VhdmUtc2NyZWVuY2FzdC10ZXJtaW5h 60 | bC1iYWNrZ3JvdW5kLnBzZAAAAMwAAAD+////AQAAAAAAAAAQAAAABBAAAIwAAAAAAAAA 61 | BRAAACABAAAAAAAAEBAAAFQBAAAAAAAAQBAAAEQBAAAAAAAAAiAAACACAAAAAAAABSAA 62 | AJABAAAAAAAAECAAAKABAAAAAAAAESAAANQBAAAAAAAAEiAAALQBAAAAAAAAEyAAAMQB 63 | AAAAAAAAICAAAAACAAAAAAAAMCAAACwCAAAAAAAAAcAAAHQBAAAAAAAAEcAAABQAAAAA 64 | AAAAEsAAAIQBAAAAAAAAgPAAADQCAAAAAAAAgALSDg8QEVokY2xhc3NuYW1lWCRjbGFz 65 | c2VzXU5TTXV0YWJsZURhdGGjEBITVk5TRGF0YVhOU09iamVjdF8QD05TS2V5ZWRBcmNo 66 | aXZlctEWF1Ryb290gAEACAARABoAIwAtADIANwA7AEEARgBOAFUEfQR/BIQEjwSYBKYE 67 | qgSxBLoEzATPBNQAAAAAAAACAQAAAAAAAAAYAAAAAAAAAAAAAAAAAAAE1g== 68 | </data> 69 | <key>BackgroundSettingsForInactiveWindows</key> 70 | <false/> 71 | <key>Bell</key> 72 | <false/> 73 | <key>CursorBlink</key> 74 | <true/> 75 | <key>CursorColor</key> 76 | <data> 77 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 78 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMSAx 79 | IDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj 80 | dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa 81 | rK+0AAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY= 82 | </data> 83 | <key>CursorType</key> 84 | <integer>2</integer> 85 | <key>Font</key> 86 | <data> 87 | YnBsaXN0MDDUAQIDBAUGGBlYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 88 | AAGGoKQHCBESVSRudWxs1AkKCwwNDg8QVk5TU2l6ZVhOU2ZGbGFnc1ZOU05hbWVWJGNs 89 | YXNzI0AyAAAAAAAAEBCAAoADXE1lbmxvLUl0YWxpY9ITFBUWWiRjbGFzc25hbWVYJGNs 90 | YXNzZXNWTlNGb250ohUXWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hpdmVy0RobVHJvb3SA 91 | AQgRGiMtMjc8QktSW2JpcnR2eIWKlZ6lqLHDxssAAAAAAAABAQAAAAAAAAAcAAAAAAAA 92 | AAAAAAAAAAAAzQ== 93 | </data> 94 | <key>FontAntialias</key> 95 | <true/> 96 | <key>FontWidthSpacing</key> 97 | <real>1.004032258064516</real> 98 | <key>Linewrap</key> 99 | <true/> 100 | <key>ProfileCurrentVersion</key> 101 | <real>2.04</real> 102 | <key>ShowActiveProcessInTitle</key> 103 | <false/> 104 | <key>ShowCommandKeyInTitle</key> 105 | <false/> 106 | <key>ShowDimensionsInTitle</key> 107 | <false/> 108 | <key>ShowShellCommandInTitle</key> 109 | <false/> 110 | <key>ShowTTYNameInTitle</key> 111 | <false/> 112 | <key>ShowWindowSettingsNameInTitle</key> 113 | <false/> 114 | <key>UseBrightBold</key> 115 | <true/> 116 | <key>VisualBellOnlyWhenMuted</key> 117 | <false/> 118 | <key>WindowTitle</key> 119 | <string>Terminal</string> 120 | <key>columnCount</key> 121 | <integer>110</integer> 122 | <key>name</key> 123 | <string>Screencast YT</string> 124 | <key>rowCount</key> 125 | <integer>29</integer> 126 | <key>shellExitAction</key> 127 | <integer>1</integer> 128 | <key>type</key> 129 | <string>Window Settings</string> 130 | </dict> 131 | </plist> 132 | -------------------------------------------------------------------------------- /screencasts/misc/YouTube-icon-full_color.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/screencasts/misc/YouTube-icon-full_color.eps -------------------------------------------------------------------------------- /screencasts/misc/weave-screencast-terminal-background.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/screencasts/misc/weave-screencast-terminal-background.psd -------------------------------------------------------------------------------- /spring-boot-weave-microservices/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic Ubuntu, RabbitMQ, MongoDB, Eureka and Docker setup 2 | # 3 | # Weave Getting Started Guides 4 | 5 | require 'fileutils' 6 | require 'ipaddr' 7 | 8 | Vagrant.require_version ">= 1.6.0" 9 | 10 | VAGRANTFILE_API_VERSION = "2" 11 | 12 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 13 | 14 | # Defaults for config options defined in CONFIG 15 | 16 | $num_instances = 2 17 | $instance_1 = "weave-microservice-01" 18 | $instance_2 = "weave-microservice-02" 19 | $share_home = false 20 | $vm_gui = false 21 | $vm_memory = 3072 22 | $vm_cpus = 1 23 | $vm_starting_ip = "172.17.8.100" 24 | 25 | $vm_ip = $vm_starting_ip 26 | 27 | 28 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 29 | config.vm.box = "ubuntu/trusty64" 30 | config.ssh.insert_key = true 31 | 32 | if Vagrant.has_plugin?("vagrant-cachier") 33 | config.cache.scope = :box 34 | end 35 | 36 | # VM-2 37 | config.vm.define $instance_2 do |vm2| 38 | vm2.vm.hostname = $instance_2 39 | #if i == 1 40 | #vm2.vm.network "forwarded_port", guest: 80, host: 8080 41 | #end 42 | 43 | ip = IPAddr.new($vm_ip) 44 | $vm_ip = ip.succ.to_s 45 | vm2.vm.network "private_network", ip: $vm_ip 46 | 47 | vm2.vm.provider :virtualbox do |vb| 48 | vb.gui = $vm_gui 49 | vb.memory = $vm_memory 50 | vb.cpus = $vm_cpus 51 | end 52 | 53 | vm2.vm.provision "docker" do |d2| 54 | d2.pull_images "weaveworks/mongo" 55 | d2.pull_images "weaveworks/rabbitmq" 56 | d2.pull_images "weaveworks/microservice_apps" 57 | end 58 | end 59 | 60 | # VM-1 61 | config.vm.define $instance_1 do |vm1| 62 | vm1.vm.hostname = $instance_1 63 | #if i == 1 64 | vm1.vm.network "forwarded_port", guest: 8080, host: 8080 65 | vm1.vm.network "forwarded_port", guest: 8081, host: 8081 66 | #end 67 | 68 | ip = IPAddr.new($vm_ip) 69 | $vm_ip = ip.succ.to_s 70 | vm1.vm.network "private_network", ip: $vm_ip 71 | 72 | vm1.vm.provider :virtualbox do |vb| 73 | vb.gui = $vm_gui 74 | vb.memory = $vm_memory 75 | vb.cpus = $vm_cpus 76 | end 77 | 78 | vm1.vm.provision "docker" do |d1| 79 | d1.pull_images "weaveworks/eureka" 80 | d1.pull_images "weaveworks/microservice_apps" 81 | 82 | end 83 | end 84 | 85 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 86 | sudo curl -s -L git.io/weave -o /usr/local/bin/weave 87 | sudo chmod a+x /usr/local/bin/weave 88 | SHELL 89 | end -------------------------------------------------------------------------------- /spring-boot-weave-microservices/images/all-containers-communicating.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/spring-boot-weave-microservices/images/all-containers-communicating.png -------------------------------------------------------------------------------- /spring-boot-weave-microservices/images/backend-containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/spring-boot-weave-microservices/images/backend-containers.png -------------------------------------------------------------------------------- /spring-boot-weave-microservices/images/containerized-microservices-spring-boot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/spring-boot-weave-microservices/images/containerized-microservices-spring-boot.png -------------------------------------------------------------------------------- /spring-boot-weave-microservices/images/email-registration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/spring-boot-weave-microservices/images/email-registration.png -------------------------------------------------------------------------------- /spring-boot-weave-microservices/images/restful-rabbit-eureka.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/spring-boot-weave-microservices/images/restful-rabbit-eureka.png -------------------------------------------------------------------------------- /spring-boot-weave-microservices/images/two-peered-vms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/spring-boot-weave-microservices/images/two-peered-vms.png -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic Ubuntu and Docker setup Vagrantfile 2 | # 3 | # Weave Getting Started Guides 4 | # 5 | 6 | require 'fileutils' 7 | require 'ipaddr' 8 | 9 | Vagrant.require_version ">= 1.6.0" 10 | 11 | VAGRANTFILE_API_VERSION = "2" 12 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 13 | 14 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 15 | 16 | # Defaults for config options defined in CONFIG 17 | # 18 | 19 | $num_instances = 1 20 | $instance_name_prefix = "weave-gs" 21 | $share_home = false 22 | $vm_gui = false 23 | $vm_memory = 512 24 | $vm_cpus = 1 25 | $vm_starting_ip = "172.17.8.100" 26 | 27 | if File.exist?(CONFIG) 28 | require CONFIG 29 | end 30 | 31 | $vm_ip = $vm_starting_ip 32 | 33 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 34 | config.vm.box = "ubuntu/trusty64" 35 | config.ssh.insert_key = true 36 | 37 | if Vagrant.has_plugin?("vagrant-cachier") 38 | config.cache.scope = :box 39 | end 40 | 41 | (1..$num_instances).each do |i| 42 | 43 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 44 | config.vm.hostname = vm_name 45 | if i == 1 46 | config.vm.network "forwarded_port", guest: 80, host: 8080 47 | config.vm.network "forwarded_port", guest: 4040, host: 4040 48 | end 49 | 50 | ip = IPAddr.new($vm_ip) 51 | $vm_ip = ip.succ.to_s 52 | config.vm.network "private_network", ip: $vm_ip 53 | end 54 | end 55 | 56 | config.vm.provider :virtualbox do |vb| 57 | vb.gui = $vm_gui 58 | vb.memory = $vm_memory 59 | vb.cpus = $vm_cpus 60 | end 61 | 62 | config.vm.provision "docker" do |d| 63 | d.pull_images "ubuntu" 64 | d.pull_images "java:8" 65 | d.pull_images "weaveworks/myip-scratch" 66 | d.pull_images "weaveworks/weave-gs-ubuntu-curl" 67 | d.pull_images "weaveworks/weave" 68 | d.pull_images "gliderlabs/alpine:edge" 69 | d.pull_images "gliderlabs/alpine:latest" 70 | d.pull_images "weaveworks/gs-spring-boot-docker" 71 | end 72 | 73 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 74 | sudo curl -L git.io/weave -o /usr/local/bin/weave 75 | sudo chmod a+x /usr/local/bin/weave 76 | sudo wget -O /usr/local/bin/scope https://github.com/weaveworks/scope/releases/download/latest_release/scope 77 | sudo chmod a+x /usr/local/bin/scope 78 | sudo curl -L https://github.com/docker/compose/releases/download/1.3.3/docker-compose-Linux-x86_64 > /usr/local/bin/docker-compose 79 | sudo chmod a+x /usr/local/bin/docker-compose 80 | sudo add-apt-repository -y ppa:openjdk-r/ppa 81 | sudo apt-get update 82 | sudo apt-get install -y openjdk-8-jdk 83 | sudo apt-get install -y gradle 84 | SHELL 85 | end 86 | -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:8 2 | VOLUME /tmp 3 | ADD target/gs-spring-boot-docker-0.1.0.jar app.jar 4 | RUN bash -c 'touch /app.jar' 5 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 6 | -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/README.md: -------------------------------------------------------------------------------- 1 | # Spring Example for use with Weave 2 | 3 | This is a very basic [Spring](http://spring.io) example for use in a demo of [Weave Run](http://weave.works/run) functionality. It is derived from [_'Spring Boot with Docker'_](http://spring.io/guides/gs/spring-boot-docker/). 4 | 5 | If you are using the `Vagrantfile` from this example all of the requirements are already installed. 6 | 7 | To build the docker image, run the following: 8 | ~~~ 9 | mvn clean package 10 | ~~~ 11 | 12 | To create the container image use 13 | 14 | ~~~ 15 | docker build -t <your tag> . 16 | ~~~ 17 | -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE") 7 | } 8 | } 9 | 10 | apply plugin: 'java' 11 | apply plugin: 'eclipse' 12 | apply plugin: 'idea' 13 | apply plugin: 'spring-boot' 14 | 15 | jar { 16 | baseName = 'gs-spring-boot-docker' 17 | version = '0.1.0' 18 | } 19 | 20 | repositories { 21 | mavenCentral() 22 | } 23 | 24 | sourceCompatibility = 1.8 25 | targetCompatibility = 1.8 26 | 27 | dependencies { 28 | compile("org.springframework.boot:spring-boot-starter-web") 29 | testCompile("org.springframework.boot:spring-boot-starter-test") 30 | } 31 | 32 | task wrapper(type: Wrapper) { 33 | gradleVersion = '2.3' 34 | } 35 | -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/spring-boot-weave-service-discovery/demo/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 01 09:00:06 CDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip 7 | -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/pom.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4 | <modelVersion>4.0.0</modelVersion> 5 | 6 | <groupId>org.springframework</groupId> 7 | <artifactId>gs-spring-boot-docker</artifactId> 8 | <version>0.1.0</version> 9 | 10 | <parent> 11 | <groupId>org.springframework.boot</groupId> 12 | <artifactId>spring-boot-starter-parent</artifactId> 13 | <version>1.2.5.RELEASE</version> 14 | </parent> 15 | 16 | <properties> 17 | <java.version>1.8</java.version> 18 | </properties> 19 | 20 | <dependencies> 21 | <dependency> 22 | <groupId>org.springframework.boot</groupId> 23 | <artifactId>spring-boot-starter-web</artifactId> 24 | </dependency> 25 | <dependency> 26 | <groupId>org.springframework.boot</groupId> 27 | <artifactId>spring-boot-starter-test</artifactId> 28 | <scope>test</scope> 29 | </dependency> 30 | </dependencies> 31 | 32 | 33 | <build> 34 | <plugins> 35 | <plugin> 36 | <groupId>org.springframework.boot</groupId> 37 | <artifactId>spring-boot-maven-plugin</artifactId> 38 | </plugin> 39 | </plugins> 40 | </build> 41 | 42 | </project> 43 | -------------------------------------------------------------------------------- /spring-boot-weave-service-discovery/demo/src/main/java/hello/Application.java: -------------------------------------------------------------------------------- 1 | package hello; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.bind.RelaxedPropertyResolver; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | @SpringBootApplication 10 | @RestController 11 | public class Application { 12 | 13 | @RequestMapping("/") 14 | public String home() { 15 | return "Hello, Weave!"; 16 | } 17 | 18 | public static void main(String[] args) { 19 | SpringApplication.run(Application.class, args); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /tools/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM fedora:22 2 | -------------------------------------------------------------------------------- /ubuntu-all-in-one/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | --- 4 | 5 | 6 | **Note:** You are looking at our `old-guides` repository. The guides in here haven't been updated in a while. 7 | They might or might not work for you. We are keeping them around for informational purposes. 8 | 9 | --- 10 | 11 | ## What You Will Build ## 12 | 13 | **Weave** allows you to focus on developing your application, rather than your infrastructure. 14 | 15 | In this example, you will: 16 | 17 | 1. Create a simple application running in a container on one host. 18 | 2. Run a service which Your provides a JSON message containing the date and the message `hello world`. 19 | 3. Query the `hello world` service from a second container using `curl`. 20 | 21 | This guide requires no programming skills and takes about 10 minutes to complete. 22 | 23 | ![Weave and Docker](../images/Simple_Weave.png) 24 | 25 | ## What You Will Use 26 | 27 | * [Weave](https://weave.works) 28 | * [Docker](http://docker.com) 29 | * [Ubuntu](http://ubuntu.com) 30 | 31 | ## Before Starting This Guide 32 | 33 | Ensure you have the following installed before starting this guide: 34 | 35 | * [Git](http://git-scm.com/downloads) 36 | * [Vagrant & VirtualBox](/guides/about/vagrant.html) 37 | 38 | You are also provided with a script to setup the demo, if you would like to work through a manual example please 39 | see our more detailed [getting started guide](https://github.com/weaveworks/guides/blob/master/ubuntu-simple/README.md). 40 | 41 | ## Setting Up The Hosts 42 | 43 | The code for this example is available on github. To begin, clone the getting started repository: 44 | 45 | ~~~bash 46 | git clone https://github.com/weaveworks/guides 47 | ~~~ 48 | 49 | Vagrant sets up and configures the two Ubuntu hosts, and then it installs Docker and **Weave**. The two hosts named `weave-gs-01` and `weave-gs-02` are assigned IP addresses on a [private network](http://en.wikipedia.org/wiki/Private%5Fnetwork). 50 | 51 | ~~~bash 52 | cd guides/ubuntu-all-in-one 53 | vagrant up 54 | ~~~ 55 | 56 | Vagrant pulls down and configures an Ubuntu image. This may take a few minutes depending on the speed of your network connection. For more information about Vagrant and how it works, refer to the [Vagrant documentation](http://vagrantup.com). 57 | 58 | >Note: You may be prompted for a password when `/etc/hosts` is being updated during the Vagrant setup, press return at this point. 59 | 60 | Once the hosts are setup, you can check their status using: 61 | 62 | ~~~bash 63 | vagrant status 64 | ~~~ 65 | 66 | The IP addresses used in this demo are 67 | 68 | ~~~bash 69 | 172.17.8.101 weave-gs-01 70 | 172.17.8.102 weave-gs-02 71 | ~~~ 72 | 73 | ## Launching Weave and The Demo Containers 74 | 75 | Run the script `launch-simple-demo.sh` 76 | 77 | This script: 78 | 79 | * launches **Weave** onto each of the hosts 80 | * launches a container with a simple hello world webserver in `weave-gs-02` (CONTAINER1) using the IP address `10.3.1.1` 81 | * launches a container containing `curl` which you will use to connect to CONTAINER1 on `weave-gs-01` with an IP address of `10.3.1.2` 82 | 83 | On `weave-gs-01`, a **Weave** router container was installed. On `weave-gs-02` another **Weave** router container was launched by passing the IP address of your first host. This tells **Weave** on `weave-gs-02` to create a peer with the **Weave** on `weave-gs-01`. 84 | 85 | 86 | ## Connecting Containers 87 | 88 | Log onto `weave-gs-01`, where the curl container is running, by typing: 89 | 90 | ~~~bash 91 | vagrant ssh weave-gs-01 92 | ~~~ 93 | 94 | Connect to the container: 95 | 96 | ~~~bash 97 | CONTAINER=$(sudo docker ps | grep weave-gs-ubuntu-curl | awk '{print $1}') 98 | sudo docker attach $CONTAINER 99 | curl 10.3.1.1 100 | ~~~ 101 | 102 | This returns the following from the 'Hello World' service running on weave-gs-02: 103 | 104 | ~~~javascript 105 | { 106 | "message" : "Hello World", 107 | "date" : "2015-03-13 15:03:52" 108 | } 109 | ~~~ 110 | 111 | ## Conclusions 112 | 113 | You have now used Weave to quickly deploy an application across two hosts using containers. 114 | 115 | ## Further Reading 116 | 117 | * [How Weave Works](/docs/net/latest/how-it-works/) 118 | * [Weave Features](/docs/net/latest/features) 119 | -------------------------------------------------------------------------------- /ubuntu-all-in-one/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic Ubuntu and Docker setup Vagrantfile 2 | # 3 | # Weave Getting Started Guides 4 | # 5 | 6 | require 'fileutils' 7 | require 'ipaddr' 8 | 9 | Vagrant.require_version ">= 1.6.0" 10 | 11 | VAGRANTFILE_API_VERSION = "2" 12 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 13 | 14 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 15 | 16 | # Defaults for config options defined in CONFIG 17 | # 18 | 19 | $num_instances = 2 20 | $instance_name_prefix = "weave-gs" 21 | $share_home = false 22 | $vm_gui = false 23 | $vm_memory = 512 24 | $vm_cpus = 1 25 | $vm_starting_ip = "172.17.8.100" 26 | 27 | if File.exist?(CONFIG) 28 | require CONFIG 29 | end 30 | 31 | $vm_ip = $vm_starting_ip 32 | 33 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 34 | config.vm.box = "ubuntu/trusty64" 35 | config.ssh.insert_key = true 36 | 37 | if Vagrant.has_plugin?("vagrant-cachier") 38 | config.cache.scope = :box 39 | end 40 | 41 | (1..$num_instances).each do |i| 42 | 43 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 44 | config.vm.hostname = vm_name 45 | if i == 1 46 | config.vm.network "forwarded_port", guest: 80, host: 8080 47 | end 48 | 49 | ip = IPAddr.new($vm_ip) 50 | $vm_ip = ip.succ.to_s 51 | config.vm.network "private_network", ip: $vm_ip 52 | end 53 | end 54 | 55 | config.vm.provider :virtualbox do |vb| 56 | vb.gui = $vm_gui 57 | vb.memory = $vm_memory 58 | vb.cpus = $vm_cpus 59 | end 60 | 61 | config.vm.provision "docker" do |d| 62 | d.pull_images "ubuntu" 63 | d.pull_images "nginx" 64 | d.pull_images "weaveworks/weave" 65 | d.pull_images "weaveworks/weave-gs-simple-hw" 66 | d.pull_images "weaveworks/weave-gs-ubuntu-curl" 67 | end 68 | 69 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 70 | sudo wget -O /usr/local/bin/weave https://github.com/weaveworks/weave/releases/download/latest_release/weave 71 | sudo chmod a+x /usr/local/bin/weave 72 | SHELL 73 | end 74 | -------------------------------------------------------------------------------- /ubuntu-all-in-one/config.rb: -------------------------------------------------------------------------------- 1 | $num_instances = 2 2 | -------------------------------------------------------------------------------- /ubuntu-all-in-one/launch-simple-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | echo "Launching Weave on each vagrant host" 4 | 5 | vagrant ssh weave-gs-01 -c "weave launch" >/dev/null 2>&1 6 | vagrant ssh weave-gs-02 -c "weave launch 172.17.8.101" >/dev/null 2>&1 7 | 8 | echo "Launching demo container on weave-gs-02" 9 | vagrant ssh weave-gs-02 -c "weave run 10.3.1.1/24 weaveworks/weave-gs-simple-hw" >/dev/null 2>&1 10 | 11 | echo "Launching container with curl on weave-gs-01" 12 | vagrant ssh weave-gs-01 -c "weave run 10.3.1.2/24 weaveworks/weave-gs-ubuntu-curl" >/dev/null 2>&1 13 | -------------------------------------------------------------------------------- /ubuntu-interactive/Dockerfile: -------------------------------------------------------------------------------- 1 | # Image for use in demos, now that official ubuntu:latest doesn't contain nc or ping 2 | FROM ubuntu:xenial 3 | MAINTAINER Weaveworks Inc <help@weave.works> 4 | RUN apt-get update && apt-get install -y --no-install-recommends \ 5 | iputils-ping netcat \ 6 | && rm -rf /var/lib/apt/lists/* 7 | -------------------------------------------------------------------------------- /ubuntu-interactive/README.md: -------------------------------------------------------------------------------- 1 | # Ubuntu Image # 2 | 3 | This Dockerfile builds an image that can be used in interactive demos. 4 | 5 | E.g. 6 | 7 | $ docker run -ti --net=weave weaveworks/ubuntu 8 | 9 | The reason we need this, rather than just using the official `ubuntu` 10 | image, is that the latter does not have `ping` and `nc` commands. 11 | -------------------------------------------------------------------------------- /ubuntu-simple/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | -------------------------------------------------------------------------------- /ubuntu-simple/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:trusty 2 | RUN export DEBIAN_FRONTEND=noninteractive ; \ 3 | apt-get -qqy update && \ 4 | apt-get -qqy install apache2 php5 libapache2-mod-php5 php5-mcrypt 5 | RUN rm -f /var/www/html/index.html 6 | ADD example/index.php /var/www/html/ 7 | CMD apache2ctl -D FOREGROUND 8 | -------------------------------------------------------------------------------- /ubuntu-simple/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic Ubuntu and Docker setup Vagrantfile 2 | # 3 | # Weave Getting Started Guides 4 | # 5 | 6 | require 'fileutils' 7 | require 'ipaddr' 8 | 9 | Vagrant.require_version ">= 1.6.0" 10 | 11 | VAGRANTFILE_API_VERSION = "2" 12 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 13 | 14 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 15 | 16 | # Defaults for config options defined in CONFIG 17 | 18 | $num_instances = 2 19 | $instance_name_prefix = "weave-gs" 20 | $share_home = false 21 | $vm_gui = false 22 | $vm_memory = 1024 23 | $vm_cpus = 1 24 | $vm_starting_ip = "172.17.8.100" 25 | 26 | if File.exist?(CONFIG) 27 | require CONFIG 28 | end 29 | 30 | $vm_ip = $vm_starting_ip 31 | 32 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 33 | config.vm.box = "ubuntu/trusty64" 34 | config.ssh.insert_key = true 35 | 36 | if Vagrant.has_plugin?("vagrant-cachier") 37 | config.cache.scope = :box 38 | end 39 | 40 | (1..$num_instances).each do |i| 41 | 42 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 43 | config.vm.hostname = vm_name 44 | 45 | # just split out the ip 46 | 47 | ip = IPAddr.new($vm_ip) 48 | $vm_ip = ip.succ.to_s 49 | config.vm.network :private_network, ip: $vm_ip 50 | end 51 | end 52 | 53 | config.vm.provider :virtualbox do |vb| 54 | vb.gui = $vm_gui 55 | vb.memory = $vm_memory 56 | vb.cpus = $vm_cpus 57 | end 58 | 59 | # install docker packages 60 | # 61 | # https://docs.docker.com/installation/ubuntulinux/ 62 | 63 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 64 | export DEBIAN_FRONTEND=noninteractive 65 | [ -e /usr/lib/apt/methods/https ] || { 66 | apt-get -qqy update 67 | apt-get -qqy install apt-transport-https 68 | } 69 | 70 | echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list 71 | sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 72 | apt-get -qqy update 73 | apt-get -qqy install lxc-docker 74 | SHELL 75 | end 76 | -------------------------------------------------------------------------------- /ubuntu-simple/config.rb: -------------------------------------------------------------------------------- 1 | $num_instances = 2 2 | -------------------------------------------------------------------------------- /ubuntu-simple/example/index.php: -------------------------------------------------------------------------------- 1 | { 2 | "message" : "Hello, Weave!", 3 | "date" : "<?php echo date('Y-m-d H:i:s') ?>" 4 | } 5 | -------------------------------------------------------------------------------- /vagrant.md: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /guides/about/vagrant.html 3 | title: How We Use Vagrant In These Guides 4 | layout: guides 5 | shorttitle: About These Guides 6 | description: Using Vagrant and Weave. 7 | sidebarpath: /start/vagrant 8 | sidebarweight: 5 9 | --- 10 | 11 | 12 | 13 | [Vagrant](https://www.vagrantup.com/) is a great product developed by our friends at [HashiCorp](https://hashicorp.com/). It allows 14 | you to automate provisoning of VirtualBox VMs, and enables rapid prototyping of infrastructure or subsets of it using a very simple Ruby-based DSL. Vagrant works with VMWare, with KVM, and also provides plugins to integrate with a number of public cloud providers. 15 | 16 | For information on how and where you can use Vagrant, see [Why Vagrant?](https://docs.vagrantup.com/v2/why-vagrant/index.html) 17 | 18 | ## Installation 19 | 20 | * [Vagrant](https://docs.vagrantup.com/v2/installation/index.html) 21 | * [VirtualBox](https://www.virtualbox.org/wiki/Downloads) 22 | 23 | ## General Usage Pattern 24 | 25 | Most of our Vagrant-based guides begin by cloning the [`weaveworks/guides`](https://github.com/weaveworks/guides) repository, and then changing to a subdirectory: 26 | 27 | cd guides/<title> 28 | 29 | Next, one or more VMs are booted: 30 | 31 | vagrant up 32 | 33 | and then, depending on what kind of VMs we are running, you can login: 34 | 35 | vagrant ssh [<vm>] 36 | 37 | When a guide says to _"login to `vm-X`"_, it implies that you should open another terminal, go to the directory of the guide and then run: 38 | 39 | vagrant ssh vm-X. 40 | 41 | In the step-by-step instructions of our guides, commands are prefixed with the remote prompt of the shell, as it 42 | appears to you, but we do not show it when you are expected to copy several commands at once or when running a command on your local machine (e.g. `vagrant up` as it appears above). 43 | 44 | Once you have completed a guide, you can dispose of the VM(s) using: 45 | 46 | vagrant destroy 47 | 48 | If you need to free-up resources on your machine, run `vagrant destroy`. You can then resume the guide at a later time. 49 | 50 | ##Vagrant In Our Guides 51 | 52 | These guides are alway tested using the latest release of Vagrant together with the most recent release of VirtualBox. If something doesn't work, please try upgrading both of those packages first. 53 | 54 | To ensure that Vagrant works on all operating systems, Vagrant is always used with the default VirtualBox backend. We never require you to install any 3rd-party plugins and also we will never require you pay for an addional license or for any public cloud compute time. You should be able to run all of these guides on your own computer. 55 | 56 | The intention of these guides is to demonstrate a fully-functional system in a box. We expect users to learn Weave 57 | from using a Vagrant-based guide, which can later be adapted as a template to use in a production setting. As previously mentioned, we always assume a VirtualBox-based setup, and we will certainly accept contributions for enabling other environments. 58 | 59 | Do note that we currently have no implicit figures of RAM and CPU requirements in any of our guides, and the perfomance may vary depending on your hardware. However, in most cases you should be able to reduce those requirements declared in the Vagrantfile that you are using. As a rule, we refrain from using more then 3 VMs, claiming 6GB+ in total, and we never ask for more than 2 CPU cores per VM. 60 | 61 | A public cloud provider plugin may come in handy when you want to scale out your development cluster. 62 | 63 | Vagrant is generally used as a development tool, so we don't recommend transplanting Vagrant workflows directly to 64 | production. If are thinking about this, you may wish to consider [other HashiCorp tools that are better suited to this job.](https://www.terraform.io/intro/hashicorp-ecosystem.html). 65 | 66 | -------------------------------------------------------------------------------- /weave-and-docker-platform/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | ADD . /code 3 | WORKDIR /code 4 | RUN pip install -r requirements.txt 5 | -------------------------------------------------------------------------------- /weave-and-docker-platform/app/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | from redis import Redis 3 | import os 4 | app = Flask(__name__) 5 | redis = Redis(host='redis', port=6379) 6 | 7 | @app.route('/') 8 | def hello(): 9 | redis.incr('hits') 10 | return 'Hello World! I have been seen %s times.\n' % redis.get('hits') 11 | 12 | if __name__ == "__main__": 13 | app.run(host="0.0.0.0", debug=True) 14 | -------------------------------------------------------------------------------- /weave-and-docker-platform/app/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | echo "Building on 'weave-1':" 4 | docker $(docker-machine config 'weave-1') build -t app_web . 5 | echo "Copying from 'weave-1' to 'weave-2' and 'weave-3'..." 6 | docker $(docker-machine config 'weave-1') save app_web \ 7 | | tee \ 8 | >(docker $(docker-machine config 'weave-2') load) \ 9 | >(docker $(docker-machine config 'weave-3') load) \ 10 | | cat > /dev/null 11 | -------------------------------------------------------------------------------- /weave-and-docker-platform/app/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | web: 5 | build: . 6 | command: python app.py 7 | ports: 8 | - "80:5000" 9 | hostname: hello.weave.local 10 | network_mode: "bridge" 11 | environment: 12 | - "affinity:container!=app_web_*" 13 | redis: 14 | image: redis 15 | hostname: redis.weave.local 16 | network_mode: "bridge" 17 | -------------------------------------------------------------------------------- /weave-and-docker-platform/app/requirements.txt: -------------------------------------------------------------------------------- 1 | flask 2 | redis -------------------------------------------------------------------------------- /weave-and-docker-platform/scripts/1-machine-create.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | DOCKER_MACHINE_DRIVER=${DOCKER_MACHINE_DRIVER:-"virtualbox"} 4 | 5 | driver_flags="--driver ${DOCKER_MACHINE_DRIVER}" 6 | 7 | ## I am using curl to create tokens as I find it the easiest, otherwise 8 | ## one needs to either download or compile a `docker-swarm` binary or 9 | ## have a Docker daemon running 10 | DOCKER_SWARM_CREATE=${DOCKER_SWARM_CREATE:-"curl -s -XPOST https://discovery.hub.docker.com/v1/clusters"} 11 | 12 | swarm_flags="--swarm --swarm-discovery=token://$(${DOCKER_SWARM_CREATE})" 13 | 14 | for i in $(seq 3) ; do 15 | if [ ${i} = 1 ] ; then 16 | ## The first machine shall be the Swarm master 17 | docker-machine create \ 18 | ${driver_flags} \ 19 | ${swarm_flags} \ 20 | --swarm-master \ 21 | "weave-${i}" 22 | else 23 | ## The rest of machines are Swarm slaves 24 | docker-machine create \ 25 | ${driver_flags} \ 26 | ${swarm_flags} \ 27 | "weave-${i}" 28 | fi 29 | done 30 | -------------------------------------------------------------------------------- /weave-and-docker-platform/scripts/2-weave-launch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | for i in $(seq 3) ; do 4 | ## This environment variable is respected by Weave script, 5 | ## hence it needs to be exported 6 | export DOCKER_CLIENT_ARGS="$(docker-machine config weave-${i})" 7 | 8 | ## We are going to use IPAM, hence we supply estimated cluster size 9 | ./weave launch --ipalloc-init consensus=3 10 | 11 | ## Let's connect-up the Weave cluster by telling 12 | ## each of the nodes about the head node (weave-1) 13 | if [ ${i} -gt 1 ] ; then 14 | ./weave connect $(docker-machine ip 'weave-1') 15 | fi 16 | done 17 | -------------------------------------------------------------------------------- /weave-and-docker-platform/scripts/3-replace-swarm-agents.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | ## TODO: We can probably get rid of this with Docker Machine 0.8.0, 4 | ## as it has `--swarm-join-opt` flag which we should be able to use 5 | ## (at least in theory) 6 | 7 | DOCKER_SWARM_CREATE=${DOCKER_SWARM_CREATE:-"curl -s -XPOST https://discovery-stage.hub.docker.com/v1/clusters"} 8 | 9 | ## This script will replace Swarm agent, aside from that it will have 10 | ## point them to Weave proxy port 12375 instead of Docker port 2376, 11 | ## it will need a new token as the registration on Docker Hub stores 12 | ## an array of `<host>:<port>` pairs and the clean-up method doesn't 13 | ## seem to be documented 14 | swarm_discovery_token="$(${DOCKER_SWARM_CREATE})" 15 | 16 | for i in $(seq 3 | sort -r) ; do 17 | ## We are not really using Weave script anymore, hence 18 | ## this is only a local variable 19 | DOCKER_CLIENT_ARGS="$(docker-machine config weave-${i})" 20 | 21 | ## Default Weave proxy port is 12375 22 | weave_proxy_endpoint="$(docker-machine ip weave-${i}):12375" 23 | 24 | ## Next, we restart the slave agents 25 | docker ${DOCKER_CLIENT_ARGS} rm -f swarm-agent 26 | docker ${DOCKER_CLIENT_ARGS} run \ 27 | -d \ 28 | --restart=always \ 29 | --name=swarm-agent \ 30 | swarm join \ 31 | --addr "${weave_proxy_endpoint}" \ 32 | "token://${swarm_discovery_token}" 33 | 34 | if [ ${i} = 1 ] ; then 35 | ## On the head node (weave-1) we will also restart the master 36 | ## with the new token and all the original arguments; the reason 37 | ## this is a bit complicated is because we need steal all the 38 | ## `--tls*` arguments as well as the `-v` ones 39 | swarm_master_args_fmt="\ 40 | -d \ 41 | --restart=always \ 42 | --name={{.Name}} \ 43 | -p 3376:3376 \ 44 | {{range .HostConfig.Binds}}-v {{.}} {{end}} \ 45 | swarm{{range .Args}} {{.}}{{end}} \ 46 | " 47 | swarm_master_args=$(docker ${DOCKER_CLIENT_ARGS} inspect \ 48 | --format="${swarm_master_args_fmt}" \ 49 | swarm-agent-master \ 50 | | sed "s|\(token://\)[[:alnum:]]*|\1${swarm_discovery_token}|") 51 | 52 | docker ${DOCKER_CLIENT_ARGS} rm -f swarm-agent-master 53 | docker ${DOCKER_CLIENT_ARGS} run ${swarm_master_args} 54 | fi 55 | done 56 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/2_Node_HAProxy_AWS_Example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaveworks-guides/weave-net-legacy/2d028a85fd5255e28c77a47c3623d62b7b80e69d/weave-ansible-haproxy-aws/2_Node_HAProxy_AWS_Example.png -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/access-aws-hosts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | 4 | DIRNAME=`dirname $0` 5 | CURL=curl 6 | 7 | if [ $DIRNAME = "." ]; then 8 | DIRNAME=`pwd` 9 | fi 10 | 11 | ANSIBLE_INVENTORY=${ANSIBLE_INVENTORY:-$DIRNAME/inventory} 12 | 13 | if [ ! -f $ANSIBLE_INVENTORY ]; then 14 | echo "No Ansible inventory file found, exiting" 15 | exit 1 16 | fi 17 | 18 | # we our public ip address 19 | 20 | AWS_PUBLIC_IP=$(grep public_ip $ANSIBLE_INVENTORY | cut -d "=" -f2) 21 | 22 | type -P "$CURL" >/dev/null 2>&1 && echo "Connecting to HAProxy with Weave on AWS demo" || { echo "curl not found, exiting"; exit 1; } 23 | 24 | for i in `seq 1 6` 25 | do 26 | curl $AWS_PUBLIC_IP 27 | done 28 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | hostfile = ./inventory 3 | host_key_checking = False 4 | remote_user = ubuntu 5 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/ansible_aws_variables.yml: -------------------------------------------------------------------------------- 1 | --- 2 | aws_region: eu-west-1 3 | template: ami-799e100e 4 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/check-region.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Weave AWS Region Check 4 | # 5 | # Creates an environment file we can source for use with Ansible 6 | # based on our AWS region 7 | # 8 | 9 | AWS=aws 10 | AWS_REGION=${AWS_REGION:-} 11 | AWS_AMI=${AWS_AMI:-} 12 | DIRNAME=`dirname $0` 13 | WEAVEDEMO_ANSIBLE_VARS=$DIRNAME/ansible_aws_variables.yml 14 | 15 | function usage { 16 | 17 | OURNAME=$(basename $0) 18 | echo "Usage: $OURNAME [-r AWS_REGION]" 19 | exit 1 20 | } 21 | 22 | while getopts ":r:" OPTION; do 23 | case $OPTION in 24 | r) AWS_REGION=${OPTARG} 25 | ;; 26 | *) usage 27 | ;; 28 | esac 29 | done 30 | 31 | shift $((OPTIND - 1)) 32 | 33 | if [ $DIRNAME = "." ]; then 34 | DIRNAME=`pwd` 35 | fi 36 | 37 | AMI_LIST=$DIRNAME/data/ami-list.csv 38 | 39 | if [ ! -f $AMI_LIST ]; then 40 | echo "No AMI List found, exiting" 41 | exit 1 42 | fi 43 | 44 | if [ -z $AWS_REGION ]; then 45 | type -P "$AWS" >/dev/null 2>&1 && echo "Getting AWS Region" || { echo "aws not found, exiting"; exit 1; } 46 | AWS_REGION=$(aws configure list | grep region | awk '{print $2}') 47 | fi 48 | 49 | AWS_AMI=$(grep $AWS_REGION $AMI_LIST | cut -d"," -f2) 50 | 51 | if [ -z $AWS_AMI ]; then 52 | echo "No AMI found in our list for region $AWS_REGION" 53 | exit 1 54 | fi 55 | 56 | echo "Generating variables file for use with Ansible" 57 | 58 | echo "---" > $WEAVEDEMO_ANSIBLE_VARS 59 | echo "aws_region: $AWS_REGION" >> $WEAVEDEMO_ANSIBLE_VARS 60 | echo "template: $AWS_AMI" >> $WEAVEDEMO_ANSIBLE_VARS 61 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/data/ami-list.csv: -------------------------------------------------------------------------------- 1 | # region, ami 2 | eu-west-1,ami-799e100e 3 | ap-northeast-1,ami-3b71953b 4 | ap-southeast-1,ami-d4f1c486 5 | ap-southeast-2,ami-a5b2c59f 6 | eu-central-1,ami-b683b0ab 7 | sa-east-1,ami-c744fbda 8 | us-east-1,ami-08f8b160 9 | us-west-1,ami-7e9d863b 10 | us-west-2,ami-830a2fb3 11 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/inventory: -------------------------------------------------------------------------------- 1 | [default] 2 | localhost ansible_python_interpreter=/usr/bin/python 3 | 4 | [launched] 5 | 6 | [launched:vars] 7 | 8 | [nodes:vars] 9 | ansible_ssh_user=ubuntu 10 | ansible_ssh_private_key_file=~/.ssh/id_rsa_weavedemo 11 | ansible_python_interpreter="PATH=/home/core/bin:$PATH python" 12 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/launch-weave-haproxy-aws-demo.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Launch Weave, HAProxy and Web Server Containers 3 | hosts: launched 4 | sudo: yes 5 | remote_user: ubuntu 6 | vars: 7 | ansible_ssh_private_key_file: "~/.ssh/id_rsa_{{ ssh_key }}" 8 | ssh_key: weavedemo 9 | roles: 10 | - weavehaproxydemo 11 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/remove-instances.yml: -------------------------------------------------------------------------------- 1 | - hosts: launched 2 | gather_facts: True 3 | connection: local 4 | vars: 5 | - region: 'eu-west-1' 6 | tasks: 7 | - name: Gather EC2 facts 8 | local_action: ec2_facts 9 | 10 | - debug: var=hostvars[inventory_hostname] 11 | - debug: msg="{{ hostvars[inventory_hostname]['ansible_ec2_instance_id'] }}" 12 | 13 | # - name: Terminate instances 14 | #local_action: ec2 15 | # state='absent' 16 | ## instance_ids='{{ ec2_id }}' 17 | # region='{{ region }}' 18 | # wait=True 19 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/common/tasks/create_sshkey.yml: -------------------------------------------------------------------------------- 1 | - name: Create EC2 SSH Key 2 | ec2_key: 3 | name: "{{ ssh_key }}" 4 | region: "{{ aws_region }}" 5 | state: present 6 | register: ec2key 7 | tags: sshkey 8 | 9 | - local_action: copy content="{{ ec2key.key.private_key }}" dest="~/.ssh/id_rsa_{{ ssh_key }}" 10 | when: ec2key.changed 11 | tags: sshkey 12 | 13 | - file: path="~/.ssh/id_rsa_{{ ssh_key }}" mode=0600 14 | when: ec2key.changed 15 | tags: sshkey 16 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/common/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: create_sshkey.yml 3 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/dockerinstall/README.md: -------------------------------------------------------------------------------- 1 | # Docker Install for Ansible on Ubuntu 2 | 3 | This install is for a specific guide, and should not be used as a general 4 | guide to installing Docker on Ubuntu. There is an assumption you are running 5 | on a known version that supports the lxc-docker package. 6 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/dockerinstall/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for dockerinstall 3 | # 4 | docker_package: lxc-docker 5 | # 6 | # 7 | apt_repository_details: deb https://get.docker.com/ubuntu docker main 8 | # 9 | # 10 | apt_key_url: keyserver.ubuntu.com 11 | # 12 | # 13 | apt_key_id: 36A1D7869245C8950F966E92D8576A8BA88D21E9 14 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/dockerinstall/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Start Docker Service 3 | service: name=docker state=started 4 | 5 | - name: Restart Docker Service 6 | service: name=docker state=reloaded 7 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/dockerinstall/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # tasks file for dockerinstall 3 | 4 | - name: Update Ubuntu Image 5 | apt: update_cache=yes 6 | 7 | - name: Add Docker Repository 8 | apt_repository: 9 | repo: "{{ apt_repository_details }}" 10 | update_cache: yes 11 | state: present 12 | 13 | - name: Add Docker Repository Key 14 | apt_key: 15 | keyserver: "{{ apt_key_url }}" 16 | id: "{{ apt_key_id }}" 17 | state: present 18 | 19 | - name: Install Docker Package 20 | apt: 21 | name: "{{ docker_package }}" 22 | update_cache: yes 23 | state: latest 24 | 25 | - name: Launch Docker Service 26 | service: 27 | name: docker 28 | state: started 29 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/ubuntuinstall/tasks/create_inv.yml: -------------------------------------------------------------------------------- 1 | # Create inventory file 2 | 3 | - name: Create inventory file 4 | template: src=inventory.j2 dest=./inventory 5 | tags: inventory 6 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/ubuntuinstall/tasks/create_secgroup.yml: -------------------------------------------------------------------------------- 1 | # Create Weave security group 2 | # 3 | # The important part to note here is our opening of ports 6783 4 | # to udp and tcp traffic. 5 | # 6 | 7 | - name: Create Weave Security Group 8 | ec2_group: 9 | name: "{{ security_group_name }}" 10 | description: Weave security group 11 | region: "{{ aws_region }}" 12 | rules: 13 | - proto: tcp 14 | from_port: 22 15 | to_port: 22 16 | cidr_ip: 0.0.0.0/0 17 | - proto: tcp 18 | from_port: 80 19 | to_port: 80 20 | cidr_ip: 0.0.0.0/0 21 | - proto: icmp 22 | from_port: -1 23 | to_port: -1 24 | cidr_ip: 0.0.0.0/0 25 | - proto: tcp 26 | from_port: 6783 27 | to_port: 6783 28 | cidr_ip: 0.0.0.0/0 29 | - proto: udp 30 | from_port: 6783 31 | to_port: 6783 32 | cidr_ip: 0.0.0.0/0 33 | rules_egress: 34 | - proto: tcp 35 | from_port: 0 36 | to_port: 65535 37 | cidr_ip: 0.0.0.0/0 38 | - proto: udp 39 | from_port: 0 40 | to_port: 65535 41 | cidr_ip: 0.0.0.0/0 42 | - proto: icmp 43 | from_port: -1 44 | to_port: -1 45 | cidr_ip: 0.0.0.0/0 46 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/ubuntuinstall/tasks/create_vm.yml: -------------------------------------------------------------------------------- 1 | - name: Start Ubuntu Instances 2 | ec2: 3 | region: "{{ aws_region }}" 4 | image: "{{ template }}" 5 | instance_type: "{{ instance_type }}" 6 | key_name: "{{ ssh_key }}" 7 | group: "{{ security_group_name }}" 8 | wait: yes 9 | count: "{{ num_nodes }}" 10 | register: ec2 11 | 12 | - name: Add new instance to host group 13 | add_host: hostname={{ item.public_ip }} groupname=weave_ec2hosts 14 | with_items: ec2.instances 15 | 16 | - name: Wait for SSH to come up 17 | wait_for: host={{ item.public_dns_name }} port=22 delay=60 timeout=320 state=started 18 | with_items: ec2.instances 19 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/ubuntuinstall/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: create_secgroup.yml 3 | - include: create_vm.yml 4 | - include: create_inv.yml 5 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/ubuntuinstall/templates/inventory.j2: -------------------------------------------------------------------------------- 1 | [default] 2 | localhost ansible_python_interpreter=/usr/bin/python 3 | 4 | [launched] 5 | {% set count = 1 %} 6 | {% for item in ec2.instances %} 7 | {{ item.public_ip }} new_host=weave-gs-0{{ count }} 8 | {% set count = count + 1 %} 9 | {% endfor %} 10 | 11 | [launched:vars] 12 | public_ip={{ ec2.instances[0].public_ip }} 13 | 14 | [nodes:vars] 15 | ansible_ssh_user=ubuntu 16 | ansible_ssh_private_key_file=~/.ssh/id_rsa_{{ ssh_key }} 17 | ansible_python_interpreter="PATH=/home/core/bin:$PATH python" 18 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/weavehaproxydemo/files/haproxy.cfg: -------------------------------------------------------------------------------- 1 | global 2 | log 127.0.0.1 local0 3 | log 127.0.0.1 local1 notice 4 | chroot /var/lib/haproxy 5 | user haproxy 6 | group haproxy 7 | # daemon 8 | 9 | defaults 10 | log global 11 | mode http 12 | option httplog 13 | option dontlognull 14 | timeout connect 5000ms 15 | timeout client 50000ms 16 | timeout server 50000ms 17 | errorfile 400 /etc/haproxy/errors/400.http 18 | errorfile 403 /etc/haproxy/errors/403.http 19 | errorfile 408 /etc/haproxy/errors/408.http 20 | errorfile 500 /etc/haproxy/errors/500.http 21 | errorfile 502 /etc/haproxy/errors/502.http 22 | errorfile 503 /etc/haproxy/errors/503.http 23 | errorfile 504 /etc/haproxy/errors/504.http 24 | 25 | listen stats :1936 26 | stats enable 27 | stats uri /haproxy?stats 28 | 29 | frontend weavedemo 30 | bind *:80 31 | mode http 32 | default_backend weavedemo_backend 33 | 34 | backend weavedemo_backend 35 | mode http 36 | balance roundrobin 37 | option forwardfor 38 | http-request set-header X-Forwarded-Port %[dst_port] 39 | option httpchk HEAD / HTTP/1.1\r\nHost:localhost 40 | server ws1 10.3.1.1:80 check 41 | server ws2 10.3.1.2:80 check 42 | server ws3 10.3.1.3:80 check 43 | server ws4 10.3.1.4:80 check 44 | server ws5 10.3.1.5:80 check 45 | server ws6 10.3.1.6:80 check 46 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/weavehaproxydemo/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # tasks file for demo application run 3 | # 4 | # this is for the purposes of a demo app 5 | # 6 | - name: Launch Weave on weave-gs-01 7 | command: sudo weave launch 8 | when: new_host == "weave-gs-01" 9 | 10 | - name: Launch WeaveDNS on weave-gs-01 11 | command: sudo weave launch-dns 10.2.1.1/24 12 | when: new_host == "weave-gs-01" 13 | 14 | - name: Launch Weave on weave-gs-02 15 | command: sudo weave launch {{ public_ip }} 16 | when: new_host == "weave-gs-02" 17 | 18 | - name: Launch Weave on weave-gs-02 19 | command: sudo weave launch-dns 10.2.1.2/24 20 | when: new_host == "weave-gs-02" 21 | 22 | - name: Create HAProxy Config Directory 23 | file: path=/home/ubuntu/haproxy-override state=directory 24 | when: new_host == "weave-gs-01" 25 | 26 | - name: Copy haproxy configfile into place 27 | copy: src=../files/haproxy.cfg dest=/home/ubuntu/haproxy-override/haproxy.cfg 28 | when: new_host == "weave-gs-01" 29 | 30 | - name: Launch WS Container ws1 on weave-gs-01 31 | command: sudo weave run --with-dns 10.3.1.1/24 -h ws1.weave.local fintanr/weave-gs-haproxy-example 32 | when: new_host == "weave-gs-01" 33 | 34 | - name: Launch WS Container ws2 on weave-gs-01 35 | command: sudo weave run --with-dns 10.3.1.2/24 -h ws2.weave.local fintanr/weave-gs-haproxy-example 36 | when: new_host == "weave-gs-01" 37 | 38 | - name: Launch WS Container ws3 on weave-gs-01 39 | command: sudo weave run --with-dns 10.3.1.3/24 -h ws3.weave.local fintanr/weave-gs-haproxy-example 40 | when: new_host == "weave-gs-01" 41 | 42 | - name: Launch WS Container ws4 on weave-gs-02 43 | command: sudo weave run --with-dns 10.3.1.4/24 -h ws4.weave.local fintanr/weave-gs-haproxy-example 44 | when: new_host == "weave-gs-02" 45 | 46 | - name: Launch WS Container ws5 on weave-gs-02 47 | command: sudo weave run --with-dns 10.3.1.5/24 -h ws5.weave.local fintanr/weave-gs-haproxy-example 48 | when: new_host == "weave-gs-02" 49 | 50 | - name: Launch WS Container ws6 on weave-gs-02 51 | command: sudo weave run --with-dns 10.3.1.6/24 -h ws6.weave.local fintanr/weave-gs-haproxy-example 52 | when: new_host == "weave-gs-02" 53 | 54 | - name: Launch HAProxy Container hap1 on weave-gs-01 55 | command: sudo weave run --with-dns 10.3.1.7/24 -h hap1.weave.local -p 80:80 -v /home/ubuntu/haproxy-override:/haproxy-override dockerfile/haproxy 56 | when: new_host == "weave-gs-01" 57 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/weaveinstall/README.md: -------------------------------------------------------------------------------- 1 | # Weave Install With Ansible 2 | 3 | Install Weave with Ansible. 4 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/weaveinstall/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for weaveinstall 3 | # 4 | # weave_rul - url to pull weave from 5 | weave_url: https://github.com/weaveworks/weave/releases/download/latest_release/weave 6 | # 7 | # weave binary output 8 | weave_bin: /usr/local/bin/weave 9 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/roles/weaveinstall/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # tasks file for weaveinstall 3 | - name: Download and Install Weave 4 | get_url: url={{ weave_url }} dest={{weave_bin }} 5 | 6 | - name: Setup Weave Permissions 7 | file: path={{ weave_bin }} mode="u+rx,g+rx,o+rwx" 8 | 9 | - name: Download Weave Containers 10 | command: sudo weave setup 11 | -------------------------------------------------------------------------------- /weave-ansible-haproxy-aws/setup-weave-ubunu-aws.yml: -------------------------------------------------------------------------------- 1 | --- 2 | #- include_vars: ansible_aws_variables.yml 3 | 4 | - name: Weave on AWS with Ansible Setup 5 | hosts: localhost 6 | connection: local 7 | tags: provisioning 8 | vars_files: 9 | - ansible_aws_variables.yml 10 | vars: 11 | ssh_key: weavedemo 12 | num_nodes: 2 13 | security_group_name: weavedemo 14 | instance_type: m1.small 15 | 16 | roles: 17 | - common 18 | - ubuntuinstall 19 | 20 | tasks: 21 | - name: Add new instance to host group 22 | add_host: name="{{ item.public_ip }}" groupname=launched 23 | with_items: ec2.instances 24 | 25 | - name: Install Weave and Docker on Hosts 26 | tags: dockerinstall 27 | hosts: launched 28 | sudo: yes 29 | remote_user: ubuntu 30 | vars: 31 | ansible_ssh_private_key_file: "~/.ssh/id_rsa_{{ ssh_key }}" 32 | ssh_key: weavedemo 33 | roles: 34 | - dockerinstall 35 | - weaveinstall 36 | -------------------------------------------------------------------------------- /weave-loadbalance/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Basic Ubuntu and Docker setup Vagrantfile 2 | # 3 | # Weave Getting Started Guides 4 | # 5 | 6 | require 'fileutils' 7 | require 'ipaddr' 8 | 9 | Vagrant.require_version ">= 1.6.0" 10 | 11 | VAGRANTFILE_API_VERSION = "2" 12 | CONFIG = File.join(File.dirname(__FILE__), "config.rb") 13 | 14 | ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' 15 | 16 | # Defaults for config options defined in CONFIG 17 | # 18 | 19 | $num_instances = 2 20 | $instance_name_prefix = "weave-gs" 21 | $share_home = false 22 | $vm_gui = false 23 | $vm_memory = 512 24 | $vm_cpus = 1 25 | $vm_starting_ip = "172.17.8.100" 26 | 27 | if File.exist?(CONFIG) 28 | require CONFIG 29 | end 30 | 31 | $vm_ip = $vm_starting_ip 32 | 33 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 34 | config.vm.box = "ubuntu/trusty64" 35 | config.ssh.insert_key = true 36 | 37 | if Vagrant.has_plugin?("vagrant-cachier") 38 | config.cache.scope = :box 39 | end 40 | 41 | (1..$num_instances).each do |i| 42 | 43 | config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config| 44 | config.vm.hostname = vm_name 45 | if i == 1 46 | config.vm.network "forwarded_port", guest: 80, host: 8080 47 | config.vm.network "forwarded_port", guest: 4040, host: 4040 48 | end 49 | 50 | ip = IPAddr.new($vm_ip) 51 | $vm_ip = ip.succ.to_s 52 | config.vm.network "private_network", ip: $vm_ip 53 | end 54 | end 55 | 56 | config.vm.provider :virtualbox do |vb| 57 | vb.gui = $vm_gui 58 | vb.memory = $vm_memory 59 | vb.cpus = $vm_cpus 60 | end 61 | 62 | config.vm.provision "docker" do |d| 63 | d.pull_images "ubuntu" 64 | d.pull_images "docker" 65 | d.pull_images "weaveworks/myip-scratch" 66 | d.pull_images "weaveworks/weave-gs-ubuntu-curl" 67 | d.pull_images "weaveworks/weave" 68 | d.pull_images "gliderlabs/alpine:edge" 69 | d.pull_images "gliderlabs/alpine:latest" 70 | end 71 | 72 | config.vm.provision "shell", privileged: true, inline: <<-SHELL 73 | sudo curl -L git.io/weave -o /usr/local/bin/weave 74 | sudo chmod a+x /usr/local/bin/weave 75 | sudo wget -O /usr/local/bin/scope https://github.com/weaveworks/scope/releases/download/latest_release/scope 76 | sudo chmod a+x /usr/local/bin/scope 77 | SHELL 78 | end 79 | -------------------------------------------------------------------------------- /weave-loadbalance/example/src/myip/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | ADD ./myip / 3 | CMD ["/myip"] 4 | -------------------------------------------------------------------------------- /weave-loadbalance/example/src/myip/README.md: -------------------------------------------------------------------------------- 1 | # Very Basic REST Server to Display a Weave IP Address 2 | 3 | This is a very simple rest server, written in Go, to 4 | demonstrate IP addresses in containers. We build it as a static 5 | binary and use it in a from scratch docker container. 6 | 7 | We only look up the ip address of `ethwe` for the purposes of 8 | this example. 9 | 10 | ## Building 11 | 12 | 1. You will need to build this as a static binary: 13 | 14 | ```bash 15 | CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o myip 16 | ``` 17 | 2. Create your docker image and then run it in a container. -------------------------------------------------------------------------------- /weave-loadbalance/example/src/myip/myip.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "github.com/gorilla/mux" 7 | "log" 8 | "net" 9 | "net/http" 10 | ) 11 | 12 | func main() { 13 | 14 | router := mux.NewRouter().StrictSlash(true) 15 | router.HandleFunc("/", HelloWeave) 16 | router.HandleFunc("/myip", myIp) 17 | 18 | log.Fatal(http.ListenAndServe(":80", router)) 19 | } 20 | 21 | func HelloWeave(w http.ResponseWriter, r *http.Request) { 22 | fmt.Fprintln(w, "Welcome to Weave, you probably want /myip") 23 | } 24 | 25 | func myIp(w http.ResponseWriter, r *http.Request) { 26 | var theIps bytes.Buffer 27 | 28 | ief, _ := net.InterfaceByName("ethwe") 29 | addrs, _ := ief.Addrs() 30 | 31 | for _, a := range addrs { 32 | if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() { 33 | theIps.WriteString(ipnet.IP.String()) 34 | theIps.WriteString("\n") 35 | } 36 | } 37 | fmt.Fprintln(w, theIps.String()) 38 | } 39 | -------------------------------------------------------------------------------- /weave-loadbalance/launch-demo-containers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | vagrant ssh weave-gs-01 -c "eval \$(weave env); docker run -d -h loadbalance.weave.local weaveworks/myip-scratch" 4 | vagrant ssh weave-gs-01 -c "eval \$(weave env); docker run -d -h loadbalance.weave.local weaveworks/myip-scratch" 5 | vagrant ssh weave-gs-01 -c "eval \$(weave env); docker run -d -h loadbalance.weave.local weaveworks/myip-scratch" 6 | vagrant ssh weave-gs-02 -c "eval \$(weave env); docker run -d -h loadbalance.weave.local weaveworks/myip-scratch" 7 | vagrant ssh weave-gs-02 -c "eval \$(weave env); docker run -d -h loadbalance.weave.local weaveworks/myip-scratch" 8 | vagrant ssh weave-gs-02 -c "eval \$(weave env); docker run -d -h loadbalance.weave.local weaveworks/myip-scratch" 9 | -------------------------------------------------------------------------------- /weave-loadbalance/setup-weave.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | vagrant ssh weave-gs-01 -c "weave launch --ipalloc-range 10.2.0.1/16" 4 | vagrant ssh weave-gs-02 -c "weave launch --ipalloc-range 10.2.0.1/16 172.17.8.101" 5 | -------------------------------------------------------------------------------- /weave-scope-cloud-service/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: guides 3 | title: Visualizing Dockerized Microservices With Weave Cloud 4 | description: How to use Weave Cloud to monitor and visualize Docker containers. 5 | tags: weave scope, docker containers visibility, cluster, swarms 6 | permalink: /guides/weave-scope/weave-scope-cloud-service-monitor-containers.html 7 | --- 8 | 9 | **Note:** You are looking at our `old-guides` repository. The guides in here haven't been updated in a while. 10 | They might or might not work for you. We are keeping them around for informational purposes. 11 | 12 | --- 13 | 14 | Weave Scope automatically detects and monitors every host, container and process in your infrastructure, builds a map showing their inter-communications and then presents an up-to-date view in a web interface. You can visualize, monitor and control your distributed applications and troubleshoot bottlenecks, memory leaks or any other issues. It does this without requiring changes to your code or configuration, and without having to make declarations about your infrastructure that become out-of-date and stale. 15 | 16 | Weave Scope can be deployed to any infrastructure, and works well in all cloud and bare-metal environments. 17 | 18 | [Weave Cloud](http://cloud.weave.works) centrally manages and shares access to your Weave Scope user interface. With the cloud service, you run Weave Scope probes locally across your machines and then monitor the infrastructure from the Weaveworks website where the Weave Scope app feed is hosted. 19 | 20 | You can also launch Weave Scope in stand-alone mode, and run Weave Scope locally in your own environment. See, ["Monitoring Docker Containers with Weave Scope"](/monitor-docker-containers/) for more information and an example on how to use it. 21 | 22 | ## Signing Up With Weave Cloud 23 | 24 | To register with Weave Cloud, go to [https://cloud.weave.works](https://cloud.weave.works), and enter your email address. A confirmation email will be sent with further instructions. 25 | 26 | Login to Weave Cloud and click the settings icon in the top right hand corner to obtain the cloud service token: 27 | 28 | ![Weave Cloud](../images/weave-cloud-token.png) 29 | 30 | 31 | ## Running Weave Cloud 32 | 33 | Use the Weave Cloud service token to launch the Weave Cloud agents onto every machine that you want to monitor: 34 | 35 | ~~~bash 36 | +sudo wget -O /usr/local/bin/scope \ 37 | + https://github.com/weaveworks/scope/releases/download/latest_release/scope 38 | +sudo chmod a+x /usr/local/bin/scope 39 | sudo scope launch --service-token=<token> 40 | ~~~ 41 | 42 | ## Viewing Your Infrastructure Setup 43 | 44 | With Weave Scope probes deployed and the app launched, go to [https://cloud.weave.works](https://cloud.weave.works) to see an immediate overview of your containerized app displayed in your browser. 45 | 46 | Weave Scope presents all nodes in a particular order, and presents all clients above servers. As a general rule, you can read a Weave Scope view by going from top to bottom. 47 | 48 | **An Overview of the App:**![Weave Scope App Overview](../images/weave-scope/weave-scope-application-layers.png) 49 | 50 | A line between two nodes within the view represents a connection between containers. To help you understand the connections in your view, hover over a container or a connection to highlight all connected containers. This is especially useful for infrastructures that use a lot of containers. 51 | 52 | ## Viewing Metrics 53 | 54 | Metrics about a node are displayed by clicking on a node in the Weave Scope view. Basic metrics for the node will depend on the type, but generally will contain: the image and process names, sparklines showing memory consumption and performance, as well as any network metrics, like the number of TCP connections. 55 | 56 | >**Note:** In this view, you can Pause, Restart, and Stop containers, and for this reason, access to Weave Scope should be restricted to trusted individuals. 57 | 58 | ## Grouping By Containers or Hosts 59 | 60 | Weave Scope works great in topologies of any size, but if there are too many nodes in the view at once, you can use the grouping features to make the view simpler to understand. For example, in the containers view, click the `By Image` button to merge all the containers that are running the same container image together. 61 | 62 | **Grouped Container View:**![Weave Scope Grouped Container View](../images/weave-scope/weave-scope-group-containers.png) 63 | 64 | In our stack all instances get merged together into single nodes, even when they exist across hosts. The result is a logical, rather than physical, lens on the infrastructure — something that application developers intuitively understand. 65 | 66 | Grouping all instances and applications are great for application developers, but for those who have a more operations-oriented background, there is also the option to group `By HOST`. 67 | 68 | Click on `Applications` to show all the processes communicating in your network. This is the most granular view of Weave Scope. 69 | 70 | Weave Scope collects information in a very flexible data model, so that you can visualize all possible transformations within your network. 71 | 72 | **An Overview of all Processes:**![Weave Scope View Processes Communicating](../images/weave-scope/weave-scope-applications-view.png) 73 | 74 | ## Stopping Weave Scope 75 | 76 | To stop Weave Scope: 77 | 78 | ~~~bash 79 | sudo scope stop 80 | ~~~ 81 | 82 | ## Getting Help 83 | 84 | If you encounter any problems with this application or documentation or you would like to get in touch, contact us via [Help and Support](https://www.weave.works/help/). 85 | 86 | 87 | --------------------------------------------------------------------------------