# go-execer **Repository Path**: smith/go-execer ## Basic Information - **Project Name**: go-execer - **Description**: 简单go在线编译执行环境 - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-17 - **Last Updated**: 2023-11-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Guide **Go Execer** is a Go language execution tool built using React and Golang, similar to Go Playground. ![UI](./doc/source/ui.jpg) # Deploy (Linux) ### 0. dependencies docker, docker-compose ### 1. prepare server/.env file ```bash cp server.env.example server.env ``` **SERVER_PORT** should be same with the proxy port in app/deploy/config.d/default.conf (default 80) **HOST_FILE_DIR_PATH** the absolute path of server/files ### 2. modify docker-compose.yml Using the "docker" command to start an isolated container environment, so it is necessary to mount the host's Docker process into the container. ```yml # notice the "volumes" of server part goexecer-server: stdin_open: true tty: true build: ./server container_name: goexecer-server env_file: - ./server/.env ports: - "9800:80" volumes: - $1:/app/files - /usr/bin/docker:/usr/bin/docker - /var/run/docker.sock:/var/run/docker.sock ``` **volumes[0].$1** is the absolute path of server/files should be same with HOST_FILE_DIR_PATH in server/.env ### 3. docker-compose up ```bash # use docker-compose to start the server docker-compose up -d ``` # Dev ### 0. dependencies docker, go, node ### 1. Start Frontend ```bash cd /app pnpm install pnpm dev ``` Using UmiJS as the scaffolding tool and Ant Design as the UI library, with LocalStorage as the browser's local storage mechanism. ### 2. Config the Server .env file ```bash cp server/.env.sample server/.env vim .env ``` **SERVER_PORT** is the server listening port **HOST_FILE_DIR_PATH** is the absolute path of server/files ### 3. Start Backend ```bash /server go mod download go run main.go ``` Developing with Golang, using Gin as the web framework, and utilizing Docker for a sandbox environment for executing Golang code. ### 4. Config Frontend Proxy ```javascript // change the target to local server url proxy: { '/go-execer/api': { 'target': 'http://127.0.0.1/', 'changeOrigin': true, 'pathRewrite': { '^/go-execer/api' : '' }, } } ``` # Notice ## 1. If you have the error output like 'stat /app/execer.go; no such file or directory' Typically, this indicates that there is an error in the file path mounting for the container "goexecer-server." **When Develop** It could be because the variable "HOST_FILE_DIR_PATH" in server/.env is not configured. [Check](#dev-config-env) **When Deploy** It could be because the variable "HOST_FILE_DIR_PATH" in server/.env is not configured, or it may not match the absolute path of "server/files" mounted by Docker Compose on the host machine. [Check](#deploy-config-env)