Merge pull request #492 from NuSkooler/feature/docker_dev

Setup Docker development environment
This commit is contained in:
Bryan Ashby 2023-08-29 20:42:03 -06:00 committed by GitHub
commit 1af4a0432b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 133 additions and 2 deletions

9
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM library/node:lts-bookworm
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update \
&& apt install -y --no-install-recommends sudo telnet \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& echo "node ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/node \
&& chmod 0440 /etc/sudoers.d/node

View File

@ -0,0 +1,24 @@
{
"name": "Basic Node.js",
"build": { "dockerfile": "Dockerfile" },
"remoteUser": "root",
"forwardPorts": [8888, 4000],
"postCreateCommand": "gem install jekyll bundler && /bin/rm -rf node_modules && npm install && cd docs && bundle install && cd ..",
"features": {
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "latest"
},
"ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {},
"ghcr.io/jungaretti/features/ripgrep:1": {},
"ghcr.io/warrenbuckley/codespace-features/sqlite:1": {},
"ghcr.io/devcontainers/features/ruby:1": {
"version": "3.1"
}
},
"customizations": {
"vscode": {
"extensions": ["ms-azuretools.vscode-docker","alexcvzz.vscode-sqlite","yzhang.markdown-all-in-one", "DavidAnson.vscode-markdownlint", "christian-kohler.npm-intellisense", "dbaeumer.vscode-eslint", "bierner.markdown-yaml-preamble"]
}
}
}

10
.gitattributes vendored
View File

@ -6,3 +6,13 @@
*.TXT eol=crlf
*.diz eol=crlf
*.DIZ eol=crlf
# Don't mess with shell script line endings
*.sh text eol=lf
# Same thing for optutil.js which functions as a shell script
optutil.js text eol=lf
# The devcontainer is also unix
.devcontainer/Dockerfile text eol=lf
.devcontainer/devcontainer.json text eol=lf

3
.gitignore vendored
View File

@ -10,5 +10,4 @@ logs/
mail/
node_modules/
docs/_site/
docs/.sass-cache/
.vscode/
docs/.sass-cache/

6
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"recommendations": [
"ms-vscode-remote.remote-containers",
"laktak.hjson"
]
}

17
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
// 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": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/main.js"
}
]
}

26
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Jekyll (ENiGMA½ documentation server)",
"command": "cd docs && bundle exec jekyll serve",
"isBackground": true,
"type": "shell"
},
{
"label": "(re)build Jekyll bundles",
"command": "cd docs && bundle install",
"type": "shell"
},
{
"label": "(re)build node modules",
"command": "/bin/rm -rf node_modules && npm install",
"type": "shell"
},
{
"label": "ENiGMA½ new configuration",
"command": "./oputil.js config new",
"type": "shell"
}
]
}

View File

@ -30,3 +30,4 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "webrick"

View File

@ -54,6 +54,7 @@ collections:
- installation/network.md
- installation/testing.md
- installation/production.md
- installation/development.md
- configuration/creating-config.md
- configuration/sysop-setup.md
- configuration/config-files.md

View File

@ -0,0 +1,38 @@
---
layout: page
title: Development Environment Setup
---
_Note:_ This is only useful for people who are looking to contribute to the ENiGMA½ source base itself. Those that are just setting up a new BBS system do not need this section.
The easiest way to get started with development on ENiGMA½ is via the pre-configured Visual Studio Code remote docker container environment. This setup will download and configure everything needed with minimal interaction. It also works cross-platform.
* Install [Visual Studio Code](https://code.visualstudio.com/download)
* Install [Docker](https://docs.docker.com/engine/install/)
* Clone the [ENiGMA½](https://github.com/NuSkooler/enigma-bbs) repository.
* Choose "Open Folder" from Visual Studio Code and open the location where you cloned the repository.
That's it! Visual Studio Code should prompt you for everything else that is needed, including some useful extensions for development.
## Tasks
Once it completes, there are a few tasks and run-configs that are useful. Open up the command pallete and search/choose "Tasks> Run Task". From there you can run the following tasks:
### Start Jekyll (ENiGMA½ documentation server)
This task will start the Jekyll server to perform local testing of changes to documentation. After running this task, open a browser to (http://localhost:4000/enigma-bbs/) to see the documentation.
### (re)build Jekyll bundles
When the image is created the Jekyll bundles are installed, so in general there shouldn't be much need to run this task. This is available however in case soemthing goes wrong or you are working on the Jekyll setup itself.
### (re)build node modules
Used to re-generate the node modules. Generally shouldn't be necessary unless something is broken or you are adding/changing versions of dependencies.
### ENiGMA½ new configuration
This task executes `oputil.js` in order to create a new BBS configuration (useful if you have just checked out the code and haven't setup any configuration yet.)
## Run / Debug config
There is also a default "Launch Program" config (hotkey access via F5 / Ctrl-Shift-D.) This will launch ENiGMA½. Once it has launched, access the system via telnet, port 8888 as usual.