diff --git a/studio/Dockerfile b/studio/Dockerfile index 3f21f08..39651f1 100644 --- a/studio/Dockerfile +++ b/studio/Dockerfile @@ -101,7 +101,7 @@ LABEL org.visualtext.nlp-studio="${NLP_STUDIO_COMMIT}" \ org.visualtext.built-at="${BUILD_DATE}" USER studio -EXPOSE 3001 +EXPOSE 3002 # Loopback only: nginx in front holds the password. See studio/deploy/INSTALL.md. -CMD ["python", "server/app.py", "--host", "127.0.0.1", "--port", "3001", "--dist", "dist"] +CMD ["python", "server/app.py", "--host", "127.0.0.1", "--port", "3002", "--dist", "dist"] diff --git a/studio/deploy/INSTALL.md b/studio/deploy/INSTALL.md index 3e0e0ba..e17fb26 100644 --- a/studio/deploy/INSTALL.md +++ b/studio/deploy/INSTALL.md @@ -5,7 +5,7 @@ second container beside the phase-1 editor, on the same host name. ``` nginx :443 - ├── /studio/ -> 127.0.0.1:3001 nlp-studio-app (this directory) + ├── /studio/ -> 127.0.0.1:3002 nlp-studio-app (this directory) │ the site's password, or GitHub sign-in (nginx-app-*.conf) └── / -> 127.0.0.1:3000 nlp-studio (stopgap/, the site's password) ``` @@ -60,19 +60,23 @@ starting anything it runs [smoke-test.sh](smoke-test.sh) on port 3998, under the restrictions as the live container: the sample analyzer must run to its known output, `system()` must be refused, and a run must fail to write outside `/tmp`. Then: - curl -s http://127.0.0.1:3001/api/health + curl -s http://127.0.0.1:3002/api/health # {"ok": true, "engine": "2.2.38", ..., "signIn": false, "github": false} Nothing is public yet: the container listens on loopback only. -The container runs with `network_mode: host`, so port 3001 has to be free before it +The container runs with `network_mode: host`, so port 3002 has to be free before it starts — nothing warns you if another service already answers there, and the health check above would be that service's answer rather than the studio's. Check first: - ss -ltnp | grep ':3001 ' || echo "3001 is free" + ss -ltnp | grep ':3002 ' || echo "3002 is free" If something else holds it, give the app another port in `docker-compose.yml` (the -`--port` in its `command`) and in the nginx `proxy_pass`; the two must agree. +`--port` in its `command`), `update.sh` (`HEALTH_URL`) and the nginx `proxy_pass`; they +must agree. + +It was 3001 until another account on this host started a service there, bound to every +interface. That service is not this deployment's to move, so the app moved to 3002. ### 3. Route /studio/ in nginx, behind the password — as root @@ -164,7 +168,7 @@ all the sign-in settings are there. ### 4. Restart the app with them — as visualtext docker compose -f /home/visualtext/nlp-studio/studio/deploy/docker-compose.yml up -d - curl -s http://127.0.0.1:3001/api/health + curl -s http://127.0.0.1:3002/api/health # ..., "signIn": true, "github": true} `"signIn": true` is the only answer to go on with. If the container is not running, its @@ -277,7 +281,7 @@ Logs go to `stopgap/logs/update-app-YYYY-MM.log`. docker image inspect nlp-studio:app --format '{{json .Config.Labels}}' docker logs --tail 50 nlp-studio-app - curl -s http://127.0.0.1:3001/api/health + curl -s http://127.0.0.1:3002/api/health ## Rolling back diff --git a/studio/deploy/docker-compose.yml b/studio/deploy/docker-compose.yml index bb1520d..4a56ad7 100644 --- a/studio/deploy/docker-compose.yml +++ b/studio/deploy/docker-compose.yml @@ -21,7 +21,7 @@ services: # ports other than 80, so a published port connects and then resets. The cost # is that this container is not network-isolated; see INSTALL.md. network_mode: host - command: ["python", "server/app.py", "--host", "127.0.0.1", "--port", "3001", "--dist", "dist", + command: ["python", "server/app.py", "--host", "127.0.0.1", "--port", "3002", "--dist", "dist", "--max-runs", "2", "--timeout", "10"] # GitHub sign-in (INSTALL.md, "Switching to GitHub sign-in"). The values come from diff --git a/studio/deploy/nginx-app-password.conf b/studio/deploy/nginx-app-password.conf index e9824b2..4e0d30a 100644 --- a/studio/deploy/nginx-app-password.conf +++ b/studio/deploy/nginx-app-password.conf @@ -1,4 +1,4 @@ -# studio.visualtext.org/studio/ -> the NLP Studio app (127.0.0.1:3001), behind the +# studio.visualtext.org/studio/ -> the NLP Studio app (127.0.0.1:3002), behind the # site's password. See INSTALL.md. # # Install as root beside the phase-1 file, in the same directory: @@ -24,7 +24,7 @@ location ^~ /studio/ { auth_basic_user_file /home/visualtext/.htpasswd-studio; # The trailing slash strips /studio/: the app serves itself at its root. - proxy_pass http://127.0.0.1:3001/; + proxy_pass http://127.0.0.1:3002/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/studio/deploy/nginx-app-signin.conf b/studio/deploy/nginx-app-signin.conf index e764a06..9eaf9e8 100644 --- a/studio/deploy/nginx-app-signin.conf +++ b/studio/deploy/nginx-app-signin.conf @@ -1,4 +1,4 @@ -# studio.visualtext.org/studio/ -> the NLP Studio app (127.0.0.1:3001), with GitHub +# studio.visualtext.org/studio/ -> the NLP Studio app (127.0.0.1:3002), with GitHub # sign-in instead of the site's password. See INSTALL.md, "Switching to GitHub sign-in". # # Install as root beside the phase-1 file, in the same directory: @@ -25,7 +25,7 @@ location = /studio { location ^~ /studio/ { # The trailing slash strips /studio/: the app serves itself at its root. - proxy_pass http://127.0.0.1:3001/; + proxy_pass http://127.0.0.1:3002/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/studio/deploy/update.sh b/studio/deploy/update.sh index 72fd66f..e5f3f2a 100755 --- a/studio/deploy/update.sh +++ b/studio/deploy/update.sh @@ -29,7 +29,7 @@ IMAGE_LIVE="nlp-studio:app" IMAGE_PREV="nlp-studio:app-previous" IMAGE_NEW="nlp-studio:app-candidate" SERVICE="nlp-studio-app" -HEALTH_URL="http://127.0.0.1:3001/api/health" +HEALTH_URL="http://127.0.0.1:3002/api/health" LOG_DIR="${NLP_STUDIO_LOG_DIR:-$REPO/stopgap/logs}" LOG_KEEP_DAYS=30