FreeBSD install script

Hi everyone !

I have Freenas with plenty of memory so I’m current working on a install script to install webodm in a jail.
It’s have really been a pain to iron out all the problems that I have encounter on this journey but now I find my self beaten.

My current script …

#!/bin/tcsh


pkg update -f
pkg upgrade

pkg install -y nano						# Nano (text editor)	

pkg install -y postgresql11-server postgresql11-client  	# install postgres
sysrc postgresql_enable=yes  					# enable at boot in  /ect/rc.conf
/usr/local/etc/rc.d/postgresql initdb				# init the database

                                                # make postgresql listen to all addresses

echo "listen_addresses = '*'" >>  /var/db/postgres/data11/postgresql.conf  	


/usr/local/etc/rc.d/postgresql initdb				# Initialize the database
                  # make all  connection,user,databases available
echo "host  all  all  0.0.0.0/0  md5" >>     /var/db/postgres/data11/pg_hba.conf    

/usr/local/etc/rc.d/postgresql start 				# start postgresql

								# Setup of WebODM database

su - postgres -c "psql -c "\""CREATE USER postgres WITH PASSWORD 'postgres'"\"";  " 
su - postgres -c "psql -c "\""ALTER ROLE postgres WITH PASSWORD 'postgres'"\""; " 
su - postgres -c "psql -c "\""ALTER ROLE postgres WITH SUPERUSER"\""; " 
su - postgres -c "createdb -O postgres webodm_dev -E utf-8" 

su - postgres -c "psql -d webodm_dev -c "\""SET postgis.enable_outdb_rasters TO True;"\"" "
su - postgres -c "psql -d webodm_dev -c "\""SET postgis.gdal_enabled_drivers TO 'GTiff';"\"" " 


	# Install misc package

pkg install -y postgis30-3.0.1_2 	# Postgis
pkg install -y python3			# Python3 
pkg install -y gdal                     # Gdal       
pkg install -y py37-gdal-3.1.0   
pkg install -y node 			# Node.js
pkg install -y grass7-7.8.3		# Grass

pkg install -y nginx			# Ngnix

rehash  				# make tsch aware of the new application
sysrc nginx_enable="YES"		# enable nginx at boot
/usr/local/etc/rc.d/nginx start 	# start nginx
			



pkg install -y git			# Git
rehash                                  # Make system aware of installed git

                                        # Fetching WebODM
git clone --depth 1 https://github.com/OpenDroneMap/WebODM


					# Generate cfg file.
touch WebODM/webodm/local_settings.py
cat > ./WebODM/webodm/local_settings.py<<EOF
DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'webodm_dev',
        'USER': 'postgres',
        'PASSWORD': 'postgres',
        'HOST': 'localhost',
        'PORT': '5432',

    }
}
EOF


pkg install -y redis				# install redis
sysrc redis_enable="YES"			# enable redis at boot
/usr/local/etc/rc.d/redis start			# start redis

						#redis-server /usr/local/etc/redis.conf    	# start redis broker


pkg install -y py37-pip				# install pip
rehash						# make system aware of pip

echo "Installing numpy will take a while"
pip install numpy                               # numphy used by requirements.txt



pip install -r ./WebODM/requirements.txt	# install WebODM requirements

pkg install -y npm				# Node Package Manager
npm install -g webpack
npm install -g webpack-cli

# npm install --package--lock



webpack --mode production

tzsetup			# set local timezone

python3 ./WebODM/manage.py collectstatic --noinput





chmod +x ./WebODM/start.sh 			# Make executable


# https://www.grymoire.com/Unix/Sed.htmlx

	#		
	# replacing python with python3 in ./WebODM/starts.sh
	# fixing the shebang

if ! ( -f ./WebODM/start.sh.bak) cp ./WebODM/start.sh ./WebODM/start.sh.bak    	# make a copy if runned first timne
cat ./WebODM/start.sh.bak | sed s:python:python3:g > ./WebODM/start.sh.new     	# using the copy and replace with python3
cat ./WebODM/start.sh.new | sed 's:#\!\/bin\/bash:#\!\/bin\/sh:' > ./WebODM/start.sh	# finally replace the shebang (to #!/bin/sh ) and save to start.sh


 ./WebODM/start.sh --no-gunicorn 





# greppa ip nummer nedan
# ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'

# /var/db/postgres/data11/hb_pga.conf


echo *** end **

My first problem is missing “raster”.

Applying app.0001_initial…Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py”, line 83, in _execute
return self.cursor.execute(sql)
psycopg2.errors.UndefinedObject: type “raster” does not exist
LINE 1: …d_control_points" varchar(100) NULL, “orthophoto” raster NUL…

This would also make the GRASS engine to fail and so on.

Anyone with some skills of Feebsd and this postgres raster problem ?

1 Like