vscode try
This commit is contained in:
parent
4d49a7d3b8
commit
48a5884cd8
@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 28,
|
"execution_count": 31,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 29,
|
"execution_count": 32,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 30,
|
"execution_count": 33,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
0
hetzner/sigma/computeC
Normal file → Executable file
0
hetzner/sigma/computeC
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 34,
|
"execution_count": 22,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 35,
|
"execution_count": 23,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 36,
|
"execution_count": 24,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -78,7 +78,7 @@
|
|||||||
"from hcloud.images.domain import Image\n",
|
"from hcloud.images.domain import Image\n",
|
||||||
"from hcloud.server_types.domain import ServerType\n",
|
"from hcloud.server_types.domain import ServerType\n",
|
||||||
"\n",
|
"\n",
|
||||||
"cloud_init_mysql=r'''#cloud-config\n",
|
"cloud_init_vscode=r'''#cloud-config\n",
|
||||||
"packages:\n",
|
"packages:\n",
|
||||||
" - apt-transport-https\n",
|
" - apt-transport-https\n",
|
||||||
" - ca-certificates\n",
|
" - ca-certificates\n",
|
||||||
@ -87,55 +87,29 @@
|
|||||||
" - software-properties-common\n",
|
" - software-properties-common\n",
|
||||||
"\n",
|
"\n",
|
||||||
"write_files:\n",
|
"write_files:\n",
|
||||||
" - path: /root/docker-compose.yml\n",
|
" - content: |\n",
|
||||||
" content: |\n",
|
" curl -fsSL https://code-server.dev/install.sh > /root/install.sh\n",
|
||||||
" version: '3.9'\n",
|
" path: /root/install.sh\n",
|
||||||
"\n",
|
" owner: root:root\n",
|
||||||
" services:\n",
|
" permissions: '755'\n",
|
||||||
" db:\n",
|
|
||||||
" image: mysql:5.7\n",
|
|
||||||
" restart: always\n",
|
|
||||||
" environment:\n",
|
|
||||||
" MYSQL_DATABASE: gitea\n",
|
|
||||||
" MYSQL_USER: gitea\n",
|
|
||||||
" MYSQL_PASSWORD: gitea\n",
|
|
||||||
" MYSQL_ROOT_PASSWORD: gitea\n",
|
|
||||||
" ports:\n",
|
|
||||||
" - \"10.10.10.2:3306:3306\"\n",
|
|
||||||
" volumes:\n",
|
|
||||||
" - my-db:/var/lib/mysql\n",
|
|
||||||
" phpmyadmin:\n",
|
|
||||||
" image: phpmyadmin\n",
|
|
||||||
" restart: always\n",
|
|
||||||
" ports:\n",
|
|
||||||
" - \"8080:80\"\n",
|
|
||||||
" volumes:\n",
|
|
||||||
" my-db: {}\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"runcmd:\n",
|
"runcmd:\n",
|
||||||
" - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -\n",
|
" - bash /root/install.sh\n",
|
||||||
" - add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"\n",
|
" - code-server --bind-addr 0.0.0.0:8080\n",
|
||||||
" - apt-get update -y\n",
|
|
||||||
" - apt-get install -y docker-ce docker-ce-cli containerd.io\n",
|
|
||||||
" - curl -L \"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose\n",
|
|
||||||
" - chmod +x /usr/local/bin/docker-compose\n",
|
|
||||||
" - systemctl start docker\n",
|
|
||||||
" - systemctl enable docker\n",
|
|
||||||
" - cd /root/ && docker-compose up -d\n",
|
|
||||||
" '''\n",
|
" '''\n",
|
||||||
"\n",
|
"\n",
|
||||||
"mysql_server = client.servers.create(\n",
|
"vscode_server = client.servers.create(\n",
|
||||||
" name=f\"{PREFIX}-mysql\", \n",
|
" name=f\"{PREFIX}-vscode\", \n",
|
||||||
" server_type=ServerType(\"cx11\"), \n",
|
" server_type=ServerType(\"cx11\"), \n",
|
||||||
" image=Image(name=\"ubuntu-20.04\"), \n",
|
" image=Image(name=\"ubuntu-20.04\"), \n",
|
||||||
" ssh_keys=[ssh_key], \n",
|
" ssh_keys=[ssh_key], \n",
|
||||||
" networks=[vnet], \n",
|
" networks=[vnet], \n",
|
||||||
" location=Location(\"hel1\"), \n",
|
" location=Location(\"hel1\"), \n",
|
||||||
" user_data=cloud_init_mysql\n",
|
" user_data=cloud_init_vscode\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"mysql_server.action.wait_until_finished()\n",
|
"vscode_server.action.wait_until_finished()\n",
|
||||||
"print(f\"Creating gitea server: {mysql_server.action.complete}\")"
|
"print(f\"Creating gitea server: {vscode_server.action.complete}\")"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user