This commit is contained in:
Zsolt Ero
2023-12-08 03:12:20 +01:00
parent 8743db76d8
commit bd0605d2b7
4 changed files with 75 additions and 5 deletions

1
ideas.txt Normal file
View File

@@ -0,0 +1 @@
specify UID when creating user

View File

@@ -9,11 +9,16 @@ from ssh_lib.kernel import set_cpu_governor, setup_kernel_settings
from ssh_lib.nginx import certbot, nginx
from ssh_lib.pkg_base import pkg_base, pkg_clean, pkg_upgrade
from ssh_lib.planetiler import TILE_GEN_BIN, install_planetiler
from ssh_lib.utils import add_user, put, setup_time, sudo_cmd
from ssh_lib.utils import add_user, enable_sudo, put, setup_time, sudo_cmd
def prepare_shared(c):
add_user(c, 'ofm')
add_user(
c,
'ofm',
passwd='x',
)
enable_sudo(c, 'ofm')
pkg_upgrade(c)
pkg_clean(c)
@@ -25,13 +30,14 @@ def prepare_shared(c):
def prepare_tile_gen(c):
install_planetiler(c)
# install_planetiler(c)
for file in [
'prepare-virtualenv.sh',
'planetiler_planet.sh',
'planetiler_monaco.sh',
'gen_monaco.sh',
'extract.sh',
]:
put(
c,
@@ -41,7 +47,7 @@ def prepare_tile_gen(c):
owner='ofm',
)
sudo_cmd(c, f'cd {TILE_GEN_BIN} && source prepare-virtualenv.sh', user='ofm')
# sudo_cmd(c, f'cd {TILE_GEN_BIN} && source prepare-virtualenv.sh', user='ofm')
def prepare_http_host(c):

View File

@@ -0,0 +1,63 @@
#!/usr/bin/env bash
# reference:
# https://www.kernel.org/doc/Documentation/filesystems/ext4.txt
# https://wiki.archlinux.org/title/ext4
#
# -m reserved-blocks-percentage
# -F Force mke2fs to create a filesystem, even if the specified device is not a partition on a block special device
#
# -O feature
# from /etc/mke2fs.conf
# defaults: has_journal,extent,huge_file,flex_bg,metadata_csum,64bit,dir_nlink,extra_isize
# disabling journalling, since it's a read-only fs, as well as other unused features
#
# -E extended-options
# lazy_itable_init - inode table is fully initialized at the time of file system creation
# nodiscard - Do not attempt to discard blocks at mkfs time.
#
# -T news or small
sudo umount mnt || true
rm -rf mnt
rm -f image.ext4
# make a sparse file
# make sure it's bigger then the current OSM output
# less fragmentation with fallocate
fallocate -l 150G image.ext4
#truncate -s 150G image.ext4
mke2fs -t ext4 -v \
-m 0 \
-F \
-O ^has_journal,^extent,^huge_file,^metadata_csum,^64bit,^extra_isize \
-E lazy_itable_init=0,nodiscard \
-T small \
image.ext4
mkdir mnt
sudo mount -v \
-t ext4 \
image.ext4 mnt
sudo /data/ofm/tile_gen/venv/bin/mb-util output.mbtiles mnt/extract
sudo umount mnt
resize2fs -M image.ext4
e2fsck -vf image.ext4
filefrag -e image.ext4
tune2fs -E mount_opts=ro image.ext4
# -o barriers=[0|1]
# -o data=writeback
# set mount option
#tune2fs -E mount_opts=ro

View File

@@ -7,5 +7,5 @@ RUN_FOLDER="/data/ofm/runs/monaco_$DATE"
mkdir -p "$RUN_FOLDER"
cd "$RUN_FOLDER" || exit
bash /data/tile_gen/run_monaco.sh "$DATE"
bash /data/ofm/tile_gen/planetiler_monaco.sh "$DATE"