ci: Init Codespaces
This commit is contained in:
parent
0f93ccc6e9
commit
df19a74147
21
.devcontainer/devcontainer.json
Normal file
21
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "Frappe Bench",
|
||||||
|
"forwardPorts": [8000, 9000, 6787],
|
||||||
|
"remoteUser": "frappe",
|
||||||
|
"settings": {
|
||||||
|
"terminal.integrated.defaultProfile.linux": "bash",
|
||||||
|
"debug.node.autoAttach": "disabled"
|
||||||
|
},
|
||||||
|
"dockerComposeFile": "./docker-compose.yml",
|
||||||
|
"service": "frappe",
|
||||||
|
"workspaceFolder": "/workspace/frappe-bench",
|
||||||
|
"postCreateCommand": "bash /workspace/scripts/init.sh",
|
||||||
|
"shutdownAction": "stopCompose",
|
||||||
|
"extensions": [
|
||||||
|
"ms-python.python",
|
||||||
|
"ms-vscode.live-server",
|
||||||
|
"grapecity.gc-excelviewer",
|
||||||
|
"mtxr.sqltools",
|
||||||
|
"visualstudioexptteam.vscodeintellicode"
|
||||||
|
]
|
||||||
|
}
|
||||||
46
.devcontainer/docker-compose.yml
Normal file
46
.devcontainer/docker-compose.yml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
version: "3.7"
|
||||||
|
services:
|
||||||
|
mariadb:
|
||||||
|
image: mariadb:10.6
|
||||||
|
command:
|
||||||
|
- --character-set-server=utf8mb4
|
||||||
|
- --collation-server=utf8mb4_unicode_ci
|
||||||
|
- --skip-character-set-client-handshake
|
||||||
|
- --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: 123
|
||||||
|
volumes:
|
||||||
|
- mariadb-data:/var/lib/mysql
|
||||||
|
|
||||||
|
# Enable PostgreSQL only if you use it, see development/README.md for more information.
|
||||||
|
# postgresql:
|
||||||
|
# image: postgres:11.8
|
||||||
|
# environment:
|
||||||
|
# POSTGRES_PASSWORD: 123
|
||||||
|
# volumes:
|
||||||
|
# - postgresql-data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
redis-cache:
|
||||||
|
image: redis:alpine
|
||||||
|
|
||||||
|
redis-queue:
|
||||||
|
image: redis:alpine
|
||||||
|
|
||||||
|
redis-socketio:
|
||||||
|
image: redis:alpine
|
||||||
|
|
||||||
|
frappe:
|
||||||
|
image: frappe/bench:latest
|
||||||
|
command: sleep infinity
|
||||||
|
environment:
|
||||||
|
- SHELL=/bin/bash
|
||||||
|
volumes:
|
||||||
|
- ..:/workspace:cached
|
||||||
|
working_dir: /workspace/frappe-bench
|
||||||
|
ports:
|
||||||
|
- 8000-8005:8000-8005
|
||||||
|
- 9000-9005:9000-9005
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mariadb-data:
|
||||||
|
postgresql-data:
|
||||||
71
.vscode/launch.json
vendored
Normal file
71
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
// 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": [
|
||||||
|
{
|
||||||
|
"name": "Bench Web",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
|
||||||
|
"args": [
|
||||||
|
"frappe", "serve", "--port", "8000", "--noreload", "--nothreading"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench/sites",
|
||||||
|
"env": {
|
||||||
|
"DEV_SERVER": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bench Default Worker",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
|
||||||
|
"args": [
|
||||||
|
"frappe", "worker", "--queue", "default"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench/sites",
|
||||||
|
"env": {
|
||||||
|
"DEV_SERVER": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bench Short Worker",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
|
||||||
|
"args": [
|
||||||
|
"frappe", "worker", "--queue", "short"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench/sites",
|
||||||
|
"env": {
|
||||||
|
"DEV_SERVER": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bench Long Worker",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
|
||||||
|
"args": [
|
||||||
|
"frappe", "worker", "--queue", "long"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench/sites",
|
||||||
|
"env": {
|
||||||
|
"DEV_SERVER": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Honcho SocketIO Watch Schedule Worker",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "/home/frappe/.local/bin/honcho",
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench",
|
||||||
|
"console": "internalConsole",
|
||||||
|
"args": [
|
||||||
|
"start", "socketio", "watch", "schedule", "worker_short", "worker_long", "worker_default"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
18
.vscode/settings.json
vendored
Normal file
18
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"python.defaultInterpreterPath": "frappe-bench/env/bin/python",
|
||||||
|
"debug.node.autoAttach": "disabled",
|
||||||
|
"sqltools.connections": [
|
||||||
|
{
|
||||||
|
"mysqlOptions": {
|
||||||
|
"authProtocol": "default"
|
||||||
|
},
|
||||||
|
"previewLimit": 50,
|
||||||
|
"server": "mariadb",
|
||||||
|
"port": 3306,
|
||||||
|
"driver": "MariaDB",
|
||||||
|
"name": "MariaDB",
|
||||||
|
"username": "root",
|
||||||
|
"password": "123"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
46
scripts/init.sh
Normal file
46
scripts/init.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#!bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ -f "/workspaces/frappe_codespace/frappe-bench/apps/frappe" ]]
|
||||||
|
then
|
||||||
|
echo "Bench already exists, skipping init"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf /workspaces/frappe_codespace/.git
|
||||||
|
|
||||||
|
source /home/frappe/.nvm/nvm.sh
|
||||||
|
nvm alias default 18
|
||||||
|
nvm use 18
|
||||||
|
|
||||||
|
echo "nvm use 18" >> ~/.bashrc
|
||||||
|
cd /workspace
|
||||||
|
|
||||||
|
bench init \
|
||||||
|
--ignore-exist \
|
||||||
|
--skip-redis-config-generation \
|
||||||
|
frappe-bench
|
||||||
|
|
||||||
|
cd frappe-bench
|
||||||
|
|
||||||
|
# Use containers instead of localhost
|
||||||
|
bench set-mariadb-host mariadb
|
||||||
|
bench set-redis-cache-host redis-cache:6379
|
||||||
|
bench set-redis-queue-host redis-queue:6379
|
||||||
|
bench set-redis-socketio-host redis-socketio:6379
|
||||||
|
|
||||||
|
# Remove redis from Procfile
|
||||||
|
sed -i '/redis/d' ./Procfile
|
||||||
|
|
||||||
|
|
||||||
|
bench new-site dev.localhost \
|
||||||
|
--mariadb-root-password 123 \
|
||||||
|
--admin-password admin \
|
||||||
|
--no-mariadb-socket
|
||||||
|
|
||||||
|
bench --site dev.localhost set-config developer_mode 1
|
||||||
|
bench --site dev.localhost clear-cache
|
||||||
|
bench use dev.localhost
|
||||||
|
bench get-app crm
|
||||||
|
bench --site dev.localhost install-app crm
|
||||||
Loading…
x
Reference in New Issue
Block a user