-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: оптимизация сборки артифактов и тестирование на сервере
- Loading branch information
Showing
23 changed files
with
819 additions
and
171 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Создан на основании https://github.com/firstBitMarksistskaya/onec-docker/blob/feature/first-bit/server/Dockerfile | ||
|
||
# Начало основной стадии сборки | ||
FROM ubuntu:20.04 as installer | ||
|
||
# Копируем скрипты и файлы установки | ||
ARG ONEC_VERSION | ||
ARG gosu_ver=1.11 | ||
ARG nls_enabled=false | ||
|
||
ENV nls=$nls_enabled | ||
ENV distrPath=/tmp/downloads/Platform83/${ONEC_VERSION} | ||
ENV installer_type=server | ||
|
||
COPY ./scripts/install_new.sh /install.sh | ||
COPY ./distr/current /tmp | ||
|
||
# Установка зависимостей и настройка локали | ||
RUN apt-get update \ | ||
&& apt-get install -yq \ | ||
procps \ | ||
tzdata \ | ||
debconf-utils \ | ||
curl \ | ||
fontconfig \ | ||
unixodbc \ | ||
ttf-mscorefonts-installer \ | ||
libgsf-1-114 \ | ||
keyboard-configuration \ | ||
&& dpkg-reconfigure -f noninteractive tzdata \ | ||
&& dpkg-reconfigure -f noninteractive keyboard-configuration \ | ||
&& apt-get install -yq geoclue-2.0 gstreamer1.0-plugins-bad \ | ||
&& export LANG=ru_RU.UTF-8 | ||
|
||
WORKDIR /tmp | ||
RUN ls . \ | ||
&& chmod +x /install.sh \ | ||
&& sync; /install.sh | ||
|
||
# Создание символической ссылки на текущую директорию 1C | ||
COPY ./scripts/create-symlink-to-current-1cv8.sh /create-symlink-to-current-1cv8.sh | ||
RUN chmod +x /create-symlink-to-current-1cv8.sh \ | ||
&& /create-symlink-to-current-1cv8.sh \ | ||
&& rm /create-symlink-to-current-1cv8.sh | ||
|
||
# Установка gosu | ||
ADD https://github.com/tianon/gosu/releases/download/$gosu_ver/gosu-amd64 /bin/gosu | ||
RUN chmod +x /bin/gosu | ||
|
||
# Переход к финальному образу | ||
FROM debian:bullseye-slim | ||
LABEL maintainer="ivanov egor" | ||
|
||
# Создание пользователя и установка локали | ||
ARG onec_uid="999" | ||
ARG onec_gid="999" | ||
COPY --from=installer /opt/1cv8 /opt/1cv8 | ||
COPY --from=installer /bin/gosu /bin/gosu | ||
RUN set -xe \ | ||
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
locales \ | ||
iproute2 \ | ||
imagemagick \ | ||
fontconfig \ | ||
ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf \ | ||
&& localedef -i ru_RU -c -f UTF-8 -A /usr/share/locale/locale.alias ru_RU.UTF-8 | ||
ENV LANG ru_RU.UTF-8 | ||
|
||
# Настройка группы и пользователя | ||
RUN groupadd -r grp1cv8 --gid=$onec_gid \ | ||
&& useradd -r -g grp1cv8 --uid=$onec_uid --home-dir=/home/usr1cv8 --shell=/bin/bash usr1cv8 \ | ||
&& mkdir -p /var/log/1C /home/usr1cv8/.1cv8/1C/1cv8/conf /opt/1cv8/current/conf \ | ||
&& chown -R usr1cv8:grp1cv8 /var/log/1C /home/usr1cv8 | ||
|
||
VOLUME /home/usr1cv8/.1cv8 /var/log/1C | ||
|
||
# Копирование конфигурационных файлов | ||
COPY ./logcfg.xml /home/usr1cv8/.1cv8/1C/1cv8/conf | ||
COPY ./logcfg.xml /opt/1cv8/current/conf | ||
|
||
# Установка точки входа и выполнение дополнительных настроек | ||
COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | ||
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat | ||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh | ||
RUN apt-get update && apt-get install -yq procps | ||
RUN chmod +x /opt/1cv8/current/ragent | ||
|
||
# Настройка точки входа и экспонирование портов | ||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] | ||
EXPOSE 1540 1541 1545 1560 | ||
CMD ["ragent"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
source ../.env | ||
|
||
rm ./distr/current | ||
cp -r ./distr/$ONEC_VERSION/ ./distr/current | ||
|
||
docker build \ | ||
--build-arg ONEC_VERSION=$ONEC_VERSION \ | ||
-t onec-server:$ONEC_VERSION \ | ||
-f Dockerfile \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
# Установка значений по умолчанию | ||
setup_defaults() { | ||
DEFAULT_PORT=1540 | ||
DEFAULT_REGPORT=1541 | ||
DEFAULT_RANGE=1560:1591 | ||
DEFAULT_SECLEVEL=0 | ||
DEFAULT_PINGPERIOD=1000 | ||
DEFAULT_PINGTIMEOUT=5000 | ||
DEFAULT_DEBUG=-tcp | ||
DEFAULT_DEBUGSERVERPORT=1550 | ||
DEFAULT_RAS_PORT=1545 | ||
} | ||
|
||
# Настройка команды запуска ragent | ||
setup_ragent_cmd() { | ||
RAGENT_CMD="gosu usr1cv8 /opt/1cv8/current/ragent" | ||
RAGENT_CMD+=" /port ${PORT:-$DEFAULT_PORT}" | ||
RAGENT_CMD+=" /regport ${REGPORT:-$DEFAULT_REGPORT}" | ||
RAGENT_CMD+=" /range ${RANGE:-$DEFAULT_RANGE}" | ||
RAGENT_CMD+=" /seclev ${SECLEVEL:-$DEFAULT_SECLEVEL}" | ||
RAGENT_CMD+=" /d ${D:-/home/usr1cv8/.1cv8}" | ||
RAGENT_CMD+=" /pingPeriod ${PINGPERIOD:-$DEFAULT_PINGPERIOD}" | ||
RAGENT_CMD+=" /pingTimeout ${PINGTIMEOUT:-$DEFAULT_PINGTIMEOUT}" | ||
RAGENT_CMD+=" /debug ${DEBUG:-$DEFAULT_DEBUG}" | ||
[ -n "$DEBUGSERVERADDR" ] && RAGENT_CMD+=" /debugServerAddr $DEBUGSERVERADDR" | ||
RAGENT_CMD+=" /debugServerPort ${DEBUGSERVERPORT:-$DEFAULT_DEBUGSERVERPORT}" | ||
[ -n "$DEBUGSERVERPWD" ] && RAGENT_CMD+=" /debugServerPwd $DEBUGSERVERPWD" | ||
} | ||
|
||
# Настройка команды запуска ras | ||
setup_ras_cmd() { | ||
RAS_CMD="gosu usr1cv8 /opt/1cv8/current/ras cluster --daemon" | ||
RAS_CMD+=" --port ${RAS_PORT:-$DEFAULT_RAS_PORT}" | ||
RAS_CMD+=" localhost:${PORT:-$DEFAULT_PORT}" | ||
} | ||
|
||
# Изменение прав доступа к директории пользователя | ||
change_directory_permissions() { | ||
chown -R usr1cv8:grp1cv8 /home/usr1cv8 | ||
} | ||
|
||
# Главная функция скрипта | ||
main() { | ||
setup_defaults | ||
change_directory_permissions | ||
|
||
if [ "$1" = "ragent" ]; then | ||
setup_ragent_cmd | ||
setup_ras_cmd | ||
|
||
echo "Запускаем ras с необходимыми параметрами" | ||
echo "Выполняемая команда: $RAS_CMD" | ||
$RAS_CMD 2>&1 & # Запуск ras в фоновом режиме | ||
|
||
echo "Запускаем ragent с необходимыми параметрами" | ||
echo "Выполняемая команда: $RAGENT_CMD" | ||
exec $RAGENT_CMD 2>&1 | ||
else | ||
# Если первый аргумент не 'ragent', выполняем команду, переданную в аргументах | ||
"$@" | ||
fi | ||
} | ||
|
||
# Вызов главной функции | ||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<config xmlns="http://v8.1c.ru/v8/tech-log"> | ||
<log location="/var/log/1C" history="1"> | ||
<event> | ||
<eq property="name" value="excp"/> | ||
</event> | ||
<property name="all"/> | ||
</log> | ||
</config> |
7 changes: 7 additions & 0 deletions
7
tools/local-test/build-server/scripts/create-symlink-to-current-1cv8.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
platform_path=$(find / -type f -name "1cv8c" -exec dirname {} \; -or -type f -name "1cv8" -exec dirname {} \; -or -type f -name "ragent" -exec dirname {} \; -or -type f -name "crserver" -exec dirname {} \; | uniq) | ||
|
||
mkdir -p /opt/1cv8 \ | ||
&& ln -s $platform_path /opt/1cv8/current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
|
||
if [ -z "$ONEC_USERNAME" ] | ||
then | ||
echo "ONEC_USERNAME not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$ONEC_PASSWORD" ] | ||
then | ||
echo "ONEC_PASSWORD not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$ONEC_VERSION" ] | ||
then | ||
echo "ONEC_VERSION not set" | ||
exit 1 | ||
fi | ||
|
||
ONEC_RELEASE=`echo $ONEC_VERSION | cut -d . -f 3` | ||
echo "Release: "$ONEC_RELEASE | ||
|
||
echo "Downloading Oneget tool from https://github.com/firstBitMarksistskaya/oneget" | ||
curl -L -o oneget.tar.gz https://github.com/firstBitMarksistskaya/oneget/releases/latest/download/oneget_Linux_x86_64.tar.gz \ | ||
&& mkdir /tmp/oneget_tool \ | ||
&& tar xzf oneget.tar.gz -C /tmp/oneget_tool \ | ||
&& rm oneget.tar.gz | ||
|
||
if [ ! -f /tmp/oneget_tool/oneget ]; then | ||
echo "Oneget not found!" | ||
exit 1 | ||
fi | ||
|
||
if [[ "$ONEC_RELEASE" -lt "20" ]]; then | ||
package="deb" | ||
package_installer_type="."$installer_type | ||
else | ||
package="linux" | ||
package_installer_type="" | ||
fi | ||
|
||
case "$installer_type" in | ||
edt) | ||
echo "EDT" | ||
/tmp/oneget_tool/oneget get "edt:linux@"$ONEC_VERSION | ||
;; | ||
server) | ||
/tmp/oneget_tool/oneget get "platform:"$package$package_installer_type".x64@"$ONEC_VERSION | ||
;; | ||
server32) | ||
/tmp/oneget_tool/oneget get "platform:"$package${package_installer_type/32/}".x32@"$ONEC_VERSION | ||
;; | ||
client) | ||
if [[ "$ONEC_RELEASE" -lt "20" ]]; then | ||
/tmp/oneget_tool/oneget get "platform:"$package".server.x64@"$ONEC_VERSION | ||
fi | ||
/tmp/oneget_tool/oneget get "platform:"$package$package_installer_type".x64@"$ONEC_VERSION | ||
;; | ||
client32) | ||
if [[ "$ONEC_RELEASE" -lt "20" ]]; then | ||
/tmp/oneget_tool/oneget get "platform:"$package".server.x32@"$ONEC_VERSION | ||
fi | ||
/tmp/oneget_tool/oneget get "platform:"$package${package_installer_type/32/}".x32@"$ONEC_VERSION | ||
;; | ||
thin-client) | ||
/tmp/oneget_tool/oneget get "platform:"$package"."$installer_type".x64@"$ONEC_VERSION | ||
;; | ||
thin-client32) | ||
/tmp/oneget_tool/oneget get "platform:"$package"."${installer_type/32/}".x32@"$ONEC_VERSION | ||
esac | ||
|
Oops, something went wrong.