mirror of
				https://github.com/gravitl/netmaker.git
				synced 2025-11-01 00:49:04 +08:00 
			
		
		
		
	use wait script to encrypt mq password
This commit is contained in:
		
							parent
							
								
									aa3820d2bf
								
							
						
					
					
						commit
						f19e3c31d0
					
				
					 3 changed files with 12 additions and 16 deletions
				
			
		|  | @ -70,11 +70,13 @@ services: | |||
|     depends_on: | ||||
|       - netmaker | ||||
|     restart: unless-stopped | ||||
|     command: ["/mosquitto/config/wait.sh"] | ||||
|     environment: | ||||
|       NETMAKER_SERVER_HOST: "https://api.NETMAKER_BASE_DOMAIN" | ||||
|       MQ_PASSWORD: "REPLACE_MQ_PASSWORD" | ||||
|       MQ_USERNAME: "REPLACE_MQ_USERNAME" | ||||
|     volumes: | ||||
|       - /root/mosquitto.conf:/mosquitto/config/mosquitto.conf | ||||
|       - /root/password.txt:/mosquitto/password.txt | ||||
|       - /root/wait.sh:/mosquitto/config/wait.sh | ||||
|       - mosquitto_logs:/mosquitto/log | ||||
| volumes: | ||||
|   caddy_data: {} | ||||
|  |  | |||
|  | @ -1,18 +1,13 @@ | |||
| #!/bin/ash | ||||
| 
 | ||||
| wait_for_netmaker() { | ||||
|   echo "SERVER: ${NETMAKER_SERVER_HOST}" | ||||
|   until curl --output /dev/null --silent --fail --head \ | ||||
|     --location "${NETMAKER_SERVER_HOST}/api/server/health"; do | ||||
|     echo "Waiting for netmaker server to startup" | ||||
|     sleep 1 | ||||
|   done | ||||
| encrypt_password() { | ||||
|   echo "${MQ_USERNAME}:${MQ_PASSWORD}" > /mosquitto/passwords.txt | ||||
|   mosquitto_passwd -U /mosquitto/passwords.txt | ||||
| } | ||||
| 
 | ||||
| main(){ | ||||
|  # wait for netmaker to startup | ||||
|  apk add curl | ||||
|  wait_for_netmaker | ||||
| 
 | ||||
|  encrypt_password | ||||
|  echo "Starting MQ..." | ||||
|  # Run the main container command. | ||||
|  /docker-entrypoint.sh | ||||
|  |  | |||
|  | @ -191,8 +191,6 @@ MASTER_KEY=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 30 ; echo '') | |||
| MQ_USERNAME="netmaker" | ||||
| MQ_PASSWORD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 30 ; echo '') | ||||
| DOMAIN_TYPE="" | ||||
| echo "${MQ_USERNAME}:${MQ_PASSWORD}" > /root/password.txt | ||||
| mosquitto_passwd -U /root/password.txt | ||||
| echo "-----------------------------------------------------" | ||||
| echo "Would you like to use your own domain for netmaker, or an auto-generated domain?" | ||||
| echo "To use your own domain, add a Wildcard DNS record (e.x: *.netmaker.example.com) pointing to $SERVER_PUBLIC_IP" | ||||
|  | @ -304,7 +302,8 @@ if [ "$INSTALL_TYPE" = "ee" ]; then | |||
| fi | ||||
| 
 | ||||
| wget -O /root/docker-compose.yml $COMPOSE_URL && wget -O /root/mosquitto.conf https://raw.githubusercontent.com/gravitl/netmaker/master/docker/mosquitto.conf && wget -O /root/Caddyfile $CADDY_URL | ||||
| 
 | ||||
| wget -q -O /root/wait.sh https://raw.githubusercontent.com/gravitl/netmaker/master/docker/wait.sh | ||||
| chmod +x /root/wait.sh | ||||
| mkdir -p /etc/netmaker | ||||
| 
 | ||||
| echo "Setting docker-compose and Caddyfile..." | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue