Feat: Devcontainers and better readme #3

Merged
palid merged 7 commits from feat/devcontainers into master 2024-02-04 15:00:49 +00:00
Collaborator

Adding @informatic and @q3k just for visibility purposes; please check if this kind of experience is good enough for you as I'd like to get it in more HSWAW repositories.

Adding @informatic and @q3k just for visibility purposes; please check if this kind of experience is good enough for you as I'd like to get it in more HSWAW repositories.
informatic was assigned by palid 2024-02-01 00:17:21 +00:00
q3k was assigned by palid 2024-02-01 00:17:21 +00:00
radex was assigned by palid 2024-02-01 00:17:21 +00:00
palid added 3 commits 2024-02-01 00:17:22 +00:00
e768ddd7b4
fix: ignore .DS_Store
MacOS creates .DS_Store files that are usually ignored by mac users.
Unfortunately, this is not a default for devcontainers.
palid force-pushed feat/devcontainers from 5f616b041a to 185896f4bb 2024-02-01 00:18:14 +00:00 Compare
palid force-pushed feat/devcontainers from 185896f4bb to e4065e7da4 2024-02-01 00:21:51 +00:00 Compare
informatic reviewed 2024-02-01 10:11:22 +00:00
@ -18,3 +18,1 @@
"ghcr.io/wxw-matt/devcontainer-features/script_runner:0": {}
}
"ghcr.io/wxw-matt/devcontainer-features/script_runner:0": {},

Is this (and sshd feature) actually used here?

Is this (and sshd feature) actually used here?
Poster
Collaborator

sshd is required for ssh git commit signing from dev containers if someone uses that. DX feat.
This script runner - nah. Getting rid of it.

`sshd` is required for ssh git commit signing from dev containers if someone uses that. DX feat. This script runner - nah. Getting rid of it.
palid marked this conversation as resolved
@ -36,0 +37,4 @@
"verifySignature": false
}
},
"settings.extensions.verifySignature": false,

Which one is it? Do we actually need this?

Which one is it? Do we actually need this?
Poster
Collaborator

seems that it's settings: {extensions.verifySignature} Fixing.

seems that it's `settings: {extensions.verifySignature}` Fixing.
palid marked this conversation as resolved
README.md Outdated
@ -21,0 +25,4 @@
1. Devcontainer's VSCode instance will be automatically configured with extensions to help your development process.
2. You might get a Toast telling you to re-open the directory due to Black not working properly. Do so for proper autoformatting support.
7. `manage.py migrate` will be run automatically after container creation, to make sure you have the latest migrations done on the development database without any need for interaction.
8. Run debug session with either command of "Start Debugging" (default hotkey F5), or with the Debug sidebar. ![Debug sidebar instructions](readme/debug-example.png 'Debug sidebar')

Default django launch configuration here listens on 127.0.0.1:8000 which doesn't work when running in a devcontainer. We should probably add .vscode/launch.json there too (note the 0.0.0.0:8000 added manually)

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/manage.py",
            "args": [
                "runserver",
                "0.0.0.0:8000"
            ],
            "django": true,
            "justMyCode": true
        }
    ]
}
Default django launch configuration here listens on 127.0.0.1:8000 which doesn't work when running in a devcontainer. We should probably add `.vscode/launch.json` there too (note the `0.0.0.0:8000` added manually) ```json { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Python: Django", "type": "python", "request": "launch", "program": "${workspaceFolder}/manage.py", "args": [ "runserver", "0.0.0.0:8000" ], "django": true, "justMyCode": true } ] } ```
Poster
Collaborator

Seems I accidentally added .vscode to .gitignore and it made some sense back then for me. Need to revert it, all those things are added to the vscode config. Thanks for catching that.

Seems I accidentally added `.vscode` to `.gitignore` and it made some sense back then for me. Need to revert it, all those things are added to the vscode config. Thanks for catching that.
palid marked this conversation as resolved
palid added 2 commits 2024-02-01 10:52:00 +00:00
palid force-pushed feat/devcontainers from 4890db8585 to 401f9c3761 2024-02-01 11:16:42 +00:00 Compare
palid added 2 commits 2024-02-01 11:37:03 +00:00
Poster
Collaborator

@informatic check now

@informatic check now
palid force-pushed feat/devcontainers from 1d6adc9b64 to 1dc6d8b76d 2024-02-01 11:49:41 +00:00 Compare
palid requested review from radex 2024-02-01 18:12:47 +00:00
q3k was unassigned by palid 2024-02-01 18:12:51 +00:00
informatic was unassigned by palid 2024-02-01 18:12:52 +00:00
radex was unassigned by palid 2024-02-01 18:12:52 +00:00
palid self-assigned this 2024-02-01 18:12:52 +00:00
palid requested review from informatic 2024-02-01 18:12:59 +00:00
radex approved these changes 2024-02-04 14:52:05 +00:00
radex left a comment
Owner

I'm not persuaded personally into the devcontainers workflow, but I'm willing to give it a try. It took me a while to get it to work… but it does work.

Alas, docker compose up (which I'd prefer, seems like one fewer abstraction layer to me) still doesn't work for me :/ Strangely, manage.py collectstatic fails with PermissionError: [Errno 13] Permission denied: '/code/build_static/css'

I'm not persuaded personally into the devcontainers workflow, but I'm willing to give it a try. It took me a while to get it to work… but it does work. Alas, `docker compose up` (which I'd prefer, seems like one fewer abstraction layer to me) still doesn't work for me :/ Strangely, `manage.py collectstatic` fails with `PermissionError: [Errno 13] Permission denied: '/code/build_static/css'`
@ -13,4 +13,3 @@
build_static
.venv
.vscode

a huge amount of junk under .vscode-server, .ssh, .devcontiner is created for me

a huge amount of junk under .vscode-server, .ssh, .devcontiner is created for me
Poster
Collaborator

I can't replicate it on my setup, can you try doing a fresh clone and show diff?

I can't replicate it on my setup, can you try doing a fresh clone and show diff?
@ -13,3 +11,1 @@
docker-compose up --build
```
2. Run `docker-compose run --rm web python manage.py createsuperuser` -- now you can dev authenticate w/o SSO
1. Copy `.env.example` as `.env`

shouldn't env default to not use oauth but user+pass? Otherwise it just doesn't work without oauth being set up by the user, which isn't called out by readme

shouldn't env default to not use oauth but user+pass? Otherwise it just doesn't work without oauth being set up by the user, which isn't called out by readme
palid marked this conversation as resolved
@ -21,0 +25,4 @@
1. Devcontainer's VSCode instance will be automatically configured with extensions to help your development process.
2. You might get a Toast telling you to re-open the directory due to Black not working properly. Do so for proper autoformatting support.
7. `manage.py migrate` will be run automatically after container creation, to make sure you have the latest migrations done on the development database without any need for interaction.
8. Run debug session with either command of "Start Debugging" (default hotkey F5), or with the Debug sidebar. ![Debug sidebar instructions](readme/debug-example.png 'Debug sidebar')

strangely, it told me a few times that I can't do it without a python extension multiple times (despite me having installed it) until it started working ¯_(ツ)_/¯

strangely, it told me a few times that I can't do it without a python extension multiple times (despite me having installed it) until it started working ¯\_(ツ)_/¯
palid marked this conversation as resolved
@ -31,0 +37,4 @@
1. Get python3
2. `pip install -r requirements.txt`
3. `python3 manage.py migrate`
4. `python3 manage.py collecstatic`

typo

typo
palid marked this conversation as resolved
palid added 1 commit 2024-02-04 15:00:34 +00:00
palid merged commit dad68031df into master 2024-02-04 15:00:49 +00:00
palid deleted branch feat/devcontainers 2024-02-04 15:00:49 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hswaw/spejstore#3
There is no content yet.