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

Do example as standalone package for RPM #374

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ repo-rpm
apt-rpm/builddir
/apt-rpm/*documentserver*.spec
rpm/builddir
common/documentserver*/**/*.conf
common/documentserver/**/*.conf
common/documentserver-example/**/includes/*.conf
common/documentserver*/nginx/*.tmpl
/common/documentserver/bin/*.sh
common/documentserver/config
Expand Down
86 changes: 81 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,23 @@ endif

APT_RPM_BUILD_DIR = $(PWD)/apt-rpm/builddir
RPM_BUILD_DIR = $(PWD)/rpm/builddir
RPM_CORE_BUILD_DIR = $(PWD)/rpm-core/builddir
RPM_EXAMPLE_BUILD_DIR = $(PWD)/rpm-example/builddir
EXE_BUILD_DIR = exe

APT_RPM_PACKAGE_DIR = $(APT_RPM_BUILD_DIR)/RPMS/$(RPM_ARCH)
RPM_PACKAGE_DIR = $(RPM_BUILD_DIR)/RPMS/$(RPM_ARCH)
RPM_CORE_PACKAGE_DIR = $(RPM_CORE_BUILD_DIR)/RPMS/$(RPM_ARCH)
RPM_EXAMPLE_PACKAGE_DIR = $(RPM_EXAMPLE_BUILD_DIR)/RPMS/$(RPM_ARCH)
TAR_PACKAGE_DIR = $(PWD)

APT_RPM = $(APT_RPM_PACKAGE_DIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(APT_RPM_RELEASE_SUFFIX).$(RPM_ARCH).rpm
RPM = $(RPM_PACKAGE_DIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(RPM_RELEASE_SUFFIX).$(RPM_ARCH).rpm
DEB = deb/$(PACKAGE_NAME)_$(PACKAGE_VERSION)_$(DEB_ARCH)$(DEB_RELEASE_SUFFIX).deb
EXE = $(EXE_BUILD_DIR)/$(COMPANY_NAME)-$(PRODUCT_NAME)-$(PRODUCT_VERSION).$(BUILD_NUMBER)-x64.exe
TAR = $(TAR_PACKAGE_DIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(TAR_RELEASE_SUFFIX)-$(TAR_ARCH).tar.gz
RPM_CORE = $(RPM_CORE_PACKAGE_DIR)/$(PACKAGE_NAME)-core-$(PACKAGE_VERSION)$(RPM_RELEASE:%=.%).$(RPM_ARCH).rpm
RPM_EXAMPLE = $(RPM_EXAMPLE_PACKAGE_DIR)/$(PACKAGE_NAME)-example-$(PACKAGE_VERSION)$(RPM_RELEASE:%=.%).$(RPM_ARCH).rpm

PACKAGE_SERVICES ?= ds-docservice ds-converter ds-metrics

Expand Down Expand Up @@ -134,7 +140,7 @@ else
SHELL_EXT := .sh
ARCH_EXT := .zip
AR := 7z a -y
PACKAGES = deb rpm tar apt-rpm
PACKAGES = deb rpm rpm-core rpm-example tar apt-rpm
DS_PREFIX := $(COMPANY_NAME_LOW)/$(PRODUCT_SHORT_NAME_LOW)
NGINX_CONF := /etc/nginx/includes
NGINX_LOG := /var/log/$(DS_PREFIX)
Expand Down Expand Up @@ -233,15 +239,29 @@ LINUX_DEPS_CLEAN += common/documentserver/bin/*.sh
LINUX_DEPS += rpm/$(PACKAGE_NAME).spec
LINUX_DEPS += apt-rpm/$(PACKAGE_NAME).spec

LINUX_CORE_DEPS += rpm-core/$(PACKAGE_NAME)-core.spec

LINUX_EXAMPLE_DEPS += rpm-example/$(PACKAGE_NAME)-example.spec

LINUX_DEPS_CLEAN += rpm/$(PACKAGE_NAME).spec
LINUX_DEPS_CLEAN += apt-rpm/$(PACKAGE_NAME).spec

LINUX_DEPS += rpm/bin/documentserver-configure.sh
LINUX_CORE_DEPS_CLEAN += rpm-core/$(PACKAGE_NAME)-core.spec

LINUX_EXAMPLE_DEPS_CLEAN += rpm-example/$(PACKAGE_NAME)-example.spec

LINUX_DEPS += apt-rpm/bin/documentserver-configure.sh

LINUX_DEPS_CLEAN += rpm/bin/*.sh
LINUX_CORE_DEPS += rpm-core/bin/documentserver-configure.sh

LINUX_EXAMPLE_DEPS += rpm-example/bin/documentserver-example-configure.sh

LINUX_DEPS_CLEAN += apt-rpm/bin/*.sh

LINUX_CORE_DEPS_CLEAN += rpm-core/bin/*.sh

LINUX_EXAMPLE_DEPS_CLEAN += rpm-example/bin/*.sh

WIN_DEPS += exe/$(PACKAGE_NAME).iss

ifeq ($(COMPANY_NAME_LOW),onlyoffice)
Expand Down Expand Up @@ -273,12 +293,16 @@ M4_PARAMS += -D M4_PACKAGE_SERVICES='$(PACKAGE_SERVICES)'

.PHONY: all clean clean-docker rpm deb packages deploy-bin

all: rpm deb apt-rpm
all: rpm rpm-core rpm-example deb apt-rpm

apt-rpm:$(APT_RPM)

rpm: $(RPM)

rpm-core: $(RPM_CORE)

rpm-example: $(RPM_EXAMPLE)

rpm_aarch64 : TARGET = linux_arm64
rpm_aarch64 : RPM_ARCH = aarch64
rpm_aarch64 : $(RPM)
Expand All @@ -298,6 +322,8 @@ clean:
deb/*.deb \
$(APT_RPM_BUILD_DIR)\
$(RPM_BUILD_DIR)\
$(RPM_CORE_BUILD_DIR)\
$(RPM_EXAMPLE_BUILD_DIR)\
$(TAR_PACKAGE_DIR)/*.tar.gz\
$(EXE_BUILD_DIR)/*.exe\
$(NGINX)\
Expand All @@ -310,6 +336,8 @@ clean:
$(FONTS)\
$(COMMON_DEPS)\
$(LINUX_DEPS_CLEAN)\
$(LINUX_CORE_DEPS_CLEAN)\
$(LINUX_EXAMPLE_DEPS_CLEAN)\
$(WIN_DEPS)\
documentserver\
documentserver-example
Expand Down Expand Up @@ -434,7 +462,55 @@ $(APT_RPM): $(COMMON_DEPS) $(LINUX_DEPS) documentserver documentserver-example
rpm/$(PACKAGE_NAME).spec : rpm/package.spec
mv -f $< $@

$(RPM): $(COMMON_DEPS) $(LINUX_DEPS) documentserver documentserver-example
rpm-core/$(PACKAGE_NAME)-core.spec : rpm-core/package.spec
mv -f $< $@

$(RPM_CORE): $(COMMON_DEPS) $(LINUX_DEPS) $(LINUX_CORE_DEPS) documentserver
mkdir -p $(@D)
cd $(@D)/../../.. && rpmbuild \
-bb \
--define '_topdir $(@D)/../../../builddir' \
--define '_package_name $(PACKAGE_NAME)-core' \
--define '_product_version $(PRODUCT_VERSION)' \
--define '_build_number $(BUILD_NUMBER)$(RPM_RELEASE:%=.%)' \
--define '_company_name $(COMPANY_NAME)' \
--define '_product_name $(PRODUCT_NAME)' \
--define '_publisher_name $(PUBLISHER_NAME)' \
--define '_publisher_url $(PUBLISHER_URL)' \
--define '_support_url $(SUPPORT_URL)' \
--define '_support_mail $(SUPPORT_MAIL)' \
--define '_company_name_low $(COMPANY_NAME_LOW)' \
--define '_product_name_low $(PRODUCT_NAME_LOW)-core' \
--define '_ds_prefix $(DS_PREFIX)' \
--define '_binary_payload w7.xzdio' \
--target $(RPM_ARCH) \
$(PACKAGE_NAME)-core.spec

rpm-example/$(PACKAGE_NAME)-example.spec : rpm-example/package.spec
mv -f $< $@

$(RPM_EXAMPLE): $(COMMON_DEPS) $(LINUX_DEPS) $(LINUX_EXAMPLE_DEPS) documentserver-example
mkdir -p $(@D)
cd $(@D)/../../.. && rpmbuild \
-bb \
--define '_topdir $(@D)/../../../builddir' \
--define '_package_name $(PACKAGE_NAME)-example' \
--define '_product_version $(PRODUCT_VERSION)' \
--define '_build_number $(BUILD_NUMBER)$(RPM_RELEASE:%=.%)' \
--define '_company_name $(COMPANY_NAME)' \
--define '_product_name $(PRODUCT_NAME)' \
--define '_publisher_name $(PUBLISHER_NAME)' \
--define '_publisher_url $(PUBLISHER_URL)' \
--define '_support_url $(SUPPORT_URL)' \
--define '_support_mail $(SUPPORT_MAIL)' \
--define '_company_name_low $(COMPANY_NAME_LOW)' \
--define '_product_name_low $(PRODUCT_NAME_LOW)-example' \
--define '_ds_prefix $(DS_PREFIX)' \
--define '_binary_payload w7.xzdio' \
--target $(RPM_ARCH) \
$(PACKAGE_NAME)-example.spec

$(RPM): $(COMMON_DEPS) $(LINUX_DEPS)
mkdir -p $(@D)
cd $(@D)/../../.. && rpmbuild \
-bb \
Expand Down
43 changes: 43 additions & 0 deletions common/documentserver-example/nginx/ds.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
upstream example {
server localhost:3000;
}

map $http_host $this_host {
"" $host;
default $http_host;
}

map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}

map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $this_host;
}

map $http_upgrade $proxy_connection {
default upgrade;
"" close;
}

proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


server {
listen 0.0.0.0:80;
listen [::]:80 default_server;
server_tokens off;

set $secure_link_secret verysecretstring;
include /etc/nginx/includes/ds-example.conf;

#example page
rewrite ^/$ $the_scheme://$the_host/example/ redirect;
}
Loading