Skip to content
This repository was archived by the owner on Jul 4, 2023. It is now read-only.

Commit e954940

Browse files
author
Riaan Nolan
committed
Merge branch 'feature/vscode-and-code-server' into 'master'
merge code-server and visual-studio-code See merge request all-staff/hashiqube!159
1 parent 29fc96b commit e954940

File tree

6 files changed

+91
-0
lines changed

6 files changed

+91
-0
lines changed

SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* [Ansible](ansible/README.md)
44
* [Ansible-tower](ansible-tower/README.md)
55
* [Apache-airflow](apache-airflow/README.md)
6+
* [Code-server](code-server/README.md)
67
* [Database](database/README.md)
78
* [Dbt](dbt/README.md)
89
* [Docker](docker/README.md)

Vagrantfile

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Vagrant::configure("2") do |config|
108108
config.vm.network "forwarded_port", guest: 18889, host: 18889 # apache airflow
109109
config.vm.network "forwarded_port", guest: 3333, host: 3333 # docsify
110110
config.vm.network "forwarded_port", guest: 8043, host: 8043 # ansible-tower
111+
config.vm.network "forwarded_port", guest: 7777, host: 7777 # vscode-server
111112
config.vm.network "forwarded_port", guest: 28080, host: 28080 # dbt docs serve
112113
config.vm.network "forwarded_port", guest: 8000, host: 8000 # markdown-quiz-generator
113114

@@ -252,6 +253,9 @@ Vagrant::configure("2") do |config|
252253
# vagrant up --provision-with localstack to only run this on vagrant up
253254
config.vm.provision "localstack", run: "never", type: "shell", preserve_order: true, privileged: false, path: "localstack/localstack.sh"
254255

256+
# vscode-server
257+
# vagrant up --provision-with vscode-server to only run this on vagrant up
258+
config.vm.provision "vscode-server", run: "never", type: "shell", preserve_order: true, privileged: false, path: "visual-studio-code/vscode-server.sh"
255259

256260
# vagrant up --provision-with ldap to only run this on vagrant up
257261
# run ldap docker container for testing with vault (for example) ldap login

code-server/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# VScode server
2+
https://code.visualstudio.com/
3+
4+
https://github.com/coder/code-server
5+
6+
VSCode is a free, open source IDE. Code-server runs an instance of VS code that can then be accessed locally via browser. This allows us to start up a predictable VScode instance in Vagrant.
7+
8+
![VSCode](images/vscode.png?raw=true "VSCode")
9+
10+
## Provision
11+
12+
In order to provision apache airflow you need bastetools, docker as dependencies.
13+
14+
```
15+
vagrant up --provision-with basetools --provider docker
16+
vagrant up --provision-with docker --provider docker
17+
vagrant up --provision-with code-server --provider docker
18+
```
19+
20+
## Web UI Access
21+
22+
To access the Web UI visit the following address:
23+
```
24+
http://localhost:7777/
25+
```
26+
27+
The default password will be printed to console on start up. Else it can be obtained by the following command:
28+
```
29+
vagrant ssh -c "< ~/.config/code-server/config.yaml head -n "3" | tail -n +"3""
30+
```
31+
32+
## Future plans
33+
34+
In the future there is potential to add an option for starting different code-server instances. Currently it always launches with the default image. Custom images could be setup that have different things preinstalled (e.g. Image with python, usefull libaries and useful extentions pre installed).

code-server/images/vscode.png

13 KB
Loading

visual-studio-code/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,33 @@ https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-cont
7676
:bulb: Remember to do `su - vagrant` and `cd /vagrant` to become the vagrant user so that you work as the vagrant user, you can then issue `kubectl` or `terraform` commands if you ran the provisioners first from a terminal on your laptop.
7777

7878
![VSCode](images/vscode-hashiqube-devcontainer.png?raw=true "VSCode")
79+
80+
# VScode Server VSCode in a Browser!
81+
82+
https://code.visualstudio.com/
83+
84+
https://github.com/coder/code-server
85+
86+
VSCode is a free, open source IDE. Code-server runs an instance of VS code that can then be accessed locally via browser. This allows us to start up a predictable VScode instance in Vagrant.
87+
88+
## Provision
89+
90+
In order to provision apache airflow you need bastetools, docker as dependencies.
91+
92+
`vagrant up --provision-with basetools,docker,vscode-server`
93+
94+
## Web UI Access
95+
96+
To access the Web UI visit the following address:
97+
```
98+
http://localhost:7777/
99+
```
100+
101+
The default password will be printed to console on start up. Else it can be obtained by the following command:
102+
```
103+
vagrant ssh -c "< ~/.config/code-server/config.yaml head -n "3" | tail -n +"3""
104+
```
105+
106+
## Future plans
107+
108+
In the future there is potential to add an option for starting different code-server instances. Currently it always launches with the default image. Custom images could be setup that have different things preinstalled (e.g. Image with python, usefull libaries and useful extentions pre installed).

visual-studio-code/vscode-server.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
# Run cleanup
3+
echo -e '\e[38;5;198m'"++++ Running cleanup"
4+
sudo docker stop code-server
5+
sudo docker rm code-server
6+
yes | sudo docker system prune -a
7+
yes | sudo docker system prune --volumes
8+
9+
echo -e '\e[38;5;198m'"++++ Installing Visual Studio Code Server from codercom's container https://hub.docker.com/r/codercom/code-server"
10+
mkdir -p ~/.config
11+
docker run -d --name code-server -p 0.0.0.0:7777:8080 \
12+
-v "$HOME/.config:/home/coder/.config" \
13+
-v "$PWD:/home/coder/project" \
14+
-v "/:/home/coder/vagrant_root"\
15+
-u "$(id -u):$(id -g)" \
16+
-e "DOCKER_USER=$USER" \
17+
codercom/code-server:latest
18+
19+
echo -e '\e[38;5;198m'"++++ Your VSCode instance should now be avaliable at http://localhost:7777/"
20+
echo -e '\e[38;5;198m'"++++ Login info is:"
21+
sleep 5
22+
echo -e '\e[38;5;198m'"++++ "$(< ~/.config/code-server/config.yaml head -n "3" | tail -n +"3")""

0 commit comments

Comments
 (0)