mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-10 09:32:32 +08:00
testing local build
This commit is contained in:
parent
551ba56711
commit
faef688146
7 changed files with 35 additions and 262 deletions
|
@ -57,7 +57,7 @@
|
|||
3. (optional) Prepare DNS - Set a wildcard subdomain in your DNS for Netmaker, e.g. *.netmaker.example.com
|
||||
4. Run the script:
|
||||
|
||||
`sudo wget -qO /root/nm-quick-interactive.sh https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/nm-quick-interactive.sh && sudo chmod +x /root/nm-quick-interactive.sh && sudo /root/nm-quick-interactive.sh`
|
||||
`sudo wget -qO /root/nm-quick.sh https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/nm-quick.sh && sudo chmod +x /root/nm-quick.sh && sudo /root/nm-quick.sh`
|
||||
|
||||
This script gives you the option to deploy the Community or Enterprise version of Netmaker. If deploying Enterprise, you get a free account with a 50 node limit by default. It also gives you the option to use your own domain (recommended) or an auto-generated domain.
|
||||
|
||||
|
|
|
@ -1,133 +0,0 @@
|
|||
version: "3.4"
|
||||
|
||||
services:
|
||||
netmaker:
|
||||
container_name: netmaker
|
||||
image: gravitl/netmaker:v0.18.0-ee
|
||||
restart: always
|
||||
volumes:
|
||||
- dnsconfig:/root/config/dnsconfig
|
||||
- sqldata:/root/data
|
||||
environment:
|
||||
BROKER_NAME: "broker.NETMAKER_BASE_DOMAIN"
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN"
|
||||
STUN_DOMAIN: "stun.NETMAKER_BASE_DOMAIN"
|
||||
SERVER_HOST: "SERVER_PUBLIC_IP"
|
||||
SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
|
||||
COREDNS_ADDR: "SERVER_PUBLIC_IP"
|
||||
DNS_MODE: "on"
|
||||
SERVER_HTTP_HOST: "api.NETMAKER_BASE_DOMAIN"
|
||||
API_PORT: "8081"
|
||||
MASTER_KEY: "REPLACE_MASTER_KEY"
|
||||
CORS_ALLOWED_ORIGIN: "*"
|
||||
DISPLAY_KEYS: "on"
|
||||
DATABASE: "sqlite"
|
||||
NODE_ID: "netmaker-server-1"
|
||||
MQ_HOST: "mq"
|
||||
MQ_PORT: "443"
|
||||
MQ_SERVER_PORT: "1883"
|
||||
MQ_USERNAME: "REPLACE_MQ_USERNAME"
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
|
||||
STUN_PORT: "3478"
|
||||
VERBOSITY: "1"
|
||||
METRICS_EXPORTER: "on"
|
||||
LICENSE_KEY: "YOUR_LICENSE_KEY"
|
||||
NETMAKER_ACCOUNT_ID: "YOUR_ACCOUNT_ID"
|
||||
ports:
|
||||
- "3478:3478/udp"
|
||||
netmaker-ui:
|
||||
container_name: netmaker-ui
|
||||
image: gravitl/netmaker-ui:v0.18.0
|
||||
depends_on:
|
||||
- netmaker
|
||||
links:
|
||||
- "netmaker:api"
|
||||
restart: always
|
||||
environment:
|
||||
BACKEND_URL: "https://api.NETMAKER_BASE_DOMAIN"
|
||||
caddy:
|
||||
image: caddy:2.6.2
|
||||
container_name: caddy
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /root/Caddyfile:/etc/caddy/Caddyfile
|
||||
- caddy_data:/data
|
||||
- caddy_conf:/config
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
coredns:
|
||||
container_name: coredns
|
||||
image: coredns/coredns
|
||||
command: -conf /root/dnsconfig/Corefile
|
||||
depends_on:
|
||||
- netmaker
|
||||
restart: always
|
||||
volumes:
|
||||
- dnsconfig:/root/dnsconfig
|
||||
mq:
|
||||
container_name: mq
|
||||
image: eclipse-mosquitto:2.0.15-openssl
|
||||
depends_on:
|
||||
- netmaker
|
||||
restart: unless-stopped
|
||||
command: ["/mosquitto/config/wait.sh"]
|
||||
environment:
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
|
||||
MQ_USERNAME: "REPLACE_MQ_USERNAME"
|
||||
volumes:
|
||||
- /root/mosquitto.conf:/mosquitto/config/mosquitto.conf
|
||||
- /root/wait.sh:/mosquitto/config/wait.sh
|
||||
- mosquitto_logs:/mosquitto/log
|
||||
ports:
|
||||
- "1883:1883"
|
||||
- "8883:8883"
|
||||
prometheus:
|
||||
container_name: prometheus
|
||||
image: gravitl/netmaker-prometheus:latest
|
||||
environment:
|
||||
NETMAKER_METRICS_TARGET: "netmaker-exporter.NETMAKER_BASE_DOMAIN"
|
||||
LICENSE_KEY: "YOUR_LICENSE_KEY"
|
||||
restart: always
|
||||
volumes:
|
||||
- prometheus_data:/prometheus
|
||||
depends_on:
|
||||
- netmaker
|
||||
grafana:
|
||||
container_name: grafana
|
||||
image: gravitl/netmaker-grafana:latest
|
||||
environment:
|
||||
PROMETHEUS_HOST: "prometheus.NETMAKER_BASE_DOMAIN"
|
||||
NETMAKER_METRICS_TARGET: "netmaker-exporter.NETMAKER_BASE_DOMAIN"
|
||||
LICENSE_KEY: "YOUR_LICENSE_KEY"
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
restart: always
|
||||
links:
|
||||
- prometheus
|
||||
depends_on:
|
||||
- prometheus
|
||||
- netmaker
|
||||
netmaker-exporter:
|
||||
container_name: netmaker-exporter
|
||||
image: gravitl/netmaker-exporter:latest
|
||||
restart: always
|
||||
depends_on:
|
||||
- netmaker
|
||||
environment:
|
||||
MQ_HOST: "mq"
|
||||
MQ_PORT: "443"
|
||||
MQ_SERVER_PORT: "1883"
|
||||
PROMETHEUS: "on"
|
||||
VERBOSITY: "1"
|
||||
API_PORT: "8085"
|
||||
LICENSE_KEY: "YOUR_LICENSE_KEY"
|
||||
PROMETHEUS_HOST: https://prometheus.NETMAKER_BASE_DOMAIN
|
||||
volumes:
|
||||
caddy_data: {}
|
||||
caddy_conf: {}
|
||||
sqldata: {}
|
||||
dnsconfig: {}
|
||||
mosquitto_logs: {}
|
||||
prometheus_data: {}
|
||||
grafana_data: {}
|
|
@ -3,7 +3,7 @@ version: "3.4"
|
|||
services:
|
||||
netmaker:
|
||||
container_name: netmaker
|
||||
image: gravitl/netmaker:v0.18.0-ee
|
||||
image: gravitl/netmaker:REPLACE_SERVER_IMAGE_TAG
|
||||
restart: always
|
||||
volumes:
|
||||
- dnsconfig:/root/config/dnsconfig
|
||||
|
@ -37,7 +37,7 @@ services:
|
|||
- "3478:3478/udp"
|
||||
netmaker-ui:
|
||||
container_name: netmaker-ui
|
||||
image: gravitl/netmaker-ui:v0.18.0
|
||||
image: gravitl/netmaker-ui:REPLACE_UI_IMAGE_TAG
|
||||
depends_on:
|
||||
- netmaker
|
||||
links:
|
||||
|
|
|
@ -3,7 +3,7 @@ version: "3.4"
|
|||
services:
|
||||
netmaker: # The Primary Server for running Netmaker
|
||||
container_name: netmaker
|
||||
image: gravitl/netmaker:v0.18.0
|
||||
image: gravitl/netmaker:REPLACE_SERVER_IMAGE_TAG
|
||||
restart: always
|
||||
volumes: # Volume mounts necessary for sql, coredns, and mqtt
|
||||
- dnsconfig:/root/config/dnsconfig
|
||||
|
@ -44,7 +44,7 @@ services:
|
|||
- "3478:3478/udp" # the stun port
|
||||
netmaker-ui: # The Netmaker UI Component
|
||||
container_name: netmaker-ui
|
||||
image: gravitl/netmaker-ui:v0.18.0
|
||||
image: gravitl/netmaker-ui:REPLACE_UI_IMAGE_TAG
|
||||
depends_on:
|
||||
- netmaker
|
||||
links:
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
version: "3.4"
|
||||
|
||||
services:
|
||||
netmaker:
|
||||
container_name: netmaker
|
||||
image: gravitl/netmaker:REPLACE_SERVER_TAG
|
||||
restart: always
|
||||
volumes:
|
||||
- dnsconfig:/root/config/dnsconfig
|
||||
- sqldata:/root/data
|
||||
environment:
|
||||
BROKER_NAME: "broker.NETMAKER_BASE_DOMAIN"
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN"
|
||||
STUN_DOMAIN: "stun.NETMAKER_BASE_DOMAIN"
|
||||
SERVER_HOST: "SERVER_PUBLIC_IP"
|
||||
SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
|
||||
COREDNS_ADDR: "SERVER_PUBLIC_IP"
|
||||
DNS_MODE: "on"
|
||||
SERVER_HTTP_HOST: "api.NETMAKER_BASE_DOMAIN"
|
||||
API_PORT: "8081"
|
||||
MASTER_KEY: "REPLACE_MASTER_KEY"
|
||||
CORS_ALLOWED_ORIGIN: "*"
|
||||
DISPLAY_KEYS: "on"
|
||||
DATABASE: "sqlite"
|
||||
NODE_ID: "netmaker-server-1"
|
||||
MQ_HOST: "mq"
|
||||
MQ_PORT: "443"
|
||||
MQ_SERVER_PORT: "1883"
|
||||
STUN_PORT: "3478"
|
||||
VERBOSITY: "1"
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
|
||||
MQ_USERNAME: "REPLACE_MQ_USERNAME"
|
||||
ports:
|
||||
- "3478:3478/udp"
|
||||
netmaker-ui:
|
||||
container_name: netmaker-ui
|
||||
image: gravitl/netmaker-ui:REPLACE_UI_TAG
|
||||
depends_on:
|
||||
- netmaker
|
||||
links:
|
||||
- "netmaker:api"
|
||||
restart: always
|
||||
environment:
|
||||
BACKEND_URL: "https://api.NETMAKER_BASE_DOMAIN"
|
||||
caddy:
|
||||
image: caddy:2.6.2
|
||||
container_name: caddy
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /root/Caddyfile:/etc/caddy/Caddyfile
|
||||
- caddy_data:/data
|
||||
- caddy_conf:/config
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
coredns:
|
||||
container_name: coredns
|
||||
image: coredns/coredns
|
||||
command: -conf /root/dnsconfig/Corefile
|
||||
depends_on:
|
||||
- netmaker
|
||||
restart: always
|
||||
volumes:
|
||||
- dnsconfig:/root/dnsconfig
|
||||
mq:
|
||||
container_name: mq
|
||||
image: eclipse-mosquitto:2.0.15-openssl
|
||||
depends_on:
|
||||
- netmaker
|
||||
restart: unless-stopped
|
||||
command: ["/mosquitto/config/wait.sh"]
|
||||
environment:
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
|
||||
MQ_USERNAME: "REPLACE_MQ_USERNAME"
|
||||
volumes:
|
||||
- /root/mosquitto.conf:/mosquitto/config/mosquitto.conf
|
||||
- /root/wait.sh:/mosquitto/config/wait.sh
|
||||
- mosquitto_logs:/mosquitto/log
|
||||
volumes:
|
||||
caddy_data: {}
|
||||
caddy_conf: {}
|
||||
sqldata: {}
|
||||
dnsconfig: {}
|
||||
mosquitto_logs: {}
|
|
@ -3,7 +3,7 @@ version: "3.4"
|
|||
services:
|
||||
netmaker:
|
||||
container_name: netmaker
|
||||
image: gravitl/netmaker:v0.18.0
|
||||
image: gravitl/netmaker:REPLACE_SERVER_IMAGE_TAG
|
||||
restart: always
|
||||
volumes:
|
||||
- dnsconfig:/root/config/dnsconfig
|
||||
|
@ -34,7 +34,7 @@ services:
|
|||
- "3478:3478/udp"
|
||||
netmaker-ui:
|
||||
container_name: netmaker-ui
|
||||
image: gravitl/netmaker-ui:v0.18.0
|
||||
image: gravitl/netmaker-ui:REPLACE_UI_IMAGE_TAG
|
||||
depends_on:
|
||||
- netmaker
|
||||
links:
|
||||
|
|
|
@ -72,6 +72,7 @@ done
|
|||
|
||||
if [ -z "$BUILD_TYPE" ]; then
|
||||
BUILD_TYPE="version"
|
||||
BUILD_TAG=$LATEST
|
||||
fi
|
||||
|
||||
if [ -z "$BUILD_TAG" ] && [ "$BUILD_TYPE" = "version" ]; then
|
||||
|
@ -84,6 +85,8 @@ if [ -z "$BUILD_TAG" ] && [ ! -z "$BUILD_TYPE" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
IMAGE_TAG=$(sed 's/\//-/g' <<< "$BUILD_TAG")
|
||||
|
||||
if [ "$1" = "ce" ]; then
|
||||
INSTALL_TYPE="ce"
|
||||
elif [ "$1" = "ee" ]; then
|
||||
|
@ -111,10 +114,12 @@ if [ -z "$INSTALL_TYPE" ]; then
|
|||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
echo "-----------Build Options-----------------------------"
|
||||
echo " EE or CE: $INSTALL_TYPE";
|
||||
echo " Build Type: $BUILD_TYPE";
|
||||
echo " Build Tag: $BUILD_TAG";
|
||||
echo " Image Tag: $IMAGE_TAG";
|
||||
echo "-----------------------------------------------------"
|
||||
|
||||
print_logo
|
||||
|
||||
|
@ -164,40 +169,40 @@ echo "checking dependencies..."
|
|||
OS=$(uname)
|
||||
|
||||
if [ -f /etc/debian_version ]; then
|
||||
dependencies="wireguard wireguard-tools jq docker.io docker-compose"
|
||||
dependencies="git wireguard wireguard-tools jq docker.io docker-compose"
|
||||
update_cmd='apt update'
|
||||
install_cmd='apt-get install -y'
|
||||
elif [ -f /etc/alpine-release ]; then
|
||||
dependencies="wireguard jq docker.io docker-compose"
|
||||
dependencies="git wireguard jq docker.io docker-compose"
|
||||
update_cmd='apk update'
|
||||
install_cmd='apk --update add'
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
dependencies="wireguard jq docker.io docker-compose"
|
||||
dependencies="git wireguard jq docker.io docker-compose"
|
||||
update_cmd='yum update'
|
||||
install_cmd='yum install -y'
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
dependencies="wireguard jq docker.io docker-compose"
|
||||
dependencies="git wireguard jq docker.io docker-compose"
|
||||
update_cmd='dnf update'
|
||||
install_cmd='dnf install -y'
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
dependencies="wireguard jq docker.io docker-compose"
|
||||
dependencies="git wireguard jq docker.io docker-compose"
|
||||
update_cmd='yum update'
|
||||
install_cmd='yum install -y'
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
dependecies="wireguard-tools jq docker.io docker-compose"
|
||||
dependecies="git wireguard-tools jq docker.io docker-compose"
|
||||
update_cmd='pacman -Sy'
|
||||
install_cmd='pacman -S --noconfirm'
|
||||
elif [ "${OS}" = "FreeBSD" ]; then
|
||||
dependencies="wireguard wget jq docker.io docker-compose"
|
||||
dependencies="git wireguard wget jq docker.io docker-compose"
|
||||
update_cmd='pkg update'
|
||||
install_cmd='pkg install -y'
|
||||
elif [ -f /etc/turris-version ]; then
|
||||
dependencies="wireguard-tools bash jq docker.io docker-compose"
|
||||
dependencies="git wireguard-tools bash jq docker.io docker-compose"
|
||||
OS="TurrisOS"
|
||||
update_cmd='opkg update'
|
||||
install_cmd='opkg install'
|
||||
elif [ -f /etc/openwrt_release ]; then
|
||||
dependencies="wireguard-tools bash jq docker.io docker-compose"
|
||||
dependencies="git wireguard-tools bash jq docker.io docker-compose"
|
||||
OS="OpenWRT"
|
||||
update_cmd='opkg update'
|
||||
install_cmd='opkg install'
|
||||
|
@ -455,6 +460,19 @@ if [ "$INSTALL_TYPE" = "ee" ]; then
|
|||
sed -i "s~YOUR_LICENSE_KEY~$LICENSE_KEY~g" /root/docker-compose.yml
|
||||
sed -i "s/YOUR_ACCOUNT_ID/$ACCOUNT_ID/g" /root/docker-compose.yml
|
||||
fi
|
||||
|
||||
if [ "$BUILD_TYPE" = "version" ] && [ "$INSTALL_TYPE" = "ee" ]; then
|
||||
sed -i "s/REPLACE_SERVER_IMAGE_TAG/$IMAGE_TAG-ee/g" /root/docker-compose.yml
|
||||
else
|
||||
sed -i "s/REPLACE_SERVER_IMAGE_TAG/$IMAGE_TAG/g" /root/docker-compose.yml
|
||||
fi
|
||||
|
||||
if [ "$BUILD_TYPE" = "local" ]; then
|
||||
sed -i "s/REPLACE_UI_IMAGE_TAG/$LATEST/g" /root/docker-compose.yml
|
||||
else
|
||||
sed -i "s/REPLACE_UI_IMAGE_TAG/$IMAGE_TAG/g" /root/docker-compose.yml
|
||||
fi
|
||||
|
||||
echo "Starting containers..."
|
||||
|
||||
docker-compose -f /root/docker-compose.yml up -d
|
||||
|
@ -504,34 +522,6 @@ ACCESS_TOKEN=$(jq -r '.accessstring' <<< ${curlresponse})
|
|||
|
||||
wait_seconds 3
|
||||
|
||||
echo "Configuring netmaker server as ingress gateway"
|
||||
|
||||
for i in 1 2 3 4 5 6
|
||||
do
|
||||
echo " waiting for server node to become available"
|
||||
wait_seconds 10
|
||||
curlresponse=$(curl -s -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/netmaker)
|
||||
SERVER_ID=$(jq -r '.[0].id' <<< ${curlresponse})
|
||||
echo " Server ID: $SERVER_ID"
|
||||
if [ $SERVER_ID == "null" ]; then
|
||||
SERVER_ID=""
|
||||
fi
|
||||
if [[ "$i" -ge "6" && -z "$SERVER_ID" ]]; then
|
||||
echo " Netmaker is having issues configuring itself, please investigate (docker logs netmaker)"
|
||||
echo " Exiting..."
|
||||
exit 1
|
||||
elif [ -z "$SERVER_ID" ]; then
|
||||
echo " server node not yet configured, retrying..."
|
||||
elif [[ ! -z "$SERVER_ID" ]]; then
|
||||
echo " server node is now availble, continuing"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [[ ! -z "$SERVER_ID" ]]; then
|
||||
curl -o /dev/null -s -X POST -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/netmaker/$SERVER_ID/createingress
|
||||
fi
|
||||
)}
|
||||
|
||||
set +e
|
||||
|
|
Loading…
Reference in a new issue