Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/693c70a4-9498-8011-87ee-efb5576cc53d
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: Good, now we have something concrete. === Good, now we have something concrete. Let me lock a CI/CD blueprint to exactly what you have on Dell01 and vmi2744768, with shell commands you can copy-paste and verify. ==== ### ==== Project root: <syntaxhighlight lang="bash">/home/kce2ces/projects/wsi-website </syntaxhighlight> Key points: * Build output lives in: ./site/ * Source lives in: ./src/ * You have build-meta.sh, Tailwind, MkDocs configs, etc. ===== Prod root: ===== <syntaxhighlight lang="bash">/home/cesadmin/projects/wsi-website-prod </syntaxhighlight> Content: <syntaxhighlight lang="bash">. βββ Caddyfile βββ docker-compose.yml βββ site/ βββ assets/ βββ en/ βββ zh/ βββ index.html </syntaxhighlight> Caddy + Compose: <syntaxhighlight lang="bash"># Caddyfile { auto_https off } :80 { root * /usr/share/caddy file_server } </syntaxhighlight> <syntaxhighlight lang="yaml"># docker-compose.yml services: caddy: image: caddy:latest container_name: wsi-caddy restart: unless-stopped expose: * "80" volumes: * ./Caddyfile:/etc/caddy/Caddyfile * ./site:/usr/share/caddy * caddy_data:/data * caddy_config:/config networks: * npm-net networks: npm-net: external: true volumes: caddy_data: caddy_config: </syntaxhighlight> β Conclusion: Blueprint anchor is clear * Local build target: ~/projects/wsi-website/site * Prod web root (inside container): /usr/share/caddy * Prod host mapping: ~/projects/wsi-website-prod/site β /usr/share/caddy So CI/CD only needs to sync <code>site/</code> from Dell01 β <code>site/</code> on vmi2744768. Caddy does NOT need to restart for static file updates. ==== Run everything under: ==== <syntaxhighlight lang="bash">cd ~/projects/wsi-website </syntaxhighlight> ===== <syntaxhighlight lang="bash">rm -rf site/* ===== </syntaxhighlight> ===== You already have build-meta.sh. Run: ===== <syntaxhighlight lang="bash">chmod +x build-meta.sh ./build-meta.sh </syntaxhighlight> After this, verify: <syntaxhighlight lang="bash">cat site/build-info.json </syntaxhighlight> You should see fields like timestamp, git commit, etc (depending on how we scripted it last time). ===== Assuming your package.json has a script like: ===== <syntaxhighlight lang="json">"scripts": { "build": "tailwindcss ... && <copy src -> site>", "dev": "..." } </syntaxhighlight> Use: <syntaxhighlight lang="bash">npm install # first time or when deps change npm run build </syntaxhighlight> Verify that the built files exist: <syntaxhighlight lang="bash">tree -L 3 site </syntaxhighlight> You should see something like: <syntaxhighlight lang="bash">site βββ assets β βββ css β βββ favicon.ico β βββ style.css βββ en β βββ about.html β βββ index.html βββ index.html βββ zh βββ about.html βββ index.html </syntaxhighlight> : ==== Still in ~/projects/wsi-website: ==== ===== <syntaxhighlight lang="bash">git status ===== </syntaxhighlight> ===== If you do want site/ in Git (recommended for simple static hosting): ===== <syntaxhighlight lang="bash">git add src site docs *.md build-meta.sh package.json package-lock.json \ mkdocs*.yml tailwind.config.js postcss.config.js Caddyfile \ docker-compose.yml </syntaxhighlight> If you do NOT want site/ in Git, ensure .gitignore contains: <syntaxhighlight lang="gitignore">node_modules/ site/ </syntaxhighlight> Then add everything else: <syntaxhighlight lang="bash">git add . </syntaxhighlight> ===== <syntaxhighlight lang="bash">git commit -m "WSI website: build $(date +'%Y-%m-%d %H:%M %Z')" ===== </syntaxhighlight> ===== <syntaxhighlight lang="bash">git push origin main ===== </syntaxhighlight> Replace main with your actual default branch if different. ==== From Dell01 / WSL, we deploy only <code>site/</code> via rsync over SSH. ==== ===== SSH into VPS once: ===== <syntaxhighlight lang="bash">ssh cesadmin@vmi2744768 sudo apt update sudo apt install -y rsync exit </syntaxhighlight> ===== From: ===== <syntaxhighlight lang="bash">cd ~/projects/wsi-website </syntaxhighlight> Run: <syntaxhighlight lang="bash">rsync -avz --delete \ ./site/ \ cesadmin@vmi2744768:~/projects/wsi-website-prod/site/ </syntaxhighlight> Explanation: * ./site/ β content of local site directory * ~/projects/wsi-website-prod/site/ β existing prod directory * --delete ensures removed files locally are also removed on the server (no stale HTML/CSS/JS). ===== SSH in: ===== <syntaxhighlight lang="bash">ssh cesadmin@vmi2744768 cd ~/projects/wsi-website-prod tree -L 3 site </syntaxhighlight> You should see: <syntaxhighlight lang="bash">site βββ assets β βββ css β βββ favicon.ico β βββ style.css βββ en β βββ about.html β βββ index.html βββ index.html βββ zh βββ about.html βββ index.html </syntaxhighlight> If yes β files deployed correctly. ==== Caddy is already running via docker-compose.yml and mounts ./site β /usr/share/caddy. ==== From VPS: <syntaxhighlight lang="bash">cd ~/projects/wsi-website-prod docker compose ps </syntaxhighlight> You should see wsi-caddy in Up state. To verify contents inside the container: <syntaxhighlight lang="bash">docker exec -it wsi-caddy ls -R /usr/share/caddy </syntaxhighlight> To verify HTTP from VPS itself: <syntaxhighlight lang="bash">curl -I http://localhost === or, if NPM is proxying by host header: === curl -I http://whitestoneintel.com </syntaxhighlight> In your browser (from anywhere), verify: * https://whitestoneintel.com/ * https://whitestoneintel.com/en/ * https://whitestoneintel.com/zh/ These should now reflect the latest build. : ==== If you want true CI/CD from GitHub to VPS (no manual rsync), you can create: ==== /.github/workflows/deploy.yml in your repo: <syntaxhighlight lang="yaml">name: Deploy WSI website to VPS on: push: branches: * main # adjust if needed paths: * "src/**" * "docs/**" * "tailwind.config.js" * "postcss.config.js" * "build-meta.sh" * "package.json" * "package-lock.json" jobs: build-and-deploy: runs-on: ubuntu-latest steps: * name: Checkout repo uses: actions/checkout@v4 * name: Setup Node uses: actions/setup-node@v4 with: node-version: "22" # or the version you actually use * name: Install dependencies run: npm ci * name: Build metadata run: chmod +x ./build-meta.sh && ./build-meta.sh * name: Build static site run: npm run build * name: Deploy via rsync to VPS uses: burnett01/rsync-deployments@v7.1 with: switches: -avz --delete path: site/ remote_path: /home/cesadmin/projects/wsi-website-prod/site/ remote_host: ${{ secrets.WSI_VPS_HOST }} remote_user: ${{ secrets.WSI_VPS_USER }} remote_key: ${{ secrets.WSI_VPS_SSH_KEY }} </syntaxhighlight> Then in your repo GitHub β Settings β Secrets and variables β Actions, define: * WSI_VPS_HOST β vmi2744768 or actual IP/FQDN * WSI_VPS_USER β cesadmin '' WSI_VPS_SSH_KEY β private key for that user (no passphrase or use a separate ''_PASSPHRASE secret) After that: * Every git push to main β GitHub builds β rsyncs site/ to VPS β Caddy instantly serves updated version. ==== On Dell01 / WSL ==== <syntaxhighlight lang="bash">cd ~/projects/wsi-website npm install ./build-meta.sh npm run build git status git commit -am "WSI website update" # or use git add . then commit git push origin main rsync -avz --delete ./site/ cesadmin@vmi2744768:~/projects/wsi-website-prod/site/ </syntaxhighlight> On VPS <syntaxhighlight lang="bash">ssh cesadmin@vmi2744768 cd ~/projects/wsi-website-prod tree -L 3 site docker compose ps docker exec -it wsi-caddy ls -R /usr/share/caddy curl -I http://localhost </syntaxhighlight> If all of the above pass, your CI/CD blueprint and the real environment are aligned. If you want, next step I can do is write the exact <code>.gitignore</code> and <code>package.json</code> scripts so they match this flow precisely, but the commands above are already consistent with your current folder structures and Caddy/Compose config.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)