Guest User

Untitled

a guest
Dec 27th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | Fixit | 0 0
  1. For 3 months been trying to install botpress for production, my end result is a blank white page for the chat bot URL's.
  2. So using docker is the way to get everything working correctly, installing botpress without ssl and without postgress is extremely easy, but we want production not some bs.
  3. Info:
  4. https://github.com/botpress/botpress/discussions/12393
  5. https://github.com/botpress/botpress/discussions/12135
  6.  
  7. So install Nginx on another container or on the botpress container? Using Docker and Portainer
  8. Create 2 containers
  9. 1.
  10.  
  11. docker run -d \
  12. --name postgres \
  13. -p 5432:5432 \
  14. -v pgdata:/var/lib/postgresql/data \
  15. --restart=always \
  16. -e PGPORT=5432 \
  17. -e POSTGRES_DB=botpress_db \
  18. -e POSTGRES_PASSWORD=dbpw \
  19. -e POSTGRES_USER=postgres \
  20. postgres:11.2-alpine;
  21. And I use this for Botpress:
  22.  
  23. 2.
  24.  
  25. docker run -d \
  26. --name botpress \
  27. -p 3000:3000 \
  28. -v botpress_data:/botpress/data \
  29. --restart=always \
  30. -e EXTERNAL_URL="${hostName}" \
  31. -e DATABASE_URL=postgres://postgres:[email protected]:5432/botpress_db \
  32. -e BPFS_STORAGE=database \
  33. -e BP_ADMIN_EMAIL=admin \
  34. -e BP_ADMIN_PASSWORD=adminPassword \
  35. -e AUTO_MIGRATE=true \
  36. botpress/server:latest;
  37.  
  38. And for SSL we use a mix of NGINX and CertBot inside the vps where botpress is installed or on a new container?
  39.  
  40. NGINX:
  41.  
  42. events {
  43. worker_connections 1024;
  44. }
  45. http {
  46. upstream botpress-cluster {
  47. server localhost:3000;
  48. }
  49. server_tokens off;
  50. add_header X-Content-Type-Options nosniff;
  51. add_header X-XSS-Protection "1; mode=block";
  52. client_max_body_size 25M;
  53. proxy_cache_path /srv/nginx_cache levels=1:2 keys_zone=my_cache:10m max_size=10g
  54. inactive=60m use_temp_path=off;
  55. log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" '
  56. '\$status \$body_bytes_sent "\$http_referer" '
  57. '"\$http_user_agent" "\$http_x_forwarded_for"';
  58. access_log /access.log main;
  59. error_log /error.log;
  60. server {
  61. server_name ${hostName};
  62. # Enable caching of assets by NGINX to reduce load on the server
  63. location ~ .*/assets/.* {
  64. proxy_cache my_cache;
  65. proxy_ignore_headers Cache-Control;
  66. proxy_hide_header Cache-Control;
  67. proxy_hide_header Pragma;
  68. proxy_pass http://botpress-cluster;
  69. proxy_cache_valid any 30m;
  70. proxy_set_header Cache-Control max-age=30;
  71. add_header Cache-Control max-age=30;
  72. }
  73. location /socket.io/ {
  74. proxy_pass http://botpress-cluster/socket.io/;
  75. proxy_http_version 1.1;
  76. proxy_set_header Upgrade \$http_upgrade;
  77. proxy_set_header Connection "Upgrade";
  78. }
  79. location / {
  80. proxy_pass http://botpress-cluster;
  81. }}}
Advertisement
Add Comment
Please, Sign In to add comment