├── .editorconfig
├── .gitattributes
├── .github
└── FUNDING.yml
├── .gitignore
├── .idea
├── dictionaries
│ └── vikkyshostak.xml
├── encodings.xml
├── inspectionProfiles
│ └── Project_Default.xml
├── misc.xml
├── modules.xml
├── vcs.xml
├── vdsac.iml
└── workspace.xml
├── .prettierignore
├── LICENSE.md
├── README.md
├── debian
└── stretch
│ ├── init.sh
│ ├── nginx.sh
│ ├── postgresql.sh
│ └── python3.sh
└── init.sh
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | insert_final_newline = true
6 |
7 | # Set default charset
8 | [*.{sh, md}]
9 | charset = utf-8
10 |
11 | [*.sh]
12 | indent_style = space
13 | indent_size = 4
14 |
15 | [*.md]
16 | indent_style = space
17 | indent_size = 2
18 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: koddr
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | custom: # Replace with a single custom sponsorship URL
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Misc
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/.idea/dictionaries/vikkyshostak.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | debian
5 | nginx
6 | vdsac
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
26 |
27 |
28 |
29 |
36 |
37 |
38 |
39 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | ApexVCS
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vdsac.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 | 1552746851866
136 |
137 |
138 | 1552746851866
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .editorconfig
3 | .gitignore
4 | .prettierignore
5 | *.md
6 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Vic Shóstak https://truewebartisans.com
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ✅ Virtual Server Auto Config
2 |
3 |   [](https://github.com/koddr/vdsac/blob/master/LICENSE.md)
4 |
5 | ## The Why?
6 |
7 | Аutomation of routine tasks on a new server **for humans**. Only **verified** configs and **best** practices.
8 |
9 | Just `git clone` and run it!
10 |
11 | ## For GNU/Linux Debian 9 Stretch
12 |
13 | Clone this repo:
14 |
15 | ```console
16 | foo@bar:~$ git clone https://github.com/koddr/vsac.git
17 | ```
18 |
19 | Run `./init.sh` from root dir:
20 |
21 | ```console
22 | foo@bar:~$ cd vsac
23 | foo@bar:~$ sudo chmod +x ./init.sh
24 | foo@bar:~$ sudo ./init.sh [OPTIONS]
25 | ```
26 | ### Options
27 |
28 | * `--webserver [NAME]` — web server name, you want to install (support: `nginx`);
29 | * `--python [VERSION]` — Python 3 version, you want to install (support: `3.5.x`, `3.6.x`, `3.7.x`, `3.8.x`)
30 | * `--postgresql [DATABASE]` — PostgreSQL with database name, you want to install
31 |
32 | ### Nginx configuration
33 |
34 | ```diff
35 | user nginx;
36 | + worker_processes auto;
37 |
38 | events {
39 | + use epoll;
40 | worker_connections 1024;
41 | + multi_accept on;
42 | }
43 |
44 | http {
45 | include /etc/nginx/mime.types;
46 | default_type application/octet-stream;
47 |
48 | access_log off;
49 | error_log /var/log/nginx/error.log crit;
50 | + server_tokens off;
51 |
52 | + keepalive_timeout 30;
53 | + keepalive_requests 100;
54 |
55 | + reset_timedout_connection on;
56 | + client_body_timeout 10;
57 | + send_timeout 2;
58 | sendfile on;
59 | tcp_nodelay on;
60 | + tcp_nopush on;
61 |
62 | + client_max_body_size 1m;
63 |
64 | + open_file_cache max=200000 inactive=20s;
65 | + open_file_cache_valid 30s;
66 | + open_file_cache_min_uses 2;
67 | + open_file_cache_errors on;
68 |
69 | + gzip on;
70 | + gzip_comp_level 5;
71 | + gzip_disable "msie6";
72 | + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml image/gif image/png image/jpeg image/x-icon image/webp;
73 |
74 | include /etc/nginx/conf.d/*.conf;
75 | }
76 | ```
77 |
78 | ## Other usefull Bash scripts for automatization
79 |
80 | * [SSL] Let's Encrypt — https://github.com/Neilpang/acme.sh
81 |
82 | ## Enjoy the configured server 🎉
83 |
84 | 
85 |
86 | ## Developers
87 |
88 | - Idea and active development by [Vic Shóstak](https://github.com/koddr) (aka Koddr).
89 |
90 | ## Project assistance
91 |
92 | If you want to say «thank you» or/and support active development `Virtual Server Auto Config`:
93 |
94 | 1. Add a GitHub Star to project.
95 | 2. Twit about project [on your Twitter](https://twitter.com/intent/tweet?text=%23%D0%90utomation%20of%20routine%20tasks%20on%20a%20new%20%23VDS%20%23server%20for%20%23humans%20%F0%9F%8E%89%20Only%20verified%20%23configs%20and%20%23best%20practices%20%F0%9F%91%8D&url=https%3A%2F%2Fgithub.com%2Fkoddr%2Fvsac).
96 | 3. If you want, send to project's author some money via PayPal: [@paypal.me/koddr](https://paypal.me/koddr?locale.x=en_EN).
97 |
98 | ## License
99 |
100 | MIT
101 |
--------------------------------------------------------------------------------
/debian/stretch/init.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Colors
3 | GREEN="\033[0;32m"
4 | WHITE="\033[1;37m"
5 | YELLOW="\033[1;33m"
6 | RED="\033[0;31m"
7 | NC="\033[0m"
8 | # Welcome message
9 | {
10 | echo ""
11 | echo "╔═══════════════════════════════════╗"
12 | echo -e "║ ${GREEN}✔ VDSAC${NC} ${WHITE}for Debian 9 Stretch${NC} ║"
13 | echo "╚═══════════════════════════════════╝"
14 | echo ""
15 | }
16 | # Init Update
17 | sudo apt update && apt upgrade -y
18 | # Install packages
19 | sudo apt ca-certificates -y
20 | # Auto or manual continue
21 | while [[ -n "$1" ]]
22 | do
23 | case "$1" in
24 | --webserver)
25 | # Check option value
26 | if ! [[ -z "$2" ]]
27 | then
28 | # Nginx
29 | if [[ "$2" =~ ^nginx$ ]]
30 | then
31 | # Init bash scripts
32 | sudo chmod +x ./debian/stretch/nginx.sh
33 | # Install
34 | sudo ./debian/stretch/nginx.sh
35 | fi
36 | else
37 | # Error
38 | {
39 | echo ""
40 | echo "░"
41 | echo -e "░ ${RED}Value for option $1 is required.${NC}"
42 | echo "░"
43 | echo ""
44 | }
45 | exit
46 | fi
47 | shift
48 | ;;
49 | --python)
50 | # Check option value
51 | if ! [[ -z "$2" ]]
52 | then
53 | # Init bash scripts
54 | sudo chmod +x ./debian/stretch/python3.sh
55 | # Update Python 3
56 | sudo ./debian/stretch/python3.sh $2
57 | else
58 | # Error
59 | {
60 | echo ""
61 | echo "░"
62 | echo -e "░ ${RED}Value for option $1 is required.${NC}"
63 | echo "░"
64 | echo ""
65 | }
66 | exit
67 | fi
68 | shift
69 | ;;
70 | --postgresql)
71 | # Check option value
72 | if ! [[ -z "$2" ]]
73 | then
74 | # Init bash scripts
75 | sudo chmod +x ./debian/stretch/postgresql.sh
76 | # Install PostgreSQL
77 | sudo ./debian/stretch/postgresql.sh $2
78 | else
79 | # Error
80 | {
81 | echo ""
82 | echo "░"
83 | echo -e "░ ${RED}Value for option $1 is required.${NC}"
84 | echo "░"
85 | echo ""
86 | }
87 | exit
88 | fi
89 | shift
90 | ;;
91 | --)
92 | shift
93 | break
94 | ;;
95 | *)
96 | # Manual continue
97 | {
98 | echo ""
99 | echo "░"
100 | echo -e "░ ${GREEN}✔ Init is complete!${NC}"
101 | echo "░"
102 | echo "░ Next steps:"
103 | echo "░"
104 | echo "░ Install Nginx"
105 | echo "░"
106 | echo -e "░ ${WHITE}$ ${NC}${GREEN}sudo${NC} ${YELLOW}./debian/stretch/nginx.sh${NC}"
107 | echo "░"
108 | echo "░ Update Python 3"
109 | echo "░"
110 | echo -e "░ ${WHITE}$ ${NC}${GREEN}sudo${NC} ${YELLOW}./debian/stretch/python3.sh [VERSION]${NC}"
111 | echo "░"
112 | echo "░ Install PostgreSQL"
113 | echo "░"
114 | echo -e "░ ${WHITE}$ ${NC}${GREEN}sudo${NC} ${YELLOW}./debian/stretch/postgresql.sh [DATABASE]${NC}"
115 | echo "░"
116 | echo ""
117 | }
118 | exit
119 | ;;
120 | esac
121 | shift
122 | done
123 |
--------------------------------------------------------------------------------
/debian/stretch/nginx.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Colors
3 | GREEN="\033[0;32m"
4 | NC="\033[0m"
5 | # Add deb repo
6 | {
7 | sudo echo ""
8 | sudo echo "# Nginx"
9 | sudo echo "deb http://nginx.org/packages/mainline/debian/ stretch nginx"
10 | sudo echo "deb-src http://nginx.org/packages/mainline/debian/ stretch nginx"
11 | sudo echo ""
12 | } >> /etc/apt/sources.list.d/nginx.list
13 | # Download and add signing key
14 | sudo wget -qO - http://nginx.org/keys/nginx_signing.key | sudo apt-key add -
15 | # Remove previous installation
16 | sudo apt remove nginx nginx-common -y
17 | # Update
18 | sudo apt update && apt upgrade -y
19 | # Install
20 | sudo apt install nginx -y
21 | # Create config
22 | sudo cat >/etc/nginx/nginx.conf <> /etc/apt/sources.list.d/postgresql.list
12 | # Download and add signing key
13 | wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
14 | # Remove previous installation
15 | sudo apt remove postgresql -y
16 | # Update
17 | sudo apt update && apt upgrade -y
18 | # Install
19 | sudo apt install postgresql -y
20 | # Enable
21 | sudo systemctl enable postgresql.service
22 | # Start
23 | sudo systemctl start postgresql.service
24 | # Exit message
25 | {
26 | echo ""
27 | echo "░"
28 | echo -e "░ ${GREEN}✔ PostgreSQL installed and configured!${NC}"
29 | echo "░"
30 | echo ""
31 | }
32 |
--------------------------------------------------------------------------------
/debian/stretch/python3.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Colors
3 | GREEN="\033[0;32m"
4 | YELLOW="\033[1;33m"
5 | WHITE="\033[1;37m"
6 | RED="\033[0;31m"
7 | NC="\033[0m"
8 | # Waiting for user input
9 | if ! [[ -z "$1" ]]
10 | then
11 | version=$1
12 | else
13 | read -p "Enter Python 3 version to install [ex. 3.7.0] → " version
14 | fi
15 | # Check Python version
16 | if [[ "$version" =~ ^(3\.)?([5-8]\.)?([0-9])$ ]]
17 | then
18 | # Install dependencies
19 | sudo apt install build-essential libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev zlib1g -y
20 | # Download
21 | sudo wget -P /temp https://www.python.org/ftp/python/$version/Python-$version.tgz
22 | # Go to temp
23 | cd /temp
24 | # Unzip
25 | sudo tar -xzvf Python-$version.tgz
26 | # Configure
27 | sudo Python-$version/configure --enable-optimizations
28 | # Build started message
29 | {
30 | echo ""
31 | echo "░"
32 | echo -e "░ ${GREEN}✔ Python $version build configured successfully!${NC}"
33 | echo "░"
34 | echo -e "░ ${YELLOW}Compiling Python $version build...${NC}"
35 | echo "░ Wait, please. This process may take some time!"
36 | echo "░"
37 | }
38 | # Make Python build
39 | sudo make > /dev/null 2>&1
40 | # Build finished message
41 | {
42 | echo -e "░ ${GREEN}✔ Python $version build compiled successfully!${NC}"
43 | echo "░"
44 | echo -e "░ ${YELLOW}Installing Python $version...${NC}"
45 | echo "░ Wait, please. This process may take some time!"
46 | echo "░"
47 | }
48 | # Install
49 | sudo make install > /dev/null 2>&1
50 | # CLean up
51 | sudo apt autoremove
52 | sudo rm -rf /temp/Python-$version
53 | sudo rm /temp/Python-$version.tgz
54 | # Exit message
55 | {
56 | echo -e "░ ${GREEN}✔ Python $version installed successfully!${NC}"
57 | echo "░"
58 | echo ""
59 | }
60 | else
61 | # Error message
62 | {
63 | echo ""
64 | echo "░"
65 | echo -e "░ ${RED}Choose another Python version (ex. 3.7.0).${NC}"
66 | echo "░"
67 | echo ""
68 | }
69 | exit
70 | fi
71 |
--------------------------------------------------------------------------------
/init.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Colors
3 | GREEN="\033[0;32m"
4 | YELLOW="\033[1;33m"
5 | WHITE="\033[1;37m"
6 | RED="\033[0;31m"
7 | NC="\033[0m"
8 | # Welcome message
9 | {
10 | echo ""
11 | echo "╔═══════════════════════════════════╗"
12 | echo "║ ║"
13 | echo -e "║ ${GREEN}✔ VDS Auto Config${NC} ${YELLOW}1.2.0${NC} ║"
14 | echo -e "║ ${WHITE}github.com/koddr/vdsac${NC} ║"
15 | echo "║ ║"
16 | echo "╚═══════════════════════════════════╝"
17 | echo ""
18 | }
19 | # Choose system
20 | PS3="Choose GNU/Linux distribution [1-2] → "
21 | # Select system
22 | select distribution in Debian Ubuntu
23 | do
24 | case $distribution in
25 | Debian)
26 | # Choose system version
27 | PS3="Choose $distribution version [1] → "
28 | # Select version
29 | select version in Stretch
30 | do
31 | case $version in
32 | Stretch)
33 | # Init VDSAC for Debian Stretch
34 | sudo chmod +x ./debian/stretch/init.sh
35 | sudo ./debian/stretch/init.sh $@
36 | break
37 | ;;
38 | *)
39 | {
40 | echo ""
41 | echo "░"
42 | echo -e "░ ${RED}Unknown $distribution version ($version).${NC}"
43 | echo "░"
44 | echo ""
45 | }
46 | exit
47 | ;;
48 | esac
49 | done
50 | break
51 | ;;
52 | *)
53 | {
54 | echo ""
55 | echo "░"
56 | echo -e "░ ${RED}Unknown GNU/Linux distribution ($distribution).${NC}"
57 | echo "░"
58 | echo ""
59 | }
60 | exit
61 | ;;
62 | esac
63 | done
64 |
--------------------------------------------------------------------------------