jeesns项目上线(失败案例)

root
233
文章
0
评论
2020年2月19日21:33:32 评论 2766字阅读9分13秒

jeesns项目上线

jeesns是我在码云上找到的一个用java写的项目,https://gitee.com/zchuanzhao/jeesns

git下载地址:https://gitee.com/zchuanzhao/jeesns.git

EESNS是一款基于JAVA企业级平台研发的社交管理系统,依托企业级JAVA的高效、安全、稳定等优势,开创国内JAVA版开源SNS先河,数据库使用MYSQL

gitlab创建组-->项目-->用户    (略)

在gitlab服务器上操作:

使用这种方式部署本地仓库

Create a new repository
git clone git@192.168.5.7:jeesns/jeesns_data.git
cd jeesns_data
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

部署本地仓库

[root@web01 ~]# git clone git@192.168.5.7:jeesns/jeesns_data.git
Cloning into 'jeesns_data'...
warning: You appear to have cloned an empty repository.
[root@web01 ~]# cd jeesns_data/
[root@web01 jeesns_data]# git clone https://gitee.com/zchuanzhao/jeesns.git
Cloning into 'jeesns'...
remote: Enumerating objects: 14337, done.
remote: Counting objects: 100% (14337/14337), done.
remote: Compressing objects: 100% (9843/9843), done.
remote: Total 14337 (delta 6012), reused 6702 (delta 1909)
Receiving objects: 100% (14337/14337), 92.31 MiB | 6.64 MiB/s, done.
Resolving deltas: 100% (6012/6012), done.
[root@web01 jeesns_data]# ll
total 0
drwxr-xr-x 7 root root 153 Feb 19 15:22 jeesns
[root@web01 jeesns_data]# mv jeesns/* .
[root@web01 jeesns_data]# ll
total 24
drwxr-xr-x 3 root root   36 Feb 19 15:23 jeesns
drwxr-xr-x 2 root root   46 Feb 19 15:22 jeesns-core
drwxr-xr-x 3 root root   32 Feb 19 15:22 jeesns-service
drwxr-xr-x 4 root root   48 Feb 19 15:22 jeesns-web
-rw-r--r-- 1 root root 2530 Feb 19 15:22 LICENSE
-rw-r--r-- 1 root root 8735 Feb 19 15:22 pom.xml
-rw-r--r-- 1 root root 4595 Feb 19 15:22 README.md
drwxr-xr-x 2 root root   24 Feb 19 15:22 war

上传到gitlab服务器
[root@web01 jeesns_data]# git add .
[root@web01 jeesns_data]# git commit -m "add jeensn"
[root@web01 jeesns_data]# git push origin master 
Counting objects: 3090, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3018/3018), done.
Writing objects: 100% (3090/3090), 37.29 MiB | 4.20 MiB/s, done.
Total 3090 (delta 473), reused 0 (delta 0)
remote: Resolving deltas: 100% (473/473), done.
To git@192.168.5.7:jeesns/jeesns_data.git
* [new branch] master -> master

去gitlab服务器上查看一哈

在jenkins服务器上操作:

我直接贴配置吧,更加详细过程请参考Jenkins+Gitlab 实现代码自动化上线

这里可能有点问题,要使用jenkins用户,并且sudo提权不使用密码,s,详细请看Jenkins+Gitlab+Shell脚本 实现手动代码上线

都配置好保存就行了,记好触发器的两个信息,不要忘记了

shell脚本

脚本要写在jenkins服务器上不然找不到

#!/bin/bash
. /etc/profile
CODE_DIR=/var/lib/jenkins/workspace/jeesns
WEB_DIR=/code
WEB_HTML=html
TIME=`date +%F-%H-%M-%S`
IP=192.168.5.8
cd $CODE_DIR && tar zcf /tmp/web-${TIME}.tar.gz ./*
scp /tmp/web-${TIME}.tar.gz $IP:$WEB_DIR
ssh root@$IP "cd $WEB_DIR && mkdir web-$TIME"

ssh root@$IP "cd $WEB_DIR && tar xf web-${TIME}.tar.gz -C web-$TIME"
ssh root@$IP "cd $WEB_DIR && rm -rf $WEB_HTML web-${TIME}.tar.gz && ln -s web-$TIME $WEB_HTML"
rm -rf /tmp/web-*

gitlab页面上的操作

如果失败的话,上jenkins,在新建的项目里点一下立即构建就好了

检查下web服务器,站点目录是否关联好了

[root@web02 code]# ll
total 0
lrwxrwxrwx 1 root root 23 Feb 19 16:40 html -> web-2020-02-19-16-40-34
drwxr-xr-x 2 root root  6 Feb 19 16:40 web-2020-02-19-16-40-34

在看一下web页面

排查原因,jeesns是一个java项目,java项目想要上线必须使用maven的方式,我在jenkins创建项目的时候,没有使用maven,所以这个是一个失败的案例,本来想的删除,转头一想,留着挺好,不是java项目上线的话流程是一模一样的,留着波。

 

 

继续阅读
历史上的今天
2月
19
weinxin
我的微信
这是我的微信扫一扫
  • 文本由 发表于 2020年2月19日21:33:32
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
Jenkins的Pipeline项目 Devops

Jenkins的Pipeline项目

Pipeline项目 CI/CD持续集成/持续部署 持续集成是一种软件开发实践,团队开发成员经常集成它们的工作,通过每个成员每天至少集成一次,也就意味着每天可能发生多次集成。每次集成都通过自动化的构建...
jeesns项目代码部署and自动上线 Devops

jeesns项目代码部署and自动上线

jeesns项目代码自动上线 经过上一次失败的教训,这一次通过学习了maven项目管理工具,肯定能部署成功的。失败案例jeesns项目上线(失败案例),这对java项目的部署是一次很好的学习 Jenk...
maven工具,搭建私服nexus Devops

maven工具,搭建私服nexus

maven项目管理工具 Maven是一个项目管理的综合工具。Maven提供给开发人员构建一个完整的生命周期框架。 开发团队可以自动完成该项目的基础设施建设,Maven使用标准的目录结构和默认构建生命周...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: