Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions OS/debian-ssh/project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Pure Debian Environment Example (Next.js)

This is a “pure Debian 12” development environment on Sealos. It shows how to quickly set up and run a Next.js app inside a clean Debian system. The workflow feels just like local development—no need to manage Docker yourself.

### Project Description
The project provides a minimal yet practical developer experience: once in Devbox, install Node.js (via nvm) and create a Next.js sample. You can extend it to your own stack as needed.

### Environment
- OS: Debian 12 (bookworm)
- Platform: Sealos Devbox (cloud-based, ready to use)
- User & Privileges: default user `devbox` with passwordless `sudo`
- Networking & SSH: `sshd` enabled, public key login supported
- Package Mirrors: Tsinghua mirror (CN) supported for faster installs in Mainland China

### Project Execution
- Development mode (recommended): enter Devbox, then install Node.js (nvm) and run Next.js dev server.
```bash
# 1) Install nvm (recommended)
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

# 2) Install & use Node.js LTS (includes npm)
nvm install --lts && nvm use --lts

# 3) Create and start a Next.js sample
npx create-next-app@latest my-next-app
cd my-next-app
npm run dev # default port 3000
```
- Access: open the project’s public URL in Devbox, and make sure the port is set to 3000.

- Production mode (optional): after development, build and run in production mode.
```bash
npm run build
npm run start
```

### Devbox: Code. Run. Ship. We handle the rest.
DevBox: Code. Build. Deploy. We've Got the Rest. With DevBox, you can focus entirely on writing great code while we handle the infrastructure, scaling, and deployment. Seamless development from start to production.
140 changes: 0 additions & 140 deletions OS/debian-ssh/project/Readme.md

This file was deleted.

28 changes: 27 additions & 1 deletion OS/debian-ssh/project/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
#!/bin/bash
app_env=${1:-development}

./hello.sh
# Define build target
build_target="hello_world"

# Development environment commands
dev_commands() {
echo "Running development environment commands..."
export ENV="development"
./hello.sh "$app_env"
}

# Production environment commands
prod_commands() {
echo "Running production environment commands..."
export ENV="production"
./hello.sh
echo "Server started in background. Check server.log for details."
}

# Check environment variables to determine the running environment
if [ "$app_env" = "production" ] || [ "$app_env" = "prod" ] ; then
echo "Production environment detected"
prod_commands
else
echo "Development environment detected"
dev_commands
fi
9 changes: 8 additions & 1 deletion OS/debian-ssh/project/hello.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

MODE="${1:-${ENV:-development}}"

echo "Hello, Sealos user. welcome to Debian!"
echo "You’re now in ${MODE} mode. Have a smooth journey and happy coding."

while :; do
{ echo -ne "HTTP/1.1 200 OK\r\nContent-Length: $(echo -n "Hello, World!")\r\n\r\nHello, World!"; } | nc -l -p 8080 -q 1
BODY="Hello, World! (mode: ${MODE})"
LEN=${#BODY}
{ echo -ne "HTTP/1.1 200 OK\r\nContent-Length: ${LEN}\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n${BODY}"; } | nc -l -p 8080 -q 1
done
8 changes: 6 additions & 2 deletions OS/debian-ssh/update_cn_dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ TMP_DOCKERFILE="${DOCKERFILE}tmp"
cp $DOCKERFILE $TMP_DOCKERFILE

# 修正sed命令
sed -i '$i\
COPY /OS/debian-ssh/debian.sources /etc/apt/sources.list.d/debian.sources' "$TMP_DOCKERFILE"
sed -i '/COPY \/script\/startup.sh \/usr\/start\/startup.sh/a\
RUN apt-get update && apt-get install -y ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/*' "$TMP_DOCKERFILE"

# 在ca-certificates安装后插入清华源配置
sed -i '/RUN apt-get update && apt-get install -y ca-certificates/a\
COPY /OS/debian-ssh/debian.sources /etc/apt/sources.list.d/debian.sources' "$TMP_DOCKERFILE"