Skip to content

Commit 43cc677

Browse files
author
Drone CI
committed
public release
0 parents  commit 43cc677

13 files changed

+1979
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.log
2+
*.pyc
3+
**/__pycache__/
4+
.env
5+
.secrets
6+
.list-local

.yamllint

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
extends: default
2+
3+
rules:
4+
braces:
5+
max-spaces-inside: 1
6+
level: error
7+
brackets:
8+
max-spaces-inside: 1
9+
level: error
10+
line-length: disable
11+
truthy: disable

CHANGELOG.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Changelog
2+
3+
## v1.13
4+
5+
* Added default logs generation opportunity for Focal and Bionic (as it was made for Xenial and Trusty)
6+
7+
## v1.12
8+
9+
* Added Consul profiles support
10+
11+
## v1.11
12+
13+
* Added profiles names support for default_setup.local
14+
15+
## v1.10
16+
17+
* Fixed a bug when default-setup stops if profiles is absent in the container
18+
* Fixed bugs in the functions that customize services (Nginx, Monit, etc)
19+
20+
## v1.09
21+
22+
* Fixed bug when default-setup sometimes stops if there was null value in profiles
23+
24+
## v1.08
25+
26+
* Nginx.stat-server-name key was renamed to nginx.stat-servername
27+
* Added MySQL configuration files management
28+
* Added system users management (lock/unlock)
29+
* Updated setup_postfix function. Added header customization opportunity (for Cron emails).
30+
* Updated setup_monit function. Now it doesn't delete files from conf.d but are moved to conf-disabled. It deletes only symlinks from conf-enabled. Fixed mail format in the main configuration file.
31+
* Updated a list of folders for generation in `/var/log` (if they are absent)
32+
* Added the package list checking. If a package is installed the library adds a folder into `/var/log`. Supported packages:
33+
* nginx
34+
* nginx-light
35+
* nginx-full
36+
* nginx-extras
37+
* php5-fpm
38+
* php-fpm5.5
39+
* php-fpm5.6
40+
* php-fpm7.0
41+
* php-fpm7.1
42+
* redis-server
43+
* proftpd-basic
44+
* lxd
45+
* MySQL
46+
* Fixed a bug in the generation process of Monit main configuration file (related with monit.start-delay key)
47+
* Fixed behavior of some functions. Now they don't try to change files if they are absent. This fix reduced log output.
48+
* Fixed functions call order in default-setup
49+
50+
## v1.06
51+
52+
* Changed log path by /var/log/default-setup.log
53+
* Added hlreports parameters management
54+
* Fixed the type of /usr/local/osshelp/default-setup.local check
55+
* Deleted duplicated functions (make_dir/make_file)
56+
* Fixed bug with missing separator in `/etc/netdata/stream.conf` configuration process
57+
* Added highload configuration (it works when Monit is present)
58+
* Updated setup_phpfpm function (enable/disable ini files)

LICENSE.md

+641
Large diffs are not rendered by default.

README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# deploy-functions
2+
3+
[![Build Status](https://drone.osshelp.ru/api/badges/ansible/deploy-functions/status.svg)](https://drone.osshelp.ru/ansible/deploy-functions)
4+
5+
## About
6+
7+
This library is used for customization in the deploying process. It is used with default-setup script. And default-setup is run by cloud-init.
8+
9+
Supported software:
10+
11+
* Netdata
12+
* Monit
13+
* Postfix
14+
* Ssmtp
15+
* Nginx
16+
* PHP-FPM
17+
* Apache
18+
* Cron
19+
* SSH
20+
* MySQL
21+
* Consul
22+
23+
### How to use it
24+
25+
The library must be included in the default-setup script. How to use the library:
26+
27+
1. Place deploy-functions.sh library in the `/usr/local/include/osshelp/` path
28+
1. Place default-setup script in the `/usr/local/osshelp` path and default-setup.local (if you need an additional customization)
29+
1. Install yq and jq
30+
1. Add nessary profiles to container yaml config which is using by lxhelper
31+
1. Deploy container with lxhelper and make sure that the default-setup works as you expected
32+
33+
In the examples directory you can find a skeleton of default-setup.local and usage examples of available profiles.
34+
35+
There’re install/update scripts in the repository. Command for installation (deploy-function.sh, default-setup, yq and jq):
36+
37+
```shell
38+
curl -s https://oss.help/scripts/backup/backup-functions/install.sh | bash
39+
```
40+
41+
## FAQ
42+
43+
### Log
44+
45+
You can find log in `/var/log/default-setup.log`.
46+
47+
### Debug mode
48+
49+
If you want to run default-setup in debug mode, you need:
50+
51+
* Export INSTANCE_ID variable in the container
52+
* Run default-setup by `bash -x` command
53+
54+
Example:
55+
56+
```bash
57+
export INSTANCE_ID=container_name
58+
bash -x /usr/local/osshelp/default-setup server_name
59+
```
60+
61+
## Author
62+
63+
OSSHelp Team, see <https://oss.help>

deploy-functions/.list

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
https://oss.help/scripts/lxc/deploy-functions/SHA256SUMS
2+
https://oss.help/scripts/lxc/deploy-functions/default-setup
3+
https://oss.help/scripts/lxc/deploy-functions/deploy-functions.sh

deploy-functions/SHA256SUMS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
b426aa58cf0c5b225c392647169ffd2708af29cfc940f37c5b59fabf17957dea default-setup
2+
1c283e57bbeaf83b418e4cfba9809da8114b4faa2478b30ef469e1ed2dfefe8d deploy-functions.sh

deploy-functions/default-setup

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
# shellcheck disable=SC2034
3+
4+
# TO DO
5+
# manage output for interactive and non-interactive modes
6+
# shellcheck disable=SC1090
7+
8+
df_ver=1.12
9+
lib_path='/usr/local/include/osshelp/deploy-functions.sh'
10+
log_file='/var/log/default-setup.log'
11+
local_ds='/usr/local/osshelp/default-setup.local'
12+
non_interactive_mode=$(tty -s; echo ${?})
13+
14+
test -r "${lib_path}" || { echo "Library ${lib_path} doesn't exist!"; exit 1; }
15+
test -r "${lib_path}" && . "${lib_path}" "${@}"
16+
17+
function main() {
18+
check_required_tools
19+
prepare_vars
20+
setup_conf_backup
21+
setup_default_varlog
22+
prepare_config
23+
setup_custom_varlog
24+
manage_users
25+
setup_upstart
26+
setup_systemd
27+
setup_ssh
28+
setup_cron
29+
setup_nginx
30+
setup_apache
31+
setup_phpfpm
32+
setup_mysql
33+
setup_postfix
34+
setup_ssmtp
35+
setup_monit
36+
setup_netdata
37+
setup_hlreport
38+
setup_consul
39+
declare_profile_name
40+
test -r "${local_ds}" && . "${local_ds}"
41+
}
42+
43+
test "${non_interactive_mode}" == 0 && main
44+
test "${non_interactive_mode}" == 1 && {
45+
main 2>&1 | tee "${log_file}" > /dev/null # tee used here for fix, see https://oss.help/58130
46+
}

0 commit comments

Comments
 (0)