29 lines
		
	
	
	
		
			922 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
		
		
			
		
	
	
			29 lines
		
	
	
	
		
			922 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
|  | #!/bin/sh
 | ||
|  | 
 | ||
|  | # SPDX-License-Identifier: AGPL-3.0-or-later | ||
|  | # Copyright (c) 2024 Interstellar Development | ||
|  | 
 | ||
|  | APP=thread-sphere | ||
|  | DOMAIN=threadsphere.com | ||
|  | PORT=5001 | ||
|  | DNS="
 | ||
|  | zone \"$DOMAIN\" { | ||
|  |     type master; | ||
|  |     file \"/etc/bind/db.$DOMAIN\"; | ||
|  | };"
 | ||
|  | 
 | ||
|  | docker build -t $APP . | ||
|  | cd dist | ||
|  | openssl genrsa -out /etc/ssl/private/$APP.key 2048 | ||
|  | openssl req -new -key /etc/ssl/private/$APP.key -out /etc/ssl/certs/$APP.csr -config openssl.cnf | ||
|  | openssl x509 -req -in /etc/ssl/certs/$APP.csr -CA /root/ca.crt -CAkey /root/ca.key -CAcreateserial -out /etc/ssl/certs/$APP.crt -extfile openssl.cnf -extensions req_ext -days 500 -sha256 | ||
|  | cp nginx.cnf /etc/nginx/sites-enabled/$APP | ||
|  | grep -qF "$DNS" /etc/bind/named.conf.local | ||
|  | if [ $? -eq 0 ]; then | ||
|  |     echo "$DNS" | tee -a /etc/bind/named.conf.local | ||
|  | else | ||
|  |     echo "Entry already exists in named.conf.local" | ||
|  | fi | ||
|  | cp zonefile.cnf /etc/bind/db.$DOMAIN | ||
|  | docker run -p $PORT:5000 --name $APP --restart always -d $APP |