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
while ! nc -z {host} {port} | |
do | |
sleep 3 | |
done | |
echo "+++ Service is ready +++" |
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
#!/bin/bash | |
while ! nc -z db 3306 | |
do | |
echo "*** looks like mysql is not ready yet" | |
sleep 3 | |
done | |
echo "+++ Mysql server is ready +++" | |
python manage.py migrate # Apply database migrations |
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
DROP FUNCTION IF EXISTS squid_log.id_by_date; | |
CREATE FUNCTION `id_by_date`(day DATE) | |
RETURNS int(11) | |
DETERMINISTIC /* Чтобы в where-выражении функция не вызывалась для каждой записи */ | |
READS SQL DATA | |
COMMENT 'Получить id записи, ближайшей к указанной дате' | |
BEGIN | |
/******************************************************************************* | |
* Получить id записи, ближайшей к указанной дате | |
* ---------------------------------------------- |
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
DROP FUNCTION IF EXISTS squid_log.get_domain; | |
CREATE FUNCTION `get_domain`(url TEXT, level SMALLINT) | |
RETURNS VARCHAR(100) | |
DETERMINISTIC | |
COMMENT 'Получить доменное имя из URL' | |
BEGIN | |
/******************************************************************************* | |
* Получить доменное имя из URL | |
* ---------------------------- | |
* Дополнительно из доменного имени удаляется поддомен www и все его поддомены. |
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
DROP FUNCTION IF EXISTS squid_log.get_interval; | |
CREATE FUNCTION `get_interval`(moment TIMESTAMP, lenght SMALLINT) | |
RETURNS TIME | |
DETERMINISTIC | |
COMMENT 'Получить время, кратное заданному интервалу' | |
BEGIN | |
/******************************************************************************* | |
* Получить время, кратное заданному интервалу | |
* ------------------------------------------- | |
* Получить интервал времени, в котором находится заданный момент времени. |
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
#!/bin/sh | |
#------------------------------------------------------------------------------- | |
# Скрипт объединения видео-файлов в один и конвертация его в формат MPEG4 | |
# ----------------------------------------------------------------------- | |
# Скрипт берет исходные файлы *.MTS из указанного каталога и генерирует из них | |
# один файл формата mp4 с названием как исходный каталог. | |
# | |
# Входной параметр: имя каталога, содержащий исходные файлы | |
#------------------------------------------------------------------------------- |
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
# Чтобы сортировка производилась в "естественном" порядке (например, | |
# file1, file10, file11, file2 --> file1, file2, file10, file11), ключ | |
# сортировки дополняется слева нулями до строки в N символов (в примере 30). | |
# Из этого следует ограничение метода: необходимо заранее оценить | |
# максимальную длину отдельного элемента списка. | |
list = ['item_1', 'item_10', 'item_11', 'item_2'] | |
list.sort(key=lambda x: '{0:0>30}'.format(x).lower()) |
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
--- | |
# ВНИМАНИЕ! При создании сервиса, к сожалению, невозможно по выдаче команды | |
# docker service inspect определить успешность запуска реплик сервиса - | |
# секция UpdateStatus отсутсвует, а по другим параметрам все ок. | |
# Соответственно, этот плейбук бесполезен при создании сервиса. | |
- name: "Swarm service '{{ service }}': get status" | |
docker_swarm_service_info: | |
name: "{{ service }}" | |
register: service_info |
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
FROM openjdk:11-jre-slim | |
EXPOSE 8080 | |
ENV TZ=Europe/Moscow | |
RUN adduser --system --group --home /opt/app appuser | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends curl jq \ |
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
variables: | |
project_stand: test | |
mattermost_webhook: "http://mattermost.example.ru/hooks/jfdlkds74jldkfjd34dd" | |
stages: | |
- deploy | |
deploy: | |
stage: deploy | |
when: manual |
OlderNewer