akamai / cli-sandbox

Akamai CLI for Sandbox
https://github.com/akamai/cli
Apache License 2.0
13 stars 12 forks source link

Dockerized akamai sandbox cli #38

Closed jazzista88 closed 3 years ago

jazzista88 commented 5 years ago

HI,

I'm reporting an issue and making a question.

1) the issue, trying to automate the sandbox creation by using docker container, when i install the akamai sandbox inside my container using akamai install sandbox command, i see that the /bin folder is not downloaded within the cli-sandbox folder .akamai-cli/src/cli-sandbox/ and this generate an error launching any type of sandbox command.

Internal/modules/cjs/loader.js:584
throw err;
^

Error: Cannot find module './bin/cli-main.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/root/.akamai-cli/src/cli-sandbox/akamai-sandbox:3:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)

I'm currently using the /bin folder on my pc making a copy on the container but it is just . a workaround.

2)When i launch a container to create a new sandbox i would like to save all the sandbox folder commonly under .akamai-cli/cache/sandbox-cli/sandboxes/, to another location so that, when the container will be destroyed i can maintain the sandbox definition files locally.

Thanks

n0mer commented 4 years ago

@jazzista88

Work-around:

Step 1

docker run -ti -v $HOME/.akamai-cli:/root/.akamai-cli -v $HOME/.edgerc:/root/.edgerc akamaiopen/cli

Step 2

docker exec -it happy_panini /bin/sh

(where happy_panini is the name of Docker container just started)

Step 3

~/.akamai-cli/src/cli-sandbox # tar -cvf bin.tar bin/*

bin/cli-main.js

bin/cli-main.js.map

bin/service/

bin/service/sandbox-datastore.js.map

bin/service/sandbox-client-manager.js

bin/service/sandbox-record.js.map

bin/service/sandbox-svc.js

bin/service/sandbox-datastore.js

bin/service/sandbox-svc.js.map

bin/service/sandbox-client-manager.js.map

bin/service/sandbox-record.js

bin/utils/

bin/utils/cli-utils.js.map

bin/utils/edgerc-parser.js.map

bin/utils/edgerc-parser.js

bin/utils/env-utils.js

bin/utils/cli-utils.js

bin/utils/env-utils.js.map

Step 4

~/.akamai-cli/src/cli-sandbox # cp bin.tar /cli/.akamai-cli/src/cli-sandbox/

Step 5

/cli/.akamai-cli/src/cli-sandbox # tar -xvf bin.tar

bin/cli-main.js

bin/cli-main.js.map

bin/service/

bin/service/sandbox-datastore.js.map

bin/service/sandbox-client-manager.js

bin/service/sandbox-record.js.map

bin/service/sandbox-svc.js

bin/service/sandbox-datastore.js

bin/service/sandbox-svc.js.map

bin/service/sandbox-client-manager.js.map

bin/service/sandbox-record.js

bin/utils/

bin/utils/cli-utils.js.map

bin/utils/edgerc-parser.js.map

bin/utils/edgerc-parser.js

bin/utils/env-utils.js

bin/utils/cli-utils.js

bin/utils/env-utils.js.map

n0mer commented 4 years ago

Cross-reference: #24

krzyk commented 4 years ago

pending https://github.com/akamai/cli/pull/97

javiergarza commented 4 years ago

ciao @jazzista88!

I have been collaborating with a couple of other developers at Akamai to create docker images that people can use for DevOps automation.

We have created an initial golden image at https://hub.docker.com/repository/docker/akamai/akamai-docker that contains most of the Akamai tools people may need.

We are now working on creating a workflow to allow generating a-la-carte smaller images for automating specific tasks, so you could for example create a small image with just the sandbox-cli.

Would that be of interest to you? Feel free to comment on https://github.com/akamai/akamai-docker/issues/2

lkowalsk-akamai-com commented 3 years ago

Hi, we've moved Dockerfile for CLI to akamai-docker (https://github.com/akamai/akamai-docker/blob/master/dockerfiles/cli.Dockerfile). Please use this image (or one of the other images available under akamai account in Docker Hub).

krzyk commented 3 years ago

@jazzista88 As mentioned by @lkowalsk-akamai-com There are new docker files that should be used for running akamai cli:

docker run -it -v $HOME/.edgerc:/root/.edgerc:ro akamai/shell

As described in https://developer.akamai.com/cli/docs/getting-started#install-with-docker