Troubleshooting Local Development Environment¶
Overview¶
In the local environment, there are a lot of options that specific by users and it affected the local development using Docker with docker-compose
.
We had meet a lot of issues, such like:
-
The users see a differents errors logging in different platform (E.g: macOS, Windows,...)
-
Users can't not have the permissions like the users has created files using in docker, such as
init
file types.
So below is some solved issues and the way to escape it. Its prevents the way we develop the features. And always, happy coding.
Ingestion and Solving Way¶
[SOLVED] Problem: The initation steps of local Postgres not executed¶
[Diagnose] It comes from maybe exists of the local of previous images.
[Escape] Refresh run with Docker with following steps:
[1] Check the .env
file is exists, and it align with .env.example.
Examples:
# Database Postgres
POSTGRES_INITDB_DATABASE=postgres
POSTGRES_INITDB_USER_NAME=postgres
POSTGRES_INITDB_USER_PASSWORD=postgres
SELF_MANAGED_USER_NAME=
SELF_MANAGED_USER_PASSWORD=
SELF_MANAGED_USER_TARGET_DATABASE=
SELF_MANAGED_USER_TARGET_SCHEMA=
...
Make sure you are following the setting well.
[2] Docker down all services and clean related resources, with shortcut of:
[3] Then re-run the docker run with force-recreate
argument.
In the console, you should see the LOG information about the created relevant info for user config in .env
setting of Docker.
E.g: Output should be
[4] Check by using curl
or using broswer:
E.g:
Check curl of:
It should have messages of {"message":"success!"}
Check the permision and updated related with Git
tracking.
Grant permissiosn with verbose options.
Check permissions:
Because this is tracking with Git, so must be:
[SOLVED] Problem: Network Issues by Port Blocking¶
Overview¶
Troubleshooting for network in local developement
-
Check services on port export. [5000, 5432]
-
Check firewall ports allow policy
This example comes from PowerSheel on Windows. For masOS, please search the same one.
The output
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\windows\system32> Get-Process -Id (Get-NetTCPConnection -LocalPort 5432).OwningProcess
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
406 13 2604 18944 0.05 7620 0 postgres
PS C:\windows\system32> Get-Process -Id (Get-NetTCPConnection -LocalPort 5433).OwningProcess
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
616 29 40416 44936 8.16 15244 1 com.docker.backend
125 9 1296 6560 0.03 10792 1 wslhost
PS C:\windows\system32> Get-Process -Id (Get-NetTCPConnection -LocalPort 5432).OwningProcess
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
616 29 40044 43520 9.27 15244 1 com.docker.backend
406 13 2604 18944 0.08 7620 0 postgres
PS C:\windows\system32>
Check images
Inspect default network
Check network
After moving to WSL2, VmMem seems to be constantly pegging my CPU. Please see attached screenshots.¶
Restart the machine after
Anything I can do to help your team troubleshoot?
Relevant details:
Ubuntu 18.04 and Debian on WSL2, but none are running anything at the moment. Windows insider build 18917.1000 on Macbook Air (8 GB, 4 proc).
https://github.com/microsoft/WSL/issues/4166
Another thing I notice is that vmmem won't actually go away until I issue another wsl --shutdown after quitting PowerToys.
Steps:
Quit Docker Desktop from task tray from cmd.exe: wsl --shutdown Observe vmmem is still running as a process and taking about 5% CPU Quit PowerToys from task tray Observe vmmem is still running, however CPU usage is 0% from cmd.exe, again issue: wsl --shutdown Observe that vmmem is no longer present in the Task Manager
[wsl2] kernel=
entries must be absolute Windows paths with escaped backslashes, for example C:\Users\Ben\kernel¶
entries must be size followed by unit, for example 8GB or 512MB¶
Workaround: Create a %UserProfile%.wslconfig file in Windows and use it to limit memory assigned to WSL2 VM.
Example [wsl2] memory=6GB swap=0 localhostForwarding=true This will still consume the entire 6GBs regardless of Linux memory usage, but at least it'll stop growing more than that.
Supported settings are documented here.
https://github.com/microsoft/WSL/issues/4166#issuecomment-526725261
Reference¶
-
https://superuser.com/questions/1535269/how-to-connect-wsl-to-a-windows-localhost
-
https://stackoverflow.com/questions/53610385/docker-postgres-and-pgadmin-4-connection-refused
-
https://docs.docker.com/network/network-tutorial-standalone/
-
https://learn.microsoft.com/en-us/windows/wsl/networking#accessing-windows-networking-apps-from-linux-host-ip
-
https://stackoverflow.com/questions/48198/how-do-i-find-out-which-process-is-listening-on-a-tcp-or-udp-port-on-windows
Required login¶
$ make up
[+] Running 1/5
- visualization [⠀] 19.96MB / 200.5MB Pulling 18.0s
- 876bdf4add75 Downloading [====> ] 19.96MB/200.5MB 13.3s
- database [⠀] 29.64MB / 321.8MB Pulling 18.0s
- 32e0d8421203 Downloading [====> ] 29.64MB/321.8MB 13.4s
! replica Warning pull access denied for replica-bayleef, repository does not exist or may require 'docker login': denied: reque...
Docker Error Code
For Docker >= 1.10 see this PR, which follows standard chroot exit codes:
125: docker run itself fails
126: contained command cannot be invoked
127: if contained command cannot be found
128 + n Fatal error signal n:
130 = (128+2) Container terminated by Control-C
137 = (128+9) Container received a SIGKILL
143 = (128+15) Container received a SIGTERM
Check the man page of signal for the full list (on cmd type man 7 signal or check online e.g. signal).
``
Check Docker's exit status documentation for more information about the current version.
https://stackoverflow.com/questions/31297616/what-is-the-authoritative-list-of-docker-run-exit-codes/35410993#35410993