* __docker-compose.yml__: docker config of three PXPortal services
* __conf__: dnsmasq and Nginx configuration
* __webapp__: sources of portal webpage
* __setup.sh__: script to setup PXPortal
```{#plantuml title="ECA-captive tree"}
@ -178,18 +179,19 @@ This repository contains:
+++ nginx.conf
++ docker-compose.yml
++ webapp
++ setup.sh
}
}
@endsalt
```
### 2. Run PXPortal
### 2. Running PXPortal for the first time
```bash
# Go into ECA-captive folder
cd ECA-captive
# Start all services in daemon mode
docker-compose up -d
./setup.sh
```
@ -208,62 +210,118 @@ docker-compose up -d
\clearpage
## SSH Config
## startup.sh
__startup.sh__ allows to:
Such as portal_service requires MAC addresses thanks to ARP command. But from a docker context, the command has to execute from the host in order to get MAC addresses from IP clients. This is _how to do this_ in few steps
* start PXPortal and perform some sanity checks
* setup ssh config and update environment varianles used by _docker-compose.yml_ file in order to execute arp commands from docker to host. (Required by portal_service to get MAC addresses from IP clients)
* check portal APIs are alive
### 1. Generate a docker SSH Public key
\clearpage
```bash
### On your HOST
# Launch portal_service shell
docker exec -it pxportal_service sh
### On portal_service shell
# Generate a SSH key to be able to send ARP command from docker to host
ssh-keygen
# Display and copy ssh public key
cat /root/.ssh/id_rsa.pub
### Exit portal_shell
# Edit HOST ssh authorized_keys
# and paste previous ssh public key of portal_service
vi ~/.ssh/authorized_keys
```
#/bin/sh
check_ping () {
echo "[-] ping $1"
echo $1 | xargs ping -c 1 > /dev/null
if [ "$?" -ne "0" ]
then
exit
fi
}
### 2. Update HOST IP address from portal_service
check_wget () {
echo "[-] wget $1"
echo $1 | xargs wget -q -O out > /dev/null
if [ "$?" -ne "0" ]
then
exit
fi
}
```bash
### On your HOST
# Launch portal_service shell
docker exec -it pxportal_service sh
### On portal_service shell
# Show all network interfaces available
ifconfig
# Keep in memory the inet addr of eth0
# HOST IP address from docker should be this IP address