I want to automate the process of build then deploy (some nodejs application) to production server with jenkins. Right now my company using svn to deploy code production server, that is commit code to svn then log in production server via ssh and run svn up.
I don't think I can automate the deploy stage with svn, so I want to seek another way to deploy code to production server that is also easy to automate with jenkins.
Thanks
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (9)
That depends on what you want to deploy.
There are dozens of tools that can do the job better than jenkins.
Jenkins should be used to build the artifact and put it to storage.
Letting Jenkins deploy stuff is a security flaw, since everyone with access to create Job-Items can easily get any credential they want from a badly secured Jenkins instance. Most people don't invest the time to secure Jenkins enough to make it a safe deployment-tool.
Ansible, Puppet, Chef, and other configuration management tools can easily take care of deployment for you.
What is it you want to deploy?
I see.
I want to deploy nodejs app. It in typescript I use jenkin to compile it to javascript then deploy
Thanks
I'm not that familiar with JavaScript development, but this could do it for you:
This is done via the SSH-Publisher Plugin. Though I still do not recommend deploying via Jenkins, since the SSH and SCP Publisher Plugins are very old (2 and 10 years respectively) and may contain vulnerabilities.
Another approach would be this, which is marginally better, if your target-server supports it. This approach again, is not really recommendable either, since it requires NPM to be on a production machine, which is a bad idea tbh.
What I instead would recommend is, let Ansible or other tools take care of it.
Push your built code to a git repo and let ansible pull the production code. That way you don't need a compiler/interpreter on your prod machine. This could also be automated via jenkins easily, since it has ansible plugins that could run your playbooks after the production code is committed to git.
I love jenkins, but it's not the best tool for everything, unfortunately :D
I see, I new to jenkins so I don't know, Now this is something I need to think hard about. Thank you
No worries, Jenkins is a powerful tool for many use-cases and languages.
If you need advice, feel free to hit me up or answer in another comment, I've been doing continuous delivery for a few years now and got a little bit of experience with it :D
Jenkins can definitely log into a remote server using ssh.
I am not sure I understand the question completely...
It seem like I quickly jump to conclusion :) . My point is that I want to know what other ways than using svn to deploy code. It just that I want to know more so that I can choose the one that more fit in my workplace. Thanks
It really depends on your environment and what you are doing and how. In my opinion in standard environments the first step is to contenerize the application during CI/CD.
You commit / release a tag and automatically you get a container. You run the unittest inside the container and the integration test against the container. If everything is green you deploy the new container.
But this is only one approach, whatever you decide to do, is important to make sure it works well also with the cloud provider you are using.
Without more information is hard to help...
Thanks. I will rethink every thing again to be more clear :)