Unable to get the test site served locally
See original GitHub issueI am testing locally in the compose environment. The site name I am using is site1.localhost. When I load the url http://site1.localhost:8000 website is not rendered in the browser.
Compose configuration
My compose file configuraiton
version: "3.7"
networks:
erpnext-net:
name: ${NETWORK_NAME:-erpnext-net}
driver: bridge
ipam:
driver: default
config:
- subnet: ${SUBNET:-192.168.210.0/24}
volumes:
mariadb-data:
assets-data:
erpnext-data:
redis-cache-data:
redis-queue-data:
redis-socketio-data:
portainer-data:
services:
erpnext-nginx:
image: frappe/erpnext-nginx:${ERPNEXT_VERSION:-v12.5.2}
env_file: .env
restart: on-failure
ports:
- "8000:80"
environment:
- FRAPPE_PY=erpnext
- FRAPPE_PY_PORT=8000
- FRAPPE_SOCKETIO=erpnext-socketio
- SOCKETIO_PORT=9000
depends_on:
- erpnext
- erpnext-socketio
- erpnext-worker-default
- erpnext-worker-long
- erpnext-worker-short
links:
- erpnext
- erpnext-socketio
- erpnext-worker-default
- erpnext-worker-long
- erpnext-worker-short
volumes:
- assets-data:/assets
- erpnext-data:/var/www/html/sites
networks:
- erpnext-net
erpnext:
image: frappe/erpnext-worker:${ERPNEXT_VERSION:-v12.5.2}
env_file: .env
restart: on-failure
volumes:
- erpnext-data:/home/frappe/frappe-bench/sites
- assets-data:/home/frappe/frappe-bench/sites/assets
links:
- redis-cache
- redis-queue
- redis-socketio
- mariadb
depends_on:
- mariadb
- redis-cache
- redis-queue
- redis-socketio
networks:
- erpnext-net
erpnext-socketio:
image: frappe/frappe-socketio:${FRAPPE_SOCKETIO_VERSION:-v12.4.1}
restart: on-failure
depends_on:
- redis-socketio
links:
- redis-socketio
volumes:
- erpnext-data:/home/frappe/frappe-bench/sites
networks:
- erpnext-net
erpnext-worker-default:
image: frappe/erpnext-worker:${ERPNEXT_VERSION:-v12.5.2}
restart: on-failure
command: worker
depends_on:
- redis-queue
- redis-cache
links:
- redis-queue
- redis-cache
volumes:
- erpnext-data:/home/frappe/frappe-bench/sites
networks:
- erpnext-net
erpnext-worker-short:
image: frappe/erpnext-worker:${ERPNEXT_VERSION:-v12.5.2}
restart: on-failure
command: worker
environment:
- WORKER_TYPE=short
depends_on:
- redis-queue
- redis-cache
links:
- redis-queue
- redis-cache
volumes:
- erpnext-data:/home/frappe/frappe-bench/sites
networks:
- erpnext-net
erpnext-worker-long:
image: frappe/erpnext-worker:${ERPNEXT_VERSION:-v12.5.2}
restart: on-failure
command: worker
environment:
- WORKER_TYPE=long
depends_on:
- redis-queue
- redis-cache
links:
- redis-queue
- redis-cache
volumes:
- erpnext-data:/home/frappe/frappe-bench/sites
networks:
- erpnext-net
erpnext-schedule:
image: frappe/erpnext-worker:${ERPNEXT_VERSION:-v12.5.2}
restart: on-failure
command: schedule
depends_on:
- redis-queue
- redis-cache
links:
- redis-queue
- redis-cache
volumes:
- erpnext-data:/home/frappe/frappe-bench/sites
networks:
- erpnext-net
# Commandline client https://mariadb.com/kb/en/mysql-command-line-client/
mariadb:
image: mariadb:10.4
env_file: .env
restart: on-failure
volumes:
- ${PWD}/mariadb:/etc/mysql/conf.d
- mariadb-data:/var/lib/mysql
networks:
- erpnext-net
redis-cache:
image: redis:5-alpine
restart: on-failure
volumes:
- redis-cache-data:/data
networks:
- erpnext-net
redis-queue:
image: redis:5-alpine
restart: on-failure
volumes:
- redis-queue-data:/data
networks:
- erpnext-net
redis-socketio:
image: redis:5-alpine
restart: on-failure
volumes:
- redis-socketio-data:/data
networks:
- erpnext-net
portainer:
image: portainer/portainer
restart: always
ports:
- "9000:9000"
command: -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer-data:/data
networks:
- erpnext-net
.env I am using for this testing
# Infrastructure
NETWORK_NAME=erpnext_net
SUBNET=192.168.210.0/24
# MariaDB credentials
MYSQL_USER=root
MYSQL_ROOT_PASSWORD=******
# Image versions
ERPNEXT_VERSION=v12.5.2
FRAPPE_SOCKETIO_VERSION=v12.4.1
# ERPNext configuration
SITE_NAME=site1.localhost
DB_ROOT_USER=root
ADMIN_PASSWORD=*****
MARIADB_HOST=mariadb
INSTALL_APPS=erpnext
FORCE=1
RUN_AS_ROOT=1
REDIS_CACHE=redis-cache:6379
REDIS_QUEUE=redis-queue:6379
REDIS_SOCKETIO=redis-socketio:6379
SOCKETIO_PORT=9000
AUTO_MIGRATE=1
Logs
- After all the containers are launched, I run the following command in the container erpnext. I use portainer UI to connect to the container and run the command. I can see the site created with frappe and erpnext installed.
root@2bf3db10997d:/home/frappe/frappe-bench/sites# docker-entrypoint.sh new
Created user _6caefa6809cd585f
Created database _6caefa6809cd585f
Granted privileges to user _6caefa6809cd585f and database _6caefa6809cd585f
Starting database import...
Imported from database /home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/framework_mariadb.sql
- common_site_config.json
{
"db_host": "mariadb",
"redis_cache": "redis://redis-cache:6379",
"redis_queue": "redis://redis-queue:6379",
"redis_socketio": "redis://redis-socketio:6379",
"socketio_port": 9000
}
- Nginx logs
Waiting for frappe-python to be available on erpnext port 8000,
Waiting for frappe-python to be available on erpnext port 8000,
Waiting for frappe-python to be available on erpnext port 8000,
Frappe-python available on erpnext port 8000,
Waiting for frappe-socketio to be available on erpnext port 8000,
Frappe-socketio available on erpnext port 8000,
2020/04/05 06:03:31 [error] 30#30: *1 upstream prematurely closed connection while reading response header from upstream, client: 192.168.210.1, server: $http_host, request: "GET / HTTP/1.1", upstream: "http://192.168.210.12:8000/", host: "site1.localhost:8000",
192.168.210.1 - - [05/Apr/2020:06:03:31 +0000] "GET / HTTP/1.1" 502 5444 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0" "-",
2020/04/05 06:03:31 [error] 30#30: *1 upstream prematurely closed connection while reading response header from upstream, client: 192.168.210.1, server: $http_host, request: "GET /favicon.ico HTTP/1.1", upstream: "http://192.168.210.12:8000/favicon.ico", host: "site1.localhost:8000",
192.168.210.1 - - [05/Apr/2020:06:03:31 +0000] "GET /favicon.ico HTTP/1.1" 502 5444 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0" "-",
- Processes running in the erpnext container
root@2bf3db10997d:/home/frappe/frappe-bench/sites/site1.localhost# ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 15 0.3 0.4 105552 66456 ? S 06:27 0:01 /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/e
root 18 0.0 0.3 105552 55028 ? S 06:27 0:00 /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/e
root 19 0.0 0.3 179284 55196 ? Sl 06:27 0:00 /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/e
- /home/frappe/frappe-bench/logs directory is empty. While
docker container logs erpnext
gave me the following
[2020-04-05 06:27:10 +0000] [15] [INFO] Starting gunicorn 19.10.0,
[2020-04-05 06:27:10 +0000] [15] [INFO] Listening at: http://0.0.0.0:8000 (15),
[2020-04-05 06:27:10 +0000] [15] [INFO] Using worker: gthread,
[2020-04-05 06:27:10 +0000] [18] [INFO] Booting worker with pid: 18,
[2020-04-05 06:27:10 +0000] [19] [INFO] Booting worker with pid: 19,
What am I missing here?
NOTE: I am using a volume for sites instead of bind mount as mentioned in the documentation. I don’t think that should be an issue here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
Access site served locally via Laravel Valet from Docker ...
(where api.test is the route that the API is being served on my localhost). Now I can hit api.test from within the Docker...
Read more >Find COVID-19 Tests
Find COVID-19 tests near you. Four ways to get tested: free community events or fixed test sites in NC, your medical provider or...
Read more >Test your web app locally, share changes with ... - Firebase
Test locally using firebase serve (not recommended) · From the root of your local project directory, run the following command: firebase serve --only...
Read more >How to get tested - Coronavirus COVID-19 Response
How to get at-home COVID-19 tests or find a testing site. How to get treatments if your test is positive. Testing at work....
Read more >Test your implementation - Google Ad Manager Help
Get your first ads up and running. Test your implementation. Test thoroughly to ensure a smooth launch for your site and campaign.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Agreed with you on production environments
I used the IP address to test locally from within the container. It helps to debug easily. After going through app.py, I find its sufficient to set the X-Frappe-Site-Name header to get the required site served. I tested the same with curl and I got the html response.
raised Pull request