How to continuously deploy Gitlab? - gitlab

I'm forking the Gitlab CE source code to make a few small changes, and want to set up continuous deployment on my forked project to deploy to the cloud (could be an Ubuntu server in the cloud). Could you share some suggestions about how to set up this CD?

Have you considered using GitLab GDK? https://gitlab.com/gitlab-org/gitlab-development-kit It's very simple to install and easy to contribute. It is very well documented here

Related

Deploy a web application onto a Windows server using GitLab

We are running a GitLab with CI and want to deploy our application onto a Windows server. This will be just a demo system so we are quite open how we run the app later.
Currently we build and test the application. Now we need to stop the old app at the server, bring the new build onto server and start the new app.
I want to use at best the tools from GitLab but this isn't a must and as you can assume I am not so used to GitLab Deploy stuff.
Docker would be also an option.
Do you have some ideas?
Thank you
Nico
If you aren’t precious about the actual deployment of your web app then the easiest thing to do would just be install a gitlab runner on your test windows host. You should use a shell runner, so it can operate as a “fake user”. You’ll also need to ensure the user the runner is installed as has the right creds to install your app.
Tag this runner so it will run for a particular job, then within your gitlab ci you can take a copy of your build as an artifact (see gitlab ci artifacts).
Artifacts are automatically copied between runners so long as they are within the same pipeline run so you will have accsess to your built web app and can then install it how you like.

configure gitlab to build the source code on another machine

We have two servers in our organisation.
1) server with gitlab
2) Build server
I would like to create an automate build happen in the second machine(Build server ) for the source code in the gitlab server.
How can I achieve this using gitlab ?
Thanks,
siva
If you are moving from an "pull" continuous integration system (e.g. using a kind of crontab that regularly checks if the source code on the versioning system has changed and start the configure/build/test/deploy stages if it has), then know that gitlab has a much better way of doing this.
gitlab approach is to configure a "pull" system: every time the code is updated (in any branch) on the git repository then the script defined in your .gitlab-ci.yml is read to see if continuous integration jobs have to be launched. jobs are send to your configured gitlab runners. gitlab runners are defined on your build server(s) and takes the job when they are coming.
Definition of what to do is also describes in the .gitlab-ci.yml.
Here is a list of documentation to start learning about gitlab CI:
the official documentation can be helpful
A general introduction to gitlab ci using docker can be found in this blog article (the first slides are great). If your build server or your intended build is on Linux, I would recommend using the "docker executor" (e.g. gitlab runners are executed inside a docker machine inside your build server). It is easy and quick to setup.
Hope this helps you starting...

Auto trigger server deploy and build on git push

I'am looking for a simple and straightforward way to deploy a node application from the repo service (bitbucket or gitlab) to a separate server/vps.
I want to proceed so that a push to the repo would trigger a deploy on the server (one for a staging environment and one for production) When initially looking into this I get uncertain on what would be best, easiest, most efficient, best practice and so on. What tools should I pick, a gitlab runner or is it possible with pm2, some webhook or some other node npm service that could be installed on the vps for this? Any suggestions or links to further info would be appreciated.
I would suggest you trying CI/CD tool like Jenkins, but I needs to be run separately.
You can set cron at Jenkins to check repo changes, it's the easiest way. Better way would be using webhooks like Bitbucket Webhook Jenkins addon. Here is setup guide for Gitlab.
Jenkins installation guide

How to deploy Go program from windows to CentOS server

I have a Go package running on Windows and is working fine but now I'm at a stage where I would like to test this on production CentOS 6.5 server.
What is the best practice to deploy this from Windows to CentOS?
Would I have to use my Git repo to distribute to Linux operating system, compile then deploy the binary to the server?
Also I have multiple files, so I would imagine go build *.go would suffice or are there better options for doing compilation?
What is the best practice to deploy this from Windows to CentOS?
As far as best practices go I would recommend using continuous integration. You can setup jenkins, or there are some cloud options out there: codeship.io, travis-ci.org, drone.io, wercker.com, ... Some of them have free plans available.
Basically you'd commit your code to git and push that out to Github (or Bitbucket if you want free private repos). The continuous integration server will be notified whenever you push out changes, and will build, test and create a release tar archive of your project. You can then take this resulting tar and download it to your CentOS box. In 6.5 you'll need to create an init.d script to keep your program up and running. You can see an example here (the system v script).
CentoOS 7 uses systemd now which would be slightly easier to setup.
Taking this one step further it's also possible to setup continuos deployment, in which the download, extraction and installation can also be automated. Depending on your project it may or may not make sense to set up continuous deployment. (Auto-pushing to production might be a little too automatic) You can find an example in wercker here.
Although there is an an up-front cost to setting up continuous integration if this is a project that other people will contribute too, or one that you intend to work on long-term, the cost will definitely be worth it. (Future you will be greatful when you come back to this project 6 months from now, change 1 line of code, and don't have to remember all the manual steps it took to deploy)

Deployment after CI builds

Im pretty new to CI so bear with me here. I have just setup an instance of Team City in on a local machine, and I can clearly see the benefits.
The one thing we do want understand is how we can managed the deployment aspect of CI. What we really want to achieve are two builds:
1) We check in to our source repository and the CI server notices the change and compiles the code, tests etc.
2) We manually trigger a build that compiles the code, copies the code to a remote server and update its IIS mappings.
Now the first build is pretty much wrapped up with TeamCity. But I assume that the deployment aspect of this is going to involve some scripting (Nant, MsBuild, Rake etc) is this correct?
If this is the case, I can see that transferring files from the build machine to a remote server will be ok, but will we be able to update IIS mappings without being on the same network? For that matter where is THE correct place to deploy a CI server, should is live on the same network as the apps we deploy?
Finally, we have been (rather unorthadoxily) using IronRuby to run rake scripts as our build runner. This is simply because we like Rake, but if we were to look at Nant/Msbuild do they have any baked in tasks that would simplify what we are trying to achieve?
Cheers, Chris.
We use MSBuild exclusively, just a choice. I am sure Nant and the others do things just as well. We only publish to a dev environment (for dev testing) and a stage environment (Where QA actually tests). I would not suggest that you put the production system push on this as the temptation to force builds might be too great for some people.
We use some of the MSBuild Community Tasks

Resources