Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dockerize #13

Merged
merged 30 commits into from Oct 6, 2021
Merged

Feature/dockerize #13

merged 30 commits into from Oct 6, 2021

Conversation

RachitGod
Copy link
Contributor

No description provided.

@tholcman
Copy link

Can we create src/config.ts which will contain the whole logic of getting configuration?

enum ConfigOption {
    KMS_PASSWORD = 1,
    VGS_ALIAS,
    // ...
}

class Config {
    private _configOptions = {
        [ConfigOption.KMS_PASSWORD]: {
            environmentKey: "TATUM_KMS_PASSWORD",
            question: "Enter password to access wallet store:"
        },
        [ConfigOption.VGS_ALIAS]: {
            environmentKey: "TATUM_KMS_VGS_ALIAS",
            question: "Enter alias to obtain from VGS Vault API:"
        }
    }

    public getValue(what: ConfigOption): string {
        // if env var exist return
        // else if passed as CLI option return
        // else if not interactive throw exception or print error and exit
        // else ask question
        return "..."
    }
}

// then in index.ts
import {ConfigOption, Config} from './config'
var config = new Config()
config.getValue(ConfigOption.KMS_PASSWORD)

All env vars have to be prefixed by TATUM_KMS_.

Not all things you have changed to getQuestion does make sense f.e.: MNEMONIC in storeWallet ... it is not configuration and shouldn't be read from env vars.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/config.ts Outdated Show resolved Hide resolved
src/config.ts Outdated Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
src/signatures.ts Outdated Show resolved Hide resolved
src/signatures.ts Outdated Show resolved Hide resolved
Dockerfile Outdated

# Install supporting libraries

RUN apt-get install -y libusb-1.0-0-dev usbutils

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be nice to have apt-get commands in one RUN statement as recommended by dockerfile best practices:
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
It helps keeping the image minimal and clean.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can modify the Dockerfile if you want.


WORKDIR /usr/src/app

RUN apt-get update && apt-get install -y libusb-1.0-0-dev usbutils

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to bother again... As mentioned in the best practices it's advised to finish the line with && rm -rf /var/lib/apt/lists/* to clean up the apt lists downloaded by apt-get update.

run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

- name: build image
run: docker build . --file Dockerfile -t ${{secrets.DOCKER_USER}}/tatum-kms
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to have 2 tags - latest and from the package.json

@Hathoriel Hathoriel force-pushed the feature/dockerize branch 2 times, most recently from a51cc6a to c99cef8 Compare October 6, 2021 12:32
@samuelsramko samuelsramko merged commit 9cb6c44 into master Oct 6, 2021
@samuelsramko samuelsramko deleted the feature/dockerize branch October 6, 2021 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants