Remove Dependence On External Assets #24
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
currently,
xaqt
relies on two external assets which must be accessed at runtime:when the
xaqt
package is installed on the$GOPATH
(e.g. from runninggo get github.com/frenata/xaqt
) then the dependence on these external assets causes no problems since the path to these external assets is correctly maintained.However, if the
xaqt
package is used as a library and is vendored, which is often the case with apps which require a stable deploy process, then the paths to these assets are no longer correctly maintained. This makes renders the library unusable in such situations.The main problem that this PR addresses is the reliance of the library on external assets. This is achieved by hard-coding the
compilers.json
into aCompilers
struct (naming itDEFAULT_COMPILERS
since that is, in fact, what it is) andCOPY
ing thedata/Payload
directory into the docker container at image build time rather than at runtime.Major Changes
DEFAULT_DOCKER_IMAGE
constantconnorwalsh/xaqt
fromfrenata/xaqt-sandbox
(this can be switched back once @frenata builds and pushes a new image)data/Payload
->entrypoint
entrypoint
directory into image in DockerfileReadCompilersFromJSON()
toGetCompilers()
GetCompilers
to be variadic s.t. if no args are provided it loads default compilersExecutionDetails.Disabled
fromstring
->bool
(not entirely sure why it was of typestring
to begin with, maybe i missed something(?))ExportToJSON()
method toCompilers
typedata/DockerTimeout.sh
anddata/compilers.json
since we don't need them anymoreentrypoint/script.sh
,entrypoint/mysql_runner.sh
to work with modified directory structure.CopyPayload()
method insandbox
since we are no longer copying thedata/Payload
directoryCaveats in Refactor
since we still need to mount a volume to insert the user code into the container, but we can't mount into the
entrypoint
directory without overwriting the directory (and thus deleting all the run scripts), we must mount/load the usercode into a separate directory than the run scripts. this results in the follows directory structure:this means that the run scripts need to call the code from the correct directory.
this PR resolves issue #23 and issue #11