- Changed STRAPI_URL from https://cms.placebo.mk to http://cms:1337 - Added cms dependency to backend service - This fixes Gateway Timeout errors when backend tries to fetch from Strapi - Enables proper container-to-container communication
37 lines
969 B
Bash
Executable File
37 lines
969 B
Bash
Executable File
#!/bin/bash
|
|
# Script to create Strapi API token via command line
|
|
# Run this on the VPS: ssh root@109.199.109.108 "bash -s" < create-strapi-token.sh
|
|
|
|
echo "Creating Strapi API token..."
|
|
|
|
# Execute inside the CMS container
|
|
docker exec placebo-cms node -e "
|
|
const strapi = require('@strapi/strapi');
|
|
|
|
(async () => {
|
|
try {
|
|
const app = await strapi.createStrapi().load();
|
|
|
|
const tokenService = app.service('admin::api-token');
|
|
|
|
const token = await tokenService.create({
|
|
name: 'Backend Integration',
|
|
description: 'Token for backend to fetch articles',
|
|
type: 'read-only',
|
|
permissions: [],
|
|
lifespan: null,
|
|
});
|
|
|
|
console.log('\n✅ API Token created successfully!');
|
|
console.log('\nCopy this token to Coolify as STRAPI_API_TOKEN:');
|
|
console.log(token.accessKey);
|
|
console.log('');
|
|
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('❌ Error:', error.message);
|
|
process.exit(1);
|
|
}
|
|
})();
|
|
"
|