3.2 KiB
3.2 KiB
Deploy Setup Guide
This guide explains how to configure the admin dashboard to deploy to your main KHY website when they are in separate repositories.
Repository Structure Examples
Example 1: Sibling Directories
Documents/
├── khy_website/ # Main website repository
│ ├── index.html
│ ├── data/
│ └── assets/
└── khy_admin/ # Admin repository
├── admin.html
├── data/
└── assets/
Setup: Run npm run setup and enter ../khy_website
Example 2: Different Parent Directories
Documents/
├── projects/
│ └── khy_website/ # Main website repository
└── admin_tools/
└── khy_admin/ # Admin repository
Setup: Run npm run setup and enter ../../projects/khy_website
Example 3: Absolute Paths
/Users/george/Documents/khy_website/ # Main website
/Users/george/Documents/admin_tools/ # Admin repository
Setup: Run npm run setup and enter /Users/george/Documents/khy_website
Setup Process
-
Run the setup script:
npm run setup -
Enter the path to your main KHY website:
- Use relative paths like
../khy_websiteor../../projects/khy_website - Use absolute paths like
/full/path/to/khy_website
- Use relative paths like
-
Verify the configuration:
- The script will check if the path exists
- It will verify required files are present
- It will update
deploy-config.jswith your settings
Manual Configuration
If you prefer to configure manually, edit deploy-config.js:
module.exports = {
targets: {
main: "../khy_website", // Change this to your path
},
defaultTarget: "main",
// ... rest of config
};
Testing the Setup
After setup, test the configuration:
# Test with the configured path
npm run deploy
# Test with a specific path
node deploy.js /path/to/your/khy_website
Troubleshooting
"Target directory does not exist"
- Check the path you entered during setup
- Use absolute paths if relative paths don't work
- Make sure the main website directory exists
"Missing required files"
- Ensure your main website has
index.htmlanddata/products.json - The admin will create these files if they don't exist
"Permission denied"
- Make sure you have write permissions to the main website directory
- On macOS/Linux, you might need to adjust file permissions
Advanced Usage
Multiple Targets
You can configure multiple deployment targets:
targets: {
staging: "../khy_website_staging",
production: "../khy_website",
backup: "/backup/khy_website"
}
Then deploy to specific targets:
node deploy.js staging
node deploy.js production
Custom File Mappings
Modify filesToCopy in deploy-config.js to copy different files:
filesToCopy: [
{
source: "data/products.json",
target: "data/products.json",
description: "Product catalog data",
},
{
source: "assets/images",
target: "assets/images",
description: "Product images",
isDirectory: true,
},
{
source: "config/settings.json",
target: "config/admin-settings.json",
description: "Admin settings",
},
];