frappe / frappe_docker

Docker images for production and development setups of the Frappe framework and ERPNext
MIT License
1.52k stars 1.4k forks source link

change the name of site-name frappe once it has been run #1432

Open hieuNV0871 opened 4 months ago

hieuNV0871 commented 4 months ago

i have docker images for custom frappe and i pull and run it by docker compose so i want rename site name of frappe from example.com to abc.com

what do i need for all actions (about frappe, nginx, ...)

hieuNV0871 commented 4 months ago

i try: backup old site bench new-site restore data to new site bench setup nginx

but i got internal server error

letajmal commented 4 months ago

Share more details about your setup

hieuNV0871 commented 4 months ago

Share more details about your setup

https://discuss.frappe.io/t/overview-frappe-docker-self-hosting/110132

i follow this and i want update custom code but when i stop container and run again with new image (with change and new tag) (i do not change any thing in compose file). all data lost

bangonkali commented 3 months ago

Hi @letajmal , I am in a similar bind. The current site name is just frontend. I want it to be my domain name ie https://mydomain.com instead. The side-effect today seems to be that emails received by users redirect to a broken url http://frontend/app/item/{id} instead of https://mydomain.com/app/item/{id}. image

At the current situation the setup already has a lot of production data and I want to change just this. Is there a possible reconfiguration of maybe just a text file, a minimum reconfig such that all references to site name becomes https://mydomain.com instead of http://frontend/app/item/{id}? Do I really need to rename the folder/directory under sites or can it just be a file that needs to be edited?

bangonkali commented 3 months ago

Okay as it turns out the information from here https://github.com/frappe/frappe_docker/issues/1264#issuecomment-1788083887 works to fix the issue regarding email. I now have site_config.json host_name: https://mydomain.com and email support seems to work very well now. I did not add 443 port on the end of the host_name because I assumed the default for https is 443.

My next problem now is socket.io which is discussed https://github.com/frappe/frappe_docker/wiki/Frequently-Asked-Questions#socketio-does-not-work-with-pwdyml.

Is it at all possible to change the subdomain of socket.io server and propagate the change to the client? I am unable to change the socket_host_name just for the socket.io itself. After checking socketio_port on docker compose --project-name erpnext-prod exec backend bench --site all show-config -f json the socketio_port is 9000. Our configuration is behind cloudflare tunnel with websockets enabled on Cloudflare Network Configuration and we can only expose one port at a time per domain. It would be interesting to know if say , I can tunnel port 9000 as configured for the site for socketio to https://websocket.mydomain.com. Or is it the case that wss://mydomain.com is also already hosting the socket.io server despite being configured as port 9000 on the site_config.json?

At the moment I am getting this error behind cloudflare:

image

letajmal commented 3 months ago

@bangonkali change your frappe site name to mydomain.com as discussed here

In case of production setup make following changes to pwd.yml: Set environment variable FRAPPE_SITE_NAME_HEADER under frontend service to $$host. Change site name from frontend to erp.example.com under create-site service command. Any domain name that resolves to the server IP can be used here.

If you cloudflare domain name matches your frappe site name, it should work

bangonkali commented 3 months ago

Hi @letajmal , if i set FRAPPE_SITE_NAME_HEADER=$$host my site would be unreachable. If I set it to frontend, which is the default, it works. Do i have to change the site name currently frontend under sites folder to be the same as the value on FRAPPE_SITE_NAME_HEADER for this to work?

letajmal commented 3 months ago

@bangonkali create a new site with mydomain.com , set FRAPPE_SITE_NAME_HEADER=$$host

revant commented 1 month ago

Simple rename of site directory renames the site for frappe framework code.

The site_config.json will maintain original credentials to db. host_name key will need change.

Beyond that you'll need to make changes at load balancer, ingress, proxy level as per you infrastructure.

In case of pwd.yml site named frontend is created. Internally all other services from same ctr network can access it by frontend:8080. It is set to default site so it's served over any host or ip on :8080 port.