Skip to content

Commit 965f136

Browse files
author
olevole
committed
link cbsd_fetch.md
1 parent eb8c2b6 commit 965f136

File tree

2 files changed

+71
-101
lines changed

2 files changed

+71
-101
lines changed

share/docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Exploring the CBSD virtual environment management framework](https://eerielinux.
1515
- [Broker driven CBSD cluster (example)](general/)
1616
- [CBSD integration with PHPIPAM (IP management)](general/wf_ipam.md)
1717
- [API module: private cloud via API](general/cbsd_api.md)
18+
- [About fetch work with CBSD (bases,images,VM), CBSD mirrors](general/cbsd_fetch.md)
19+
1820

1921
<!---
2022
- [What you need to know about CBSD](general/cbsd_additional.md)
@@ -32,7 +34,6 @@ Exploring the CBSD virtual environment management framework](https://eerielinux.
3234
- [How does a helper for CBSD image](/wf_imghelper_ssi.md) :: imghelper
3335
- [cbsd command history](/wf_history_ssi.md) :: CBSD history
3436
- [Modification which are carried out by CBSD scripts in FreeBSD](custom_freecbsd.md)
35-
- [About fetch work with CBSD, loading FreeBSD bases, templates and images of VMs](cbsd_fetch.md)
3637
- [cbsd taskd](cbsd_taskd.md) :: task, taskls
3738
- [FreeBSD: Xorg in jail](xorg_in_jail.md)
3839
- [FreeBSD: CBSD and bhyve](bhyve.md)

share/docs/general/cbsd_fetch.md

Lines changed: 69 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,4 @@
1-
[View source on GitHub](https://github.com/cbsd/cbsd)
2-
3-
FreeBSD virtual environment management and repository
4-
5-
- [About](http://www.bsdstore.ru/en/about.html)
6-
- [News](http://www.bsdstore.ru/en/news.html)
7-
- [Screenshots](http://www.bsdstore.ru/en/screenshots.html)
8-
- [Tutorial](http://www.bsdstore.ru/en/tutorial.html)
9-
- [Documentation »](http://www.bsdstore.ru/en/docs.html) - [Articles by author's](http://www.bsdstore.ru/en/articles.html)
10-
- [Articles and press](http://www.bsdstore.ru/en/press.html)
11-
- [Marketplace(Templates)](https://marketplace.bsdstore.ru)
12-
- [Support the project](http://www.bsdstore.ru/en/donate.html)
13-
- [bhyve.cloud](http://www.bsdstore.ru/en/bhyve-cloud.html)
14-
- Lang » - [Русский](http://www.bsdstore.ru/ru/cbsd_fetch.html)
15-
- [English](http://www.bsdstore.ru/en/cbsd_fetch.html)
16-
- [Deutsch](http://www.bsdstore.ru/de/cbsd_fetch.html)
17-
18-
2020-10 upd: we reached the first fundraising goal and rented a server in Hetzner for development! Thank you for [donating](https://www.patreon.com/clonos) !
19-
20-
Attention! I apologize for the automatic translation of this text. You can improve it by sending me a more correct version of the text or fix html pages via [GITHUB repository](https://github.com/cbsd/cbsd-wwwdoc).
21-
22-
# fetch
1+
# About fetch work with CBSD (bases,images,VM), CBSD mirrors
232

243
## Description
254

@@ -96,7 +75,7 @@ If there are no updates, you can help the project (and make the same users happy
9675
If you are at your own risk and want to take an ISO image, despite the discrepancy between the amounts of CRC, you have two options:
9776

9877
- Adjust the **sha256sum** value in a particular profile by setting **sha256sum=0**. When **sha256sum=0**, this causes **CBSD** to skip the CRC check.
99-
Refer to the section [CBSD profiles](http://www.bsdstore.ru/en/13.0.x/wf_profiles_ssi.html) for details on how to overwrite certain parameters.
78+
Refer to the section [CBSD profiles](../jail/wf_profiles_ssi.md) for details on how to overwrite certain parameters.
10079
- Prevent CRC checksums globally through the **BSD\_ISO\_SKIP\_CHECKSUM=\[yes\|no\]** environment variable (or configuration file), for example: env CBSD\_ISO\_SKIP\_CHECKSUM=yes cbsd bstart ..
10180

10281
To automatically update CRC amounts in profiles, you can use the **fetch\_iso** script, which we will discuss below.
@@ -134,108 +113,98 @@ Step-by-step setup of the mirror with periodic synchronization via [rsync](http:
134113
1) Install packages:
135114

136115
```
137-
pkg install -y rsync nginx
138-
116+
pkg install -y rsync nginx
139117
```
140118

141119
2) Activate nginx services:
142120

143121
```
144-
sysrc nginx_enable="YES"
145-
122+
sysrc nginx_enable="YES"
146123
```
147124

148125
3) Create _/usr/local/www/cbsd-mirror_ directory where we will save ISO images, create a log file for rsync and set the right permissions for the **www** user, from which we will synchronize
149126

150127
```
151-
mkdir -p /usr/local/www/cbsd-mirror/iso /usr/local/www/cbsd-mirror/cloud
152-
touch /var/log/cbsd_mirror.log /var/log/cbsd_mirror_cloud.log
153-
chown -R www:www /usr/local/www/cbsd-mirror /var/log/cbsd_mirror.log /var/log/cbsd_mirror_cloud.log
154-
128+
mkdir -p /usr/local/www/cbsd-mirror/iso /usr/local/www/cbsd-mirror/cloud
129+
touch /var/log/cbsd_mirror.log /var/log/cbsd_mirror_cloud.log
130+
chown -R www:www /usr/local/www/cbsd-mirror /var/log/cbsd_mirror.log /var/log/cbsd_mirror_cloud.log
155131
```
156132

157133
4) Correct **nginx.conf**, specifying **server\_name** as correct name of the server (in this example: **electrode.bsdstore.ru**) and set path to root directory:
158134

159135
```
160-
cat > /usr/local/etc/nginx/nginx.conf <<EOF
161-
user nobody;
162-
worker_processes 2;
163-
164-
error_log /var/null;
165-
pid /var/run/nginx.pid;
166-
167-
events {
168-
worker_connections 1024;
169-
kqueue_changes 1024;
170-
use kqueue;
171-
}
172-
173-
http {
174-
server_tokens off;
175-
include mime.types;
176-
default_type application/octet-stream;
177-
178-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
179-
'$status $body_bytes_sent "$http_referer" '
180-
'"$http_user_agent" "$http_x_forwarded_for"';
181-
182-
error_log /dev/null;
183-
access_log /dev/null;
184-
client_header_timeout 3m;
185-
client_body_timeout 3m;
186-
send_timeout 3m;
187-
client_header_buffer_size 1k;
188-
large_client_header_buffers 4 8k;
189-
client_body_buffer_size 32K;
190-
log_not_found off;
191-
192-
client_max_body_size 20m;
193-
194-
gzip off;
195-
output_buffers 1 32k;
196-
postpone_output 1460;
197-
reset_timedout_connection on;
198-
sendfile on;
199-
tcp_nopush on;
200-
tcp_nodelay on;
201-
send_lowat 12000;
202-
keepalive_timeout 8;
203-
204-
server {
205-
listen *:80;
206-
#listen [::]:80; # Enable IPv6
207-
208-
server_name electrode.bsdstore.ru;
209-
access_log /var/log/nginx/electrode.bsdstore.ru.acc main;
210-
error_log /var/log/nginx/electrode.bsdstore.ru.err;
211-
212-
root /usr/local/www/cbsd-mirror;
213-
}
214-
}
215-
EOF
216-
136+
cat > /usr/local/etc/nginx/nginx.conf <<EOF
137+
user nobody;
138+
worker_processes 2;
139+
140+
error_log /var/null;
141+
pid /var/run/nginx.pid;
142+
143+
events {
144+
worker_connections 1024;
145+
kqueue_changes 1024;
146+
use kqueue;
147+
}
148+
149+
http {
150+
server_tokens off;
151+
include mime.types;
152+
default_type application/octet-stream;
153+
154+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
155+
'$status $body_bytes_sent "$http_referer" '
156+
'"$http_user_agent" "$http_x_forwarded_for"';
157+
158+
error_log /dev/null;
159+
access_log /dev/null;
160+
client_header_timeout 3m;
161+
client_body_timeout 3m;
162+
send_timeout 3m;
163+
client_header_buffer_size 1k;
164+
large_client_header_buffers 4 8k;
165+
client_body_buffer_size 32K;
166+
log_not_found off;
167+
168+
client_max_body_size 20m;
169+
170+
gzip off;
171+
output_buffers 1 32k;
172+
postpone_output 1460;
173+
reset_timedout_connection on;
174+
sendfile on;
175+
tcp_nopush on;
176+
tcp_nodelay on;
177+
send_lowat 12000;
178+
keepalive_timeout 8;
179+
180+
server {
181+
listen *:80;
182+
#listen [::]:80; # Enable IPv6;
183+
184+
server_name cbsd-mirror.example.com; # set valid server_name;
185+
access_log /var/log/nginx/cbsd-mirror.example.com.acc main;
186+
error_log /var/log/nginx/cbsd-mirror.example.com.err;
187+
root /usr/local/www/cbsd-mirror;
188+
}
189+
}
190+
EOF
217191
```
218192

219193
5) Create an entry in crontab with the rsync call for 15 minutes through lockf to stop duplication of processes
220194

221195
```
222-
cat > /etc/cron.d/cbsd_mirror <<EOF
223-
SHELL=/bin/sh
224-
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
225-
*/15 * * * * www /usr/bin/lockf -s -t0 /tmp/cbsd_mirror.lock /usr/local/bin/rsync -a --delete rsync://electro.bsdstore.ru/iso/ /usr/local/www/cbsd-mirror/iso/ > /var/log/cbsd_mirror.log 2>&1
226-
*/15 * * * * www /usr/bin/lockf -s -t0 /tmp/cbsd_mirror_cloud.lock /usr/local/bin/rsync -a --delete rsync://electro.bsdstore.ru/cloud/ /usr/local/www/cbsd-mirror/cloud/ > /var/log/cbsd_mirror_cloud.log 2>&1
227-
EOF
228-
196+
cat > /etc/cron.d/cbsd_mirror <<EOF
197+
SHELL=/bin/sh
198+
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
199+
*/15 * * * * www /usr/bin/lockf -s -t0 /tmp/cbsd_mirror.lock /usr/local/bin/rsync -a --delete rsync://mirror.convectix.com/iso/ /usr/local/www/cbsd-mirror/iso/ > /var/log/cbsd_mirror.log 2>&1
200+
*/15 * * * * www /usr/bin/lockf -s -t0 /tmp/cbsd_mirror_cloud.lock /usr/local/bin/rsync -a --delete rsync://mirror.convectix.com/cloud/ /usr/local/www/cbsd-mirror/cloud/ > /var/log/cbsd_mirror_cloud.log 2>&1
201+
EOF
229202
```
230203

231204
6) Start WEB service
232205

233206
```
234-
service nginx restart
235-
207+
service nginx restart
236208
```
237209

238210
After synchronizing the directory and verifying that the ISO images from your resource are available to the rest of the world - you can send [Pull Request](https://github.com/cbsd/cbsd-vmprofiles/pulls) in [profiles project](https://github.com/cbsd/cbsd-vmprofiles) with added your servers in **cbsd\_iso\_mirrors** params of VM config files.
239-
240-
Copyright © 2013—2024 CBSD Team.
241-

0 commit comments

Comments
 (0)