Skip to content

sndev runs on codespaces #2214

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
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

axelvyrn
Copy link
Contributor

@axelvyrn axelvyrn commented Jun 8, 2025

Description

Closes #2209
Github Codespaces uses docker to run the platform like sndev. So this was a docker-in-docker error. Thus it was required to check explicitly if Docker was available in the codespaces.

Steps to run sndev on Github Codespaces:

  1. run npm install. let it be finished
  2. in .env set
CPU_SHARES_IMPORTANT=1024
CPU_SHARES_MODERATE=512
CPU_SHARES_LOW=256
OPENSEARCH_PASSWORD=yourStrongPassword

because when I ran docker ps -a && docker-compose ps && ./sndev status
it returned

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
WARN[0000] The "CPU_SHARES_LOW" variable is not set. Defaulting to a blank string. 
error while interpolating services.opensearch.cpu_shares: failed to cast to expected type: strconv.ParseInt: parsing "": invalid syntax

because opensearch was not able to run as a healthy container

  1. run ./sndev start. let it build and deploy the container, you should be able to see the containers icon appear in the sidebar

image

  1. wait for about 5 minutes or split terminal and/or check sndev status.

  2. go to PORTS and open port 3000 on the web browser through the link from github codespaces (the browser icon that appears when you hover over port 3000) not from http://localhost:3000

  3. you will be able to see the live site on the page

Screenshots

Image

Image

Additional Context

Make sure the codespaces machine is the 8GB RAM and 32 GB storage one because running sndev puts great load on the CPU

Troubleshooting:

  1. If sndev does not start on the first try just run ./sndev stop and then ./sndev start again, there might be some image creation or memory failure
  2. If opensearch fails to run set Java heap to - "_JAVA_OPTIONS=-Xms1g -Xmx1g -XX:UseSVE=0" which is applicable for <=4GB RAM (even if you use the better machine in codespaces, this might help) in docker-compose.yml (replace line 183)

Checklist

Are your changes backwards compatible? Please answer below:
yup

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
10

For frontend changes: Tested on mobile, light and dark mode? Please answer below:
N/A

Did you introduce any new environment variables? If so, call them out explicitly here:

CPU_SHARES_IMPORTANT=1024
CPU_SHARES_MODERATE=512
CPU_SHARES_LOW=256

Copy link
Member

@huumn huumn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for figuring out how to do this, but the issue is about making this run in codespaces without having to manually do things.

I'm not sure how to do that, which is why the issue exists.

@axelvyrn
Copy link
Contributor Author

Well, you have to set the .env variables by yourself I suppose

without having to manually do things.

you don't have to do it anymore, I updated the description please do check, just setting the .env variables and running ./sndev start should do, the check for codespaces environment is set in the file I changed

@huumn
Copy link
Member

huumn commented Jun 13, 2025

There should be some way of auto-exporting those env variables. The goal is one-click dev environments for contributors. If you can't figure it out, that's fine. If it's not possible, I'd appreciate linking to somewhere I can confirm it's not possible.

@axelvyrn
Copy link
Contributor Author

axelvyrn commented Jun 14, 2025

image
image

success, after the sndev edit, I could start sndev with just ./sndev start and nothing more on the first try,
as you can see, I tried in on a totally new machine which would not have the influence of the previous one.
(Last one was glowing space computing machine, this one is bookish zebra)

:)

@huumn huumn marked this pull request as draft June 14, 2025 04:14
@axelvyrn axelvyrn marked this pull request as ready for review July 6, 2025 11:31
@axelvyrn axelvyrn requested a review from huumn July 6, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make sndev work in github codespaces
2 participants