Name: container-service-gitlab-sample
Owner: International Business Machines
Description: This project shows how a common multi-component application can be deployed on the Bluemix container service. Each component runs in a separate container or group of containers.
Created: 2017-03-01 19:12:57.0
Updated: 2017-08-30 13:39:31.0
Pushed: 2017-03-27 18:43:49.0
Size: 624
Language: Shell
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This project shows how a common multi-component application can be deployed on the Bluemix container service. Each component runs in a separate container or group of containers.
Gitlab represents a typical multi-tier app and each component will have their own container(s). The microservice containers will be for the web tier, the state/job database with Redis and PostgreSQL as the database.
Install CloudFoundry CLI for your OS from GitHub. Once the CloudFoundry CLI has been installed you can install the Bluemix Container Service Cloud Foundry plug-in.
nstall-plugin https://static-ice.ng.bluemix.net/ibm-containers-linux_x64
Once the plugin is installed you can log into the Bluemix Container Service. First, you must log into Bluemix through the CloudFoundry CLI.
ogin -a https://api.ng.bluemix.net
If this is the first time using the container service you must initialize the plugin and set a namespace which identifies your private Bluemix images registry. It can be between 4 and 30 characters.
c init
c namespace set <namespace>
Then you must log into the Bluemix Container Service.
c login
Verify that it works.
c images
This should return a list of images from the default Bluemix registry.
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.ng.bluemix.net/ibmnode v1.2 640ed14065df 5 weeks ago 188 MB
registry.ng.bluemix.net/ibmliberty microProfile 50854bcc98c3 2 months ago 237 MB
registry.ng.bluemix.net/ibm-backup-restore latest 4b5d9037c97a 5 weeks ago 208 MB
registry.ng.bluemix.net/ibmliberty javaee7 96285b81d9df 2 months ago 314 MB
registry.ng.bluemix.net/ibmliberty latest 96285b81d9df 2 months ago 314 MB
registry.ng.bluemix.net/ibm-websphere-extreme-scale latest f98d12aad014 8 days ago 466 MB
registry.ng.bluemix.net/ibm-node-strong-pm latest 3fc4ae24eb0e 4 weeks ago 259 MB
registry.ng.bluemix.net/ibmnode v1.1 fd4d70c5451b 5 weeks ago 181 MB
registry.ng.bluemix.net/ibm-integration-bus latest ec198557875c 5 weeks ago 683 MB
registry.ng.bluemix.net/ibmnode latest acec21732cb5 5 weeks ago 192 MB
registry.ng.bluemix.net/ibmnode v4 acec21732cb5 5 weeks ago 192 MB
registry.ng.bluemix.net/ibm-mq latest 9b6ae7557a34 8 days ago 771 MB
registry.ng.bluemix.net/ibm_wa_agent latest 3d38f3e80fd7 2 weeks ago 435 MB
registry.ng.bluemix.net/ibmliberty webProfile6 211f521035a2 2 months ago 268 MB
registry.ng.bluemix.net/ibmliberty webProfile7 6b2b8341fa32 2 months ago 276 MB
Build the PostgreSQL container.
ontainers/postgresql
c build -t registry.ng.bluemix.net/<namespace>/gitlab-postgres .
Build the Gitlab container.
ontainers/gitlab
c build -t registry.ng.bluemix.net/<namespace>/gitlab .
The redis container from Docker Hub can be used without modification so it just needs to be imported.
c cpi redis:alpine registry.ng.bluemix.net/<namespace>/redis
Before the containers can run volumes must be created.
c volume create postgresql
c volume create redis
c volume create gitlab
Containers can now be deployed with the provided docker-compose file. In order to use docker-compose you MUST override the local Docker environment as described in “Option 2” when logging into the Bluemix container service.
If you do not already have docker-compose installed:
-L "https://github.com/docker/compose/releases/download/1.11.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose ; chmod +x /usr/local/bin/docker-compose
ash
the toplevel repo directory)
SPACE=<namespace> docker-compose up -d
Or manually.
c run -d --name pgsql --volume postgresql:/var/lib/postgresql registry.ng.bluemix.net/<namespace>/gitlab-postgresql
c run -d --name redis --volume redis:/var/lib/redis registry.ng.bluemix.net/<namespace>/redis
c run -d --volume gitlab:/home/git/data --link pgsql:postgresql --link redis:redis --publish 10022:22 --publish 10080:80 gitlab
Now a public IP can be bound to the Gitlab container.
c ip request
c ip list
c ip bind <unbound IP from above> <gitlab container ID>
Verify everything is running by visiting
Now that Gitlab is running you can register as a new user and create a project.
After logging in as your newly-created user you can create a new project.
Once a project has been created you'll be asked to add an SSH key for your user.
To verify that your key is working correctly run:
-T git@<IP>
Which should result in:
ome to GitLab, <user>!
Now you can clone your project.
clone <project URL>
Add a file and commit:
"Gitlab project" > README.md
add README.md
commit -a -m "Initial commit"
You can now see it in the Gitlab UI.
If a container doesn't start examine the logs.
c ps
c logs -t <container ID>