chore: create triton profile on deploy script
This commit is contained in:
parent
14df2c703c
commit
e2245dd9c0
@ -34,8 +34,6 @@ deployment:
|
||||
- sudo chmod +x /usr/local/bin/docker-compose
|
||||
# install and setup triton
|
||||
- yarn global add triton@4.15.0 || cat /home/ubuntu/.yarn-config/global/yarn-error.log
|
||||
- echo '{"url":"https://eu-ams-1.api.joyent.com", "account":"'$SDC_ACCOUNT'", "keyId":"'$SDC_KEY_ID'", "name":"eu-ams-1", "curr":true}' | triton profile create -f -
|
||||
- triton env --docker eu-ams-1
|
||||
|
||||
development:
|
||||
branch: master
|
||||
|
@ -15,7 +15,27 @@ const NAMESPACE = 'quay.io/yldio';
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
const LOG = console.log;
|
||||
|
||||
const createTritonProfile = async ({ SDC_ACCOUNT = '', SDC_KEY_ID = '' }) => {
|
||||
LOG(`${figures.arrowRight} create triton profile SDC_ACCOUNT=${SDC_ACCOUNT.length} SDC_KEY_ID=${SDC_KEY_ID.length}`);
|
||||
|
||||
const payload = JSON.stringify({
|
||||
url: 'https://eu-ams-1.api.joyent.com',
|
||||
account: SDC_ACCOUNT,
|
||||
keyId: SDC_KEY_ID,
|
||||
name: 'eu-ams-1',
|
||||
curr: true
|
||||
});
|
||||
|
||||
const cp = execa('triton', ['profile', 'create', '-f', '-']);
|
||||
|
||||
cp.stdin.write(payload);
|
||||
|
||||
return cp;
|
||||
};
|
||||
|
||||
const getEnv = async () => {
|
||||
await createTritonProfile(process.env);
|
||||
|
||||
const tritonEnv = await execa.stdout('triton', ['env']);
|
||||
const dotEnv = tritonEnv.replace(/^export /gim, '');
|
||||
return Object.assign({}, process.env, parse(dotEnv));
|
||||
|
Loading…
Reference in New Issue
Block a user