text stringlengths 0 59.1k |
|---|
The `.dockerignore` file should contain the below lines. This tells |
Docker to ignore the files on those directories when it's building |
your container. |
``` |
.meteor/local |
packages/*/.build* |
``` |
You can see an example meteor project already set up at: |
[meteor-gke-example](https://github.com/Q42/meteor-gke-example). Feel |
free to use this app for this example. |
> Note: The next step will not work if you have added mobile platforms |
> to your meteor project. Check with `meteor list-platforms` |
Now you can build your container by running this in |
your Meteor project directory: |
``` |
docker build -t my-meteor . |
``` |
Pushing to a registry |
--------------------- |
For the [Docker Hub](https://hub.docker.com/), tag your app image with |
your username and push to the Hub with the below commands. Replace |
`<username>` with your Hub username. |
``` |
docker tag my-meteor <username>/my-meteor |
docker push <username>/my-meteor |
``` |
For [Google Container |
Registry](https://cloud.google.com/tools/container-registry/), tag |
your app image with your project ID, and push to GCR. Replace |
`<project>` with your project ID. |
``` |
docker tag my-meteor gcr.io/<project>/my-meteor |
gcloud docker -- push gcr.io/<project>/my-meteor |
``` |
Running |
------- |
Now that you have containerized your Meteor app it's time to set up |
your cluster. Edit [`meteor-controller.json`](meteor-controller.json) |
and make sure the `image:` points to the container you just pushed to |
the Docker Hub or GCR. |
We will need to provide MongoDB a persistent Kubernetes volume to |
store its data. See the [volumes documentation](https://kubernetes.io/docs/user-guide/volumes.md) for |
options. We're going to use Google Compute Engine persistent |
disks. Create the MongoDB disk by running: |
``` |
gcloud compute disks create --size=200GB mongo-disk |
``` |
Now you can start Mongo using that disk: |
``` |
kubectl create -f examples/staging/meteor/mongo-pod.json |
kubectl create -f examples/staging/meteor/mongo-service.json |
``` |
Wait until Mongo is started completely and then start up your Meteor app: |
``` |
kubectl create -f examples/staging/meteor/meteor-service.json |
kubectl create -f examples/staging/meteor/meteor-controller.json |
``` |
Note that [`meteor-service.json`](meteor-service.json) creates a load balancer, so |
your app should be available through the IP of that load balancer once |
the Meteor pods are started. We also created the service before creating the rc to |
aid the scheduler in placing pods, as the scheduler ranks pod placement according to |
service anti-affinity (among other things). You can find the IP of your load balancer |
by running: |
``` |
kubectl get service meteor --template="{{range .status.loadBalancer.ingress}} {{.ip}} {{end}}" |
``` |
You will have to open up port 80 if it's not open yet in your |
environment. On Google Compute Engine, you may run the below command. |
``` |
gcloud compute firewall-rules create meteor-80 --allow=tcp:80 --target-tags kubernetes-node |
``` |
What is going on? |
----------------- |
Firstly, the `FROM chees/meteor-kubernetes` line in your `Dockerfile` |
specifies the base image for your Meteor app. The code for that image |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.