SFSQL Daemon
- Docker
- Run the SFSQL daemon
docker run -d -p 8080:8080 --name sfsqld --add-host=host.docker.internal:host-gateway registry.xornet.com/sfsql/sfsqld:latest -dbhost host.docker.internal -dbuser your_db_user_name -dbpass your_db_user_password -dbname your_db_name -licensekey your_sfsql_license_key
The SFSQL daemon can read it's parameters from both Environment Variables and Application startup Parameters.
Application startup Parameters override their equivalent ENV Vars.
Parameters:App Parm ENV Var Description -dbhost SF_DBHOST MySQL host
The ip address where MySQL is running.
Specify 'host.docker.internal' if MySQL is running on the same host as SFSQL.
NOTE: MySQL must be reachable by docker. If MySQL is listening on the hosts 127.0.0.1 for instance, this internal network is invisible to Docker. An easy solution is to have MySQL listen on 0.0.0.0 (of course firewalling it appropriately as well).
Specify the ip address of MySQL if its running within your local secure network.-dbport SF_DBPORT MySQL port (default: 3306) -dbname SF_DBNAME MySQL database name -dbuser SF_DBUSER MySQL username -dbpass SF_DBPASS MySQL password -licensekey SF_LICENSEKEY SFSQL license Key -apihkey SF_APIHKEY API Endpoint Access Key
Set your own key which must be passed with API requests via the HTTP Request Header x‑sfsql‑apikey or via the SFSQL CLI via it's -apikey parm.
NOTE: an apikey by itself will not secure your SFSQL daemon for use over insecure/public networks.
To secure SFSQL in such a scenario, use a https proxy (e.g. nginx) in front of it.the below parameters are Docker parameters -p SFSQL API host and port
The ip:port at which the SFSQL daemon will listen for connections.
NOTE: although the listen port (on the left side of colon) can be any port you want, the destination port in the docker container must be specified as 8080.
Example: 8080:8080Listen at port 8080 on all ip addresses on Docker host and forward to port 8080 within the SFSQL docker container.
Example: 127.0.0.1:9000:8080Listen at port 9000 on ip 127.0.0.1 on Docker host and forward to port 8080 within the SFSQL docker container.-v Share a host directory with SFSQL
Needed if you wish to include json files within SFSQL json files by reference.
The '#include' subcommand can point to this directory on your Docker host.
Use -v multiple times to specify multiple shares.
Example: -v /var/jsonFiles:/var/jsonFiles -v /var/jsonFiles2:/var/jsonFiles2
see #include under #modify Command for full example--name The name given to the Docker container.
This name functions as a convenient identifier vs a Docker randomly-generated container name (when this parameter is not defined).
Example use when the defined name is 'sfsqld' and we want to stop the SFSQL server:docker stop sfsqld-d Run the Docker container detached (in background) and return to command prompt --add-host Used to map the domain name 'host.docker.internal' to the ip address of the Docker host.
This allows the the SFSQL Daemon to reach the MySQL Daemon when both are on the same Docker host without having to know that ip.
NOTE: this parameter is not needed if your MySQL Daemon is running at a specific ip which you also specified via the -dbhost parameter (e.g. -dbhost 192.168.1.10)
- Run the SFSQL daemon