How to run 2 wordpress blogs using docker on ec2 - dotcloud

I just started playing around with Docker.io. Its a great platform for sure. I have an issue i need some help with. I ran a medium instance on ec2 setup docker. Now i want to run 2 wordpress blog independent of each other using docker.io on top of the medium instance.
Please if someone can kindly guide me to resolve this issue i will extremely grateful
Many Thanks Indeed
Hareem Haque
Updated:
Basically, what i am trying to do is run two nodes for docker (node 1 & node 2). I run another node (node3: private repo for docker). What i am looking to accomplish is i run two blogs (wordpress on node1). I export the docker images to node3 (updates/exports are done very rarely)
Since i am going to run wordpress i was hoping to run wordpress within Nginx and since node1/node2 will run 80 web i can put a physical node (nginx reverse proxy) in front of the two nodes and have the blogs run in ha mode.
I am hoping that this experiment work so i that i can get rid of the xen cloud platform we have in office. Its to bulky and I have to manage alot of components.
I would rather export/backup docker image with my live data once in a blue moon and not have to worry about failover and vm management.
The problem is that i have a novice when it comes to running docker and thus i am currently running around like a head less chicken with no idea where to properly begin.
I would be extremely grateful if you can provide any guidance/assistance indeed.
Best Regards
Hareem Haque

Hareem asked his question a while back, and there don't seem to be any good answers yet. I'm a noobie as well, and I too want to learn how to use a generic wordpress container that I can push to Amazon or test locally. I'm very new to docker, so this seems like a tall order!
Goal
For now, I'll start collecting some resources here. Maybe they will help Hareem, and others like myself. This document will turn into a complete answer, or prompt someone else to give their version of an answer (which I'm sure is not quite so complex.)
The Docker.io Index
First, the Docker index is a repository of already existing Docker.io components. Of these, there is a wordpress unit that seems relevant here:
jbfink - Wordpress 3.5.2.
Docker on EC2
There is as yet no official Docker support for Ec2. However, the Docker community suggests an install path using a tool called Vagrant. The instructions for this live here:
Docker Doc - Installing on Amazon EC2
Work In Progress
This is not a complete answer to the question. As of right now this only presents a couple of easy to locate resources, and perhaps goes against guidelines. Please bear with this!
Things that need to be answered:
How do we run / test the wordpress container(s) locally?
How do we push the container(s) up to the EC2 instance?
How do we wire the EC2 wordpress containers up to their own domains?
Hopefully I will answer these questions - contributions and forks are welcome. I think Hareem's question is worth answering!

Related

Where I can learn the Kubernetes with Hands on

I am sorry if this question sounds silly.
I would like to know any place where I can learn the kubernetes simple to hard way where a beginner can get the whole idea of kubernetes, from scratch until you deploy an application to aws with other tools such as prometheus, stackstorm etc.
I know there are many Youtube videos and Udemy courses, but, I need a different source, maybe a Github Repository, or a Blog that teaches a newbie about Kubernetes from scratch to at least to the intermediate level with commands using minikube.
Thank you so much for your patience with me for a question like this but I really appreciate this. It is hard to find a good tutorial, videos are really boring or out of the scope sometimes.
If you are really want to do it all manually you should check Kubernetes The Hard Way. This tutorial does not have any automation process, you need to do all manually. Honestly I would recommend it after a few days/weeks of practicing with Kubernetes.
Second good place to learn Kubernetes is Katakoda. You can find there Kubernetes and Docker tutorials. If you want to learn Kubernetes you also need to learn something about containers before.
Another place is Kubernetes Tutorials. Also here you can find some Tasks or Concepts. The same site contains whole K8s documentation with real examples.
For environment to run Kubernetes I would advise you Minikube. It will create you one-node cluster. Before you will need instal Docker and Kubectl.
As for beginner I would suggest to use Minikube with --vm-driver=none.
Last source I wanted to mentioned is Medium. You will be able to find many tutorials for Kubernetes/Kubeadm/Minikube.
You can try katacoda .They have provide dummy kubernetes environment.
katacoda
.
Although kubernetes docs are enough to get to know about deployments,services,pods etc. You can try those example in katacoda environment. Kubernetes playground
Katacoda also have some examples .

Material on Building a REST api from within a docker container

I'm looking to build an api on a application that is going to run its own docker container. It needs to work with some applications via its REST apis. I'm new to development and dont understand the process very well. Can you share the broad steps necessary to build and release the APIs so that my application runs safely within the docker but externally whatever communication needs to happen they work out well.
For context: I'm going to be working on a Google Compute VM instance and the application I'm building is a HyperLedger Fabric program written in GoLang.
Links to reference material and code would also be appreciated.
REST API implementation is very easy in Go. You can use the inbuilt net/http package. Here's a tutorial which will help you understand its usage. https://tutorialedge.net/golang/creating-restful-api-with-golang/
Note : If you are planning on developing a production server, the default HTTP client is not recommended. It will knock down the server on heavy frequency calls. In that case, you have to use a custom HTTP client as described here, https://medium.com/#nate510/don-t-use-go-s-default-http-client-4804cb19f779
For learning docker I would recommend the docker docs they're very good and cover a handful of stuff. Docker swarm and orchestration are useful things to learn but most people aren't using docker swarm anymore and use things like kubernetes instead. Same principles, but different tech. I would definitely go through this website: https://docs.docker.com/ and implemented on your own computer. Then just practice by looking at other peoples dockerfiles and building your own. A good understanding a linux will definitely help with installing packages and so on.
I haven't used go myself but I suspect it shouldn't be too hard to deploy into a docker container.
The last production step of deployment will be similar for whatever your using if it's docker or no docker. The VM will need an webserver like apache or nginx to expose the ports you wish to use to the public and then you will run the docker container or the go server independently and then you'll have your system!
Hope this helps!

Deploying Kubernetes on bare metal rather than VM

Stupid question, but right now I'm deploying my Kubernetes cluster inside a VM. Is there a way to deploy it directly onto my machine?
I'm sure there has to be a easy fix but many of the docs I've read have been focused on deploying it inside VM.
I am assuming you are using some flavor of Linux; otherwise the information below won't be useful to you.
The easiest way of bare metal deployment ("onto your machine") is by using kubeadm. The documentation for that is excellent.
(If you need help with then reply with your exact OS flavor and version and I can edit this answer to reflect that specific situation.)

Learning to use Kuberentes on one single computer

I'm in the need of learning how to use Kubernetes. I've read the first sentences of a couple of introductory tutorials, and never have found one which explains me, step by step, how to build a simulated real world example on a single computer.
Is Kubernetes by nature so distributed that even the 101-level tutorials can only be performed on clusters?
Or can I learn (execute important examples) the important stuff there is to know by just using my Laptop without needing to use a stack of Raspberry Pi's, AWS or GCP?
The easiest might be minikube.
Minikube is a tool that makes it easy to run Kubernetes locally.
Minikube runs a single-node Kubernetes cluster inside a VM on your
laptop for users looking to try out Kubernetes or develop with it
day-to-day.
For a resource that explains how to use this, try this getting started guide. It runs through an entire example application using a local development environment.
If you are okay with using Google Cloud Platform (I think one gets free credits initially), there is hello-node.
If you want to run the latest and greatest (not necessary stable) and you're using Linux, is also possible to spin up a local cluster on Linux from a cloned copy of the kubernetes sources, using hack/local_up_cluster.sh.

Docker deployment options

I'm wondering which options are there for docker container deployment in production. Given I have separate APP and DB server containers and data-only containers holding deployables and other holding database files.
I just have one server for now, which I would like to "docker enable", but what is the best way to deploy there(remotely will be the best option)
I just want to hit a button and some tool will take care of stopping, starting, exchanging all needed docker containers.
There is myriad of tools(Fleet, Flocker, Docker Compose etc.), I'm overwhelmed by the choices.
Only thing I'm clear is, I don't want to build images with codes from git repo. I would like to have docker images as wrappers for my releases. Have I grasped the docker ideas from wrong end?
My team recently built a Docker continuous deployment system and I thought I'd share it here since you seem to have the same questions we had. It pretty much does what you asked:
"hit a button and some tool will take care of stopping, starting, exchanging all needed docker containers"
We had the challenge that our Docker deployment scripts were getting too complex. Our containers depend on each other in various ways to make the full system so when we deployed, we'd often have dependency issues crop up.
We built a system called "Skopos" to resolve these issues. Skopos detects the current state of your running system and detects any changes being made and then automatically plans out and deploys the update into production. It creates deployment plans dynamically for each deployment based on a comparison of current state and desired state.
It can help you continuously deploy your application or service to production using tags in your repository to automatically roll out the right version to the right platform while removing the need for manual procedures or scripts.
It's free, check it out: http://datagridsys.com/getstarted/
You can import your system in 3 ways:
1. if you have a Docker Compose, we can suck that in and start working iwth it.
2. If your app is running, we can scan it and then start working with it.
3. If you have neither, you can create a quick descriptor file in YAML and then we can understand your current state.
I think most people start their container journey using tools from Docker Toolbox. Those tools provide a good start and work as promised, but you'll end up wanting more. With these tools, you are missing for example integrated overlay networking, DNS, load balancing, aggregated logging, VPN access and private image repository which are crucial for most container workloads.
To solve these problems we started to develop Kontena - Docker Container Orchestration Platform. While Kontena works great for all types of businesses and may be used to run containerized workloads at any scale, it's best suited for start-ups and small to medium sized business who require worry-free and simple to use platform to run containerized workloads.
Kontena is an open source project and you can view it on GitHub.