How I Automated Linux Application Deployment on the Knee Using Bash Scripts and Java

Once you've written your server application, you need to deploy it somewhere. In our company, this is now implemented using a VPS on Linux, bash scripts, and a small Java program. This is an evolutionary process, and as for me, it turned out pretty well.



In the article I want to describe the evolution of this approach, why it happened, the pros and cons of the approach. If you have a similar problem, read it, perhaps useful thoughts will come to mind.



KDPV - system architecture, for a part of which we automate the deployment:





A bit of background



I am currently the head of the development department at the company where I work. We have a small but balanced team - there is a backend, front-end developers, QA, a designer, a layout designer.



Our company is engaged in educational activities in IT, and we write software for ourselves. This imposes certain restrictions - we do not have huge development budgets, there are vague requirements, because it is not completely clear what people need.



At the same time, there are pluses - we write on what we want, and we can set and agree on the development timeline ourselves. Also, since we are not sawing a hundred thousand landing page or an online store, it is interesting to work. We develop several products, collect user feedback, and fix / add features.



, , .





:





— . ( ). , -.



, . :



  • . , , ;
  • , . , — .
  • . java, node.js, python.


— , ( markdown ). .



, , . . .



Level 1



. SSH VPS, git, mvn build, npm i, java -jar .



, . — .



Level 2



- , . ..



, gihub SSH VPS. git pull, . , .



Level 3



. , .



, bash . :



  • git pull,
  • mvn package — fatjar ( Java)
  • pkill yourserverprocessname —
  • java -jar yourfatjar.jar


VPS, cd ~/git/repository_name, — ./deploy.sh



Level 4



, ?



, VPS. - . C — . , — . C , , , , .



, Java. . HttpServer. GET POST , token, — bash .



.



VPS . . — , .



— - , URL, bash , .



Level 5



.



github, webhook . , (push, etc) — github URL. — POST .



webhook push. URL, .



, git push, .



Level 6 (bonus)



, . . , node.js .



, .



, . UptimeRobot. :



  • — ( POST/GET , ..).


! , — , URL . , .



- . , UptimeRobot . , - , .



— . Spring Boot , UptimeRobot, . , — / , .



, , :



image



, .





— . bash .



, , . , .





— .



, push github ?



, push, ?



, . , . , .



CI/CD . , — production.



, , MVP. , , . , , — . , .



?



, . Java, Maven , , jar. , — .



bash , ( .jar mvn package) . - node.js — , .



github , (, , ).



CI/CD , Jenkins, Gitlab, Ansible. , .



, — . , - , . , — , .





, . , . , , , . , .



Time and financial constraints must be taken into account. Consider the specifics of each developer. Now I read a lot of thematic literature, from the last books I read in a month - "How to graze cats", "Me, nerds and geeks", "Programmatic programmer", "A novel about project management".



This is an interesting and new path for me. I go through it, describing my progress in my Telegram channel - Programmer and business .



I am writing about business from a developer's point of view. There I post short notes that do not fit the Habr in format.




All Articles