Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加github action自动打包 #16

Closed
wants to merge 4 commits into from
Closed

Conversation

huoxue1
Copy link

@huoxue1 huoxue1 commented Jan 17, 2023

修改了gorm和sqlite驱动的版本,用于交叉编译
添加了release.yml的action配置文件

@huoxue1
Copy link
Author

huoxue1 commented Jan 17, 2023

效果参考
设备多的可以帮忙测试下不同平台有没有问题

@huoxue1
Copy link
Author

huoxue1 commented Jan 17, 2023

#12

@apptut
Copy link
Contributor

apptut commented Jan 18, 2023

@huoxue1 测试了你的master打包的rpm,貌似现在:pmon2和pmond被打成了两个分开的rpm包,不合适。经测试无法运行。需要调整:

  1. 需要分操作系统,centos6和7启动配置不一样,需要系统做rpm包
  2. rpm还需要其他配置,以及安装操作步骤。

需要包含的内容:

centos7、8、deb

pmon2.rpm/
- bin/pmon2
- bin/pmond
- service/centos7/pmon2.service
- logroate/pmon2
- auto-complete/bash/pmon2.sh
- config/config.yml

rpm 安装sepce步骤里参考:

%{__mkdir} -p $RPM_BUILD_ROOT/etc/pmon2/config
%{__mkdir} -p $RPM_BUILD_ROOT/usr/local/pmon2/bin
%{__mkdir} -p $RPM_BUILD_ROOT/usr/bin
%{__mkdir} -p $RPM_BUILD_ROOT/etc/logrotate.d/

%{__cp} -r -p %{bdir}/config/config.yml $RPM_BUILD_ROOT/etc/pmon2/config/

# install bash auto completion
%{__install} -D -m 0644 %{bdir}/auto-complete/bash/pmon2.sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/pmon2.sh

%{__install} -D -m 0755 pmon2 $RPM_BUILD_ROOT/usr/local/pmon2/bin/pmon2
%{__install} -D -m 0755 pmond $RPM_BUILD_ROOT/usr/local/pmon2/bin/pmond

%{__install} -D -m 0644 %{bdir}/service/centos6/pmon2.conf $RPM_BUILD_ROOT/usr/local/pmon2/service/centos6/pmon2.conf
%{__install} -D -m 0644 %{bdir}/service/centos7/pmon2.service $RPM_BUILD_ROOT/usr/local/pmon2/service/centos7/pmon2.service

# soft link pmon2 cli
ln -sf /usr/local/pmon2/bin/pmon2 $RPM_BUILD_ROOT/usr/bin/pmon2

# logrotate
%{__install} -D -m 0644 %{bdir}/logrotate/pmon2 $RPM_BUILD_ROOT/etc/logrotate.d/

上述大致的意思是,需要把rmp包的配置文件、二进制安装到系统指定目录,这部分在制作rmp的步骤里需要添加。

centos6

pmon2.rpm/
- bin/pmon2
- bin/pmond
- service/centos7/pmon2.service
- logroate/pmon2
- auto-complete/bash/pmon2.sh
- config/config.yml

另外,针对centos6、7,需要配置不同的启动服务,原因是,centos6 不支持 systemd 服务,需要单独适配。参考如下:

if [ ".el6" == "%{?dist}" ]; then
    # CentOS6
    # remove old version name
    rm -f /etc/init/pmond.conf

    %{__mkdir} -p /etc/init
    %{__install} -D -m 0644 /usr/local/pmon2/service/centos6/pmon2.conf /etc/init/
else
    # CentOS7、CentOS8
    # remove old version name
    systemctl disable pmond
    rm -f /usr/lib/systemd/system/pmond.service

    %{__mkdir} -p /usr/lib/systemd/system
    %{__install} -D -m 0644 /usr/local/pmon2/service/centos7/pmon2.service /usr/lib/systemd/system/
    systemctl enable pmon2
fi

所以这也是为什么,Pmon2 不直接提供二进制包的原因,它涉及需要多个二进制文件,配置文件安装所致。

@huoxue1
Copy link
Author

huoxue1 commented Jan 18, 2023

我测试了一下centos7的rpm包应该没啥问题了
https://github.com/huoxue1/pmon2/releases/tag/v1.12.2
image

@huoxue1
Copy link
Author

huoxue1 commented Jan 19, 2023

测试了一下deb,应该也没啥大问题
image


image

@huoxue1 huoxue1 closed this May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants