Skip to content

Commit

Permalink
Merge pull request #24 from hadirgax/feat/code-server
Browse files Browse the repository at this point in the history
Feat/code server
  • Loading branch information
hadirgax authored Jul 6, 2024
2 parents 82f530e + 7de2add commit a72f84f
Show file tree
Hide file tree
Showing 7 changed files with 365 additions and 0 deletions.
24 changes: 24 additions & 0 deletions code_server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
HOME_CODE_SERVER_DIR ?= $(HOME)/.code-server

get-code-server:
@echo;echo "Getting code-server..."
-docker rm -f codercom
docker run -d --name codercom codercom/code-server:4.16.0
-docker cp codercom:/usr/lib/code-server $(HOME_CODE_SERVER_DIR)
docker rm -f codercom
@echo;echo "code-server downloaded successfully"


start-code-server:
@echo;echo "Starting code-server..."
mkdir -p $(HOME)/workspace
$(HOME_CODE_SERVER_DIR)/bin/code-server -e \
--auth password \
--bind-addr 0.0.0.0:8487 \
$(HOME)/workspace

@echo "code-server started successfully"


# --extensions-dir $(HOME_CODE_SERVER_DIR)/extensions \
# --disable-telemetry \
3 changes: 3 additions & 0 deletions code_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CODE SERVER

A VSCode instance running on a remote server and accessible through a web browser.
27 changes: 27 additions & 0 deletions code_server/coder.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Quick & Dirty powershell script to use the containter with Docker & WSL2 containers.
# Run this wherever you want the folder created and mapped to.

# create a folder in the current directory
cd (mkdir -ea 0 code-server)

# create the '.config' and 'project' folders in the current location.
mkdir -ea 0 .local,.config,project

# reformat the current folder as a unix-style path
$LOC = "/$(((pwd).path).substring(0,1).tolower()+((pwd).path).substring(1))" -replace '\\' ,'/' -replace ':',''

# Run the docker image, map it back to port 8080 on the host, and map the .config and project folders
# docker run -it --name code-server `
# -p 127.0.0.1:8487:8487 `
# -v "$LOC/.config:/home/coder/.config" `
# -v "$LOC/project:/home/coder/project" `
# -e PASSWORD=Hi-Mom! `
# codercom/code-server:latest

docker run -it --name code-server `
-p 8487:8080 `
-v "$LOC/.local:/home/coder/.local" `
-v "$LOC/.config:/home/coder/.config" `
-v "$LOC/project:/home/coder/project" `
-e "DOCKER_USER=hadirgax" `
codercom/code-server:latest
14 changes: 14 additions & 0 deletions code_server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
vscode:
container_name: code-server
image: codercom/code-server:latest
environment:
- DOCKER_USER=hadirgax
# - PASSWORD=supersecretpassword
volumes:
- ./code-server/project:/home/coder/project
- ./code-server/.config:/home/coder/.config
user: "0:0"
restart: always
ports:
- 127.0.0.1:8443:8080
28 changes: 28 additions & 0 deletions setup_devenv/clean_setup_restore_backup/wsl.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# VARIABLES
$DEVOPS_DIR="$HOME/workspace/devops"
$FEATURE_DIR="$DEVOPS_DIR/setup_devenv/clean_setup_restore_backup"
$WSL_DISTRO="Ubuntu" # opts: Debian/Ubuntu
$SETUP_FILE="$FEATURE_DIR/main_restore_backup_ubuntu_debian.sh"

# Provide a date to be restored, in the format "yyyyMMdd-HHmmss"
$BACKUP_FILE="20230211-193753_wsl_backup.tar.gz"
$BACKUP_ORIGIN="$HOME/backups/linux/$BACKUP_FILE"
$BACKUP_DESTINATION="\\wsl.localhost\$WSL_DISTRO\tmp"

# Write-Output "`n>>>>> Installing $WSL_DISTRO Distribution... >>>>>"
# wsl.exe --unregister $WSL_DISTRO
# wsl.exe --install -d $WSL_DISTRO
# wsl.exe -s $WSL_DISTRO

# Write-Output "`n>>>>> Transfering the Backup File from GDrive... >>>>>"
# Copy-Item -Path $BACKUP_ORIGIN -Destination $BACKUP_DESTINATION

Write-Output "`n>>> Configuring a new WSL setup..."
wsl.exe -d $WSL_DISTRO -e bash -c "sudo chmod +x $SETUP_FILE && \
BACKUP_FILE=$BACKUP_FILE \
DISTRO=$WSL_DISTRO \
FEATURE_DIR=$FEATURE_DIR \
$SETUP_FILE main"


Write-Output "`n>>>>> Done! >>>>>"
268 changes: 268 additions & 0 deletions setup_devenv/vscode-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
{
"cSpell.language": "en,pt,es",
"cSpell.enableFiletypes": [
"!asciidoc",
"!c",
"!cpp",
"!csharp",
"!go",
"!handlebars",
"!haskell",
"!jade",
"!java",
"!latex",
"!php",
"!pug",
"!python",
"!restructuredtext",
"!rust",
"!scala",
"!scss"
],
"cSpell.userWords": [
"chakra",
"Keycloak",
"middlewares",
"persistor",
"prefetch",
"rocketseat"
],

"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.columnSelection": false,
"editor.defaultFormatter": null,
"editor.fontFamily": "'JetBrains Mono',Consolas,'Courier New', monospace",
"editor.fontLigatures": true,
"editor.formatOnSave": false,
"editor.lineHeight": 21,
"editor.multiCursorModifier": "ctrlCmd",
"editor.cursorStyle": "block-outline",
"editor.cursorBlinking": "smooth",
"editor.parameterHints.enabled": false,
"editor.semanticHighlighting.enabled": false,
"editor.suggestSelection": "first",
"editor.renderLineHighlight": "gutter",
"editor.rulers": [99],
"editor.tabSize": 4,

"emmet.includeLanguages": { "javascript": "javascriptreact" },
"emmet.showSuggestionsAsSnippets": true,
"emmet.syntaxProfiles": { "javascript": "jsx" },

"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
"explorer.compactFolders": false,

"extensions.autoUpdate": false,
"extensions.ignoreRecommendations": true,

"files.associations": {
".sequelizerc": "javascript",
".stylelintrc": "json",
".prettierrc": "json",
"*.tsx": "typescriptreact"
},

"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
// "**/node_modules": true
},

"html.format.indentHandlebars": true,
"html.format.indentInnerHtml": true,
"html.format.wrapAttributesIndentSize": 2,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},

"javascript.updateImportsOnFileMove.enabled": "always",
"javascript.suggest.autoImports": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},

"[dockercompose]": {
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
},
"editor.tabSize": 2
},

"[cmake]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},

"[cpp]": {
"editor.defaultFormatter": "ms-vscode.cpptools",
"editor.tabSize": 2
},

"[groovy]": {
"editor.rulers": [140]
},

"gitlens.gitCommands.skipConfirmations": [
"fetch:command",
"stash-push:command",
"switch:command",
"branch-create:command"
],
"git.ignoreMissingGitWarning": true,
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
},

"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.blackArgs": ["--line-length", "99"],
"python.languageServer": "Pylance",

"cmake.configureOnOpen": true,
"redhat.telemetry.enabled": false,
"security.workspace.trust.untrustedFiles": "open",

"terminal.integrated.fontSize": 11,
"files.eol": "\n",
"terminal.integrated.cursorStyle": "block",
"terminal.integrated.cursorBlinking": true,
"terminal.integrated.showExitAlert": false,
"terminal.integrated.inheritEnv": true,
"terminal.integrated.scrollback": 10000,

"typescript.tsserver.log": "off",
"typescript.updateImportsOnFileMove.enabled": "never",
"typescript.suggest.autoImports": true,

"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"workbench.startupEditor": "newUntitledFile",
"workbench.editor.labelFormat": "short",
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"liveshare.presence": true,
"jupyter.askForKernelRestart": false,
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"diffEditor.ignoreTrimWhitespace": false,
"prettier.singleQuote": false,
"editor.renderWhitespace": "all",
"telemetry.telemetryLevel": "off",
"workbench.iconTheme": "bearded-icons",
"terminal.integrated.shellIntegration.enabled": true,
"terminal.integrated.defaultProfile.windows": "Windows PowerShell",
"terminal.integrated.profiles.windows": {
"MinGW64": {
"path": [
"C:\\msys64\\usr\\bin\\bash.exe"
],
"args": ["--login", "-i"],
"env": {
"MSYSTEM": "MINGW64",
"CHERE_INVOKING":"1"
}
},
"Windows PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"PowerShell": {
"source": "Windows.Terminal.PowershellCore",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"icon": "terminal-bash"
},
"zsh": {
"path": "zsh"
}
},
"notebook.output.textLineLimit": 200,
"editor.fontSize": 13,
"editor.minimap.maxColumn": 100,
"editor.minimap.autohide": true,
"notebook.lineNumbers": "on",
"debug.console.fontSize": 12,
"remote.SSH.remotePlatform": {
"debian-vbox": "linux",
"localhost": "linux"
},
"workbench.colorTheme": "Bearded Theme Arc EolStorm",
"notebook.output.lineHeight": 20,
"notebook.output.fontSize": 12,
"workbench.panel.defaultLocation": "bottom",
"workbench.panel.opensMaximized": "never",
"task.problemMatchers.neverPrompt": {
"shell": true
},
"window.commandCenter": false,
"remote.autoForwardPortsSource": "hybrid",
"git.autofetch": true,
"cmake.options.statusBarVisibility": "visible",
"extensions.experimental.affinity": {
"asvetliakov.vscode-neovim": 1
},
"git.confirmSync": false,
"github.copilot.enable": {
"quarto": false,
"*": true
},
"github.copilot.editor.enableAutoCompletions": true,
"cmake.pinnedCommands": [
"workbench.action.tasks.configureTaskRunner",
"workbench.action.tasks.runTask"
],
"cmake.showOptionsMovedNotification": false
}
1 change: 1 addition & 0 deletions setup_devenv/windows/packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ winget install --id Microsoft.Teams
winget install --id Microsoft.VCRedist.2015+.x64
winget install --id Microsoft.VisualStudioCode --override '/SILENT /mergetasks="!runcode,addcontextmenufiles,addcontextmenufolders"'
winget install --id Microsoft.WindowsTerminal
winget install --id Mobatek.MobaXterm
winget install --id Mozilla.Firefox
winget install --id Notepad++.Notepad++
winget install --id SMPlayer.SMPlayer
Expand Down

0 comments on commit a72f84f

Please sign in to comment.