-
Couldn't load subscription status.
- Fork 1.2k
Fixes #13125: Reopen in container for development is not working #13276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mattiagiupponi
wants to merge
5
commits into
master
Choose a base branch
from
ISSUE_13125
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9d6881a
Fixes #13125: Reopen in container for development is not working
mattiagiupponi a5c7ea5
[Fixes #13276] Fix devcontainer
mattiagiupponi 7c00018
Fix PR comments
mattiagiupponi acd132c
merge
mattiagiupponi 207c184
Fix PR comments
mattiagiupponi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
|
|
||
| How to develop using devcontainers in VSCode | ||
| -------------------------------------------- | ||
|
|
||
|
|
||
|
|
||
| You can develop using the vscode remote containers extension. In this approach you need to: | ||
|
|
||
| - Install the extension in your vscode: [ms-vscode-remote.remote-containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) | ||
|
|
||
| - On your command pallet, select: “Remote-Containers: Reopen in Container” | ||
|
|
||
| - If it’s the first time, vscode will take care of building the images. This might take some time. | ||
|
|
||
| - Then a new vscode window will open, and it’ll be connected to your docker container. | ||
|
|
||
| - The message “Dev Container: Debug Docker Compose” will appear in the bottom-left corner of that window. | ||
|
|
||
| - In the vscode terminal, you’re going to see something similar to root@77e80acc89b8:/usr/src/geonode#. | ||
|
|
||
| - To run your application, you can use the integrated terminal (./manage.py runserver 0.0.0.0:8000) or the vscode “Run and Debug” option. For launching with “Run and Debug”, generate the following files in the `.vscode` folder inside the `.devcontainer` folder | ||
|
|
||
| launch.json | ||
| ```json | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
|
|
||
| { | ||
| "name": "Python Debugger: Django", | ||
| "type": "debugpy", | ||
| "request": "launch", | ||
| "args": [ | ||
| "runserver", | ||
| "0.0.0.0:8000" | ||
| ], | ||
| "django": true, | ||
| "autoStartBrowser": false, | ||
| "justMyCode": false, | ||
| "program": "/usr/src/geonode/manage.py" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| The .devcontainer folder should look like this | ||
|
|
||
|
|
||
| ``` | ||
| .devcontainer | ||
| ├── .env | ||
| ├── .vscode | ||
| │ └── launch.json | ||
| ├── devcontainer.json | ||
| ├── docker-compose.yml | ||
|
|
||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "folders": [ | ||
| { | ||
| "path": "/usr/src/geonode" | ||
| }, | ||
| ], | ||
| "settings": {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
|
|
||
| { | ||
| "name": "Python Debugger: Django", | ||
| "type": "debugpy", | ||
| "request": "launch", | ||
| "args": [ | ||
| "runserver", | ||
| "0.0.0.0:8000" | ||
| ], | ||
| "django": true, | ||
| "autoStartBrowser": false, | ||
| "justMyCode": false, | ||
| "program": "/usr/src/geonode/manage.py" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,82 +1,18 @@ | ||
| version: '3.4' | ||
| services: | ||
| # Update this to the name of the service you want to work with in your docker-compose.yml file | ||
| django: | ||
| # If you want add a non-root user to your Dockerfile, you can use the "remoteUser" | ||
| # property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks, | ||
| # debugging) to execute as the user. Uncomment the next line if you want the entire | ||
| # container to run as this user instead. Note that, on Linux, you may need to | ||
| # ensure the UID and GID of the container user you create matches your local user. | ||
| # See https://aka.ms/vscode-remote/containers/non-root for details. | ||
| # | ||
| # user: vscode | ||
|
|
||
| # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer | ||
| # folder. Note that the path of the Dockerfile and context is relative to the *primary* | ||
| # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" | ||
| # array). The sample below assumes your primary file is in the root of your project. | ||
|
|
||
| # build: | ||
| # context: . | ||
| # dockerfile: .devcontainer/Dockerfile | ||
|
|
||
| restart: "no" | ||
|
|
||
| healthcheck: | ||
| test: "echo \"I'm alive.\"" | ||
|
|
||
| env_file: | ||
| - .devcontainer/.env | ||
|
|
||
| volumes: | ||
| # Update this to wherever you want VS Code to mount the folder of your project | ||
| - '.:/usr/src/geonode' | ||
| # Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details. | ||
| # - /var/run/docker.sock:/var/run/docker.sock | ||
| services: | ||
|
|
||
| django: | ||
| ports: | ||
| - "8000:8000" | ||
| - "5678:5678" | ||
|
|
||
| volumes: | ||
| - '.:/usr/src/geonode' | ||
| - './.devcontainer/_vscode:/usr/src/.vscode' | ||
| - statics:/mnt/volumes/statics | ||
| - geoserver-data-dir:/geoserver_data/data | ||
| - backup-restore:/backup_restore | ||
| - data:/data | ||
| - tmp:/tmp | ||
| healthcheck: | ||
| test: "echo 'Alive'" | ||
| entrypoint: ["/usr/src/geonode/entrypoint.sh"] | ||
|
|
||
| # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. | ||
| # cap_add: | ||
| # - SYS_PTRACE | ||
| # security_opt: | ||
| # - seccomp:unconfined | ||
|
|
||
| # Overrides default command so things don't shut down after the process ends. | ||
| command: sleep infinity | ||
|
|
||
| celery: | ||
| restart: "no" | ||
| env_file: | ||
| - .devcontainer/.env | ||
|
|
||
| volumes: | ||
| - '.:/usr/src/geonode' | ||
|
|
||
| geonode: | ||
| restart: "no" | ||
|
|
||
| # Removes letsencrypt when developing | ||
| letsencrypt: | ||
| deploy: | ||
| replicas: 0 | ||
|
|
||
| geoserver: | ||
| restart: "no" | ||
| ports: | ||
| - "8080:8080" | ||
|
|
||
| data-dir-conf: | ||
| restart: "no" | ||
|
|
||
| db: | ||
| restart: "no" | ||
| ports: | ||
| - "5432:5432" | ||
|
|
||
| rabbitmq: | ||
| restart: "no" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd propose to have a default
.vscode/launch.jsonavailable. You would have to re-create it after every rebuild. In addition one can just hit "shortcut of choice" to start up instantly. And finally, you could remove the instruction from the documentation as well :).