diff --git a/README.md b/README.md index 87b6f6a..b3cd0a6 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,69 @@ -###### Development +# Readme + +## Development Prerequisites: + - `curl` or `wget` - `jq` - an account for Symbiont's portal -```shell -source ./test.sh -``` +### Usage -For usage against the staging portal, append a `--registry=` to commands that perform remote operations. Note that -you will also need to use a token created by said registry in order for authentication to work. If need be, use `symenv reset` -to clear your authentication token. -```shell -symenv install --registry=portal-staging.waf-symbiont.io -``` +1. Prepare the environment. + + ```shell + source ./test.sh + ``` + + You should see output similar to this. + + ```shell + => Downloading symenv as script to '/root/.symbiont' + [1]- Done symenv_download -s "$SYMENV_SOURCE_LOCAL" -o "$INSTALL_DIR/symenv.sh" || { symenv_echo "Failed to download '$SYMENV_SOURCE_LOCAL'" 1>&2; return 1; } + [2]+ Done symenv_download -s "$SYMENV_BASH_COMPLETION_SOURCE" -o "$INSTALL_DIR/bash_completion" || { symenv_echo "Failed to download '$SYMENV_BASH_COMPLETION_SOURCE'" 1>&2; return 2; } + + => Append to profile file then close and reopen your terminal to start using symenv or run the following to use it now: + + export SYMENV_DIR="$HOME/.symbiont" + [ -s "$SYMENV_DIR/symenv.sh" ] && \. "$SYMENV_DIR/symenv.sh" # This loads symenv + [ -s "$SYMENV_DIR/versions/current" ] && export PATH="$SYMENV_DIR/versions/current/bin":$PATH # This loads symenv managed SDK + [ -s "$SYMENV_DIR/bash_completion" ] && \. "$SYMENV_DIR/bash_completion" # This loads symenv bash_completion + ``` -###### Installation +2. Choose a registry by appending the `--registry=` flag to commands + that perform remote operations. + + > Note that you will also need to use a token created by said registry + > in order for authentication to work. + > + > If need be, use `symenv reset` to clear your authentication token. + +3. Install the environment. + + ```shell + symenv install --registry=portal-staging.waf-symbiont.io + ``` + +## Installation Prerequisites: + - `curl` or `wget` - `jq` - an account for Symbiont's portal Remotely + ```shell curl --proto '=https' --tlsv1.2 -sSf https:////install.sh | bash -``` -eg. -```shell +# Example + curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/symbiont-io/symenv/main/install.sh | bash ``` -###### Commands +### Commands ```help Usage: @@ -52,4 +82,3 @@ Usage: --all Include the non-release versions symenv reset Resets your environment to a fresh install of symenv ``` - diff --git a/docker/.bashrc b/docker/.bashrc new file mode 100644 index 0000000..7b02b91 --- /dev/null +++ b/docker/.bashrc @@ -0,0 +1,36 @@ +#!/bin/bash +# shellcheck disable=SC1091 + +CLICOLOR=1 +# shellcheck disable=SC2016 +LESS='-R --use-color -Dd+r$Du+b$' +LSCOLORS="Ea" +PS1="[\[$(tput sgr0)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[\033[3f8;5;15m\]@\[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;6m\]\H\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;46m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]]{\[$(tput sgr0)\]\[\033[38;5;57m\]\$?\[$(tput sgr0)\]\[\033[38;5;15m\]} \[$(tput sgr0)\]" + +# shellcheck disable=SC1091 +if [ -f /usr/share/bash-completion/bash_completion ]; then + source /usr/share/bash-completion/bash_completion +fi + +SYMENV_DIR="$HOME/.symbiont" + +# This loads symenv +if [ -s "$SYMENV_DIR/symenv.sh" ]; then + /bin/bash "$SYMENV_DIR/symenv.sh" +fi +# This loads symenv managed SDK +if [ -s "$SYMENV_DIR/versions/current" ]; then + PATH="$SYMENV_DIR/versions/current/bin:$PATH" + export PATH +fi + +# This loads symenv bash_completion +if [ -s "$SYMENV_DIR/bash_completion" ]; then + source "$SYMENV_DIR/bash_completion" +fi + +export CLICOLOR +export LESS +export LSCOLORS +export PS1 +export PATH diff --git a/docker/.zshrc b/docker/.zshrc new file mode 100644 index 0000000..f67bbb0 --- /dev/null +++ b/docker/.zshrc @@ -0,0 +1,10 @@ +#!/usr/bin/zsh + +export SYMENV_DIR="$HOME/.symbiont" + +# This loads symenv +[ -s "$SYMENV_DIR/symenv.sh" ] && \. "$SYMENV_DIR/symenv.sh" +# This loads symenv managed SDK +[ -s "$SYMENV_DIR/versions/current" ] && export PATH="$SYMENV_DIR/versions/current/bin":$PATH +# This loads symenv bash_completion +[ -s "$SYMENV_DIR/bash_completion" ] && \. "$SYMENV_DIR/bash_completion" \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..1ee7b11 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,19 @@ +FROM archlinux/archlinux:base-devel +RUN pacman -Syyu --noconfirm \ + bash_completion \ + curl \ + git \ + jq \ + unzip \ + vim \ + wget \ + zip \ + zsh \ + && ln -sfv /usr/bin/vim /usr/bin/vi \ + && mkdir -pv /usr/src/symenv/docker +WORKDIR /usr/src/symenv +COPY docker/test.sh /usr/src/symenv/docker/test.sh +RUN /bin/bash /usr/src/symenv/docker/test.sh +COPY docker/.zshrc /root/.zshrc +COPY docker/.bashrc /root/.bashrc +CMD ["/bin/bash"] \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..03b9cd0 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,54 @@ +# Symenv Docker Build + +There are two steps here. + +1. Build the Docker image to run locally. + + ```shell + docker build -t ghcr.io/platonic-io/symenv:${USER}-$(date +%Y-%m-%d) -f docker/Dockerfile --progress plain . + ``` + +2. Add required volumes. + 1. The Symbiont Node requires this repository and the + symbiont-node repository to run. Provide these with bind mounts or + volumes. + 2. To use a bind mount + 1. Clone the symbiont-node repository to the parent + directory of this repository's root + 2. Run the container using the bind mount step below + 3. To use volumes + 1. Create the volumes + + ```shell + docker volume create symenv + docker volume create symbiont-node + ``` + + 2. Run the container using the volumes step below + 3. Copy the repositories into each volume once the container is running + + ```shell + SYMBIONT_NODE_REPO_PATH="/home/${USER}/Documents/src/github.com/platonic-io/symbiont-node" + SYMENV_REPO_PATH="/home/${USER}/Documents/src/github.com/platonic-io/symenv" + + docker copy $SYMBIONT_NODE_REPO_PATH symbiont-node:/usr/src/symbiont-node + docker copy $SYMENV symenv:/usr/src/symenv + ``` + +3. Run a container named `symenv` with the image we just built. + 1. Using a bind mount. + + ```shell + docker run --name symenv \ + -v /home/${USER}/Documents/src/github.com/platonic-io/symbiont-node:/usr/src/symbiont-node \ + -v $(pwd):/usr/src/symenv -it ghcr.io/platonic-io/symenv:${USER}-${date +%Y-%m-%d} bash + ``` + + 2. Using volumes + + ```shell + docker run --name symenv \ + -v symenv:/usr/src/symenv \ + -v symbiont-node:/usr/src/symbiont-node \ + -it ghcr.io/platonic-io/symenv:${USER}-${date +%Y-%m-$d} bash + ``` diff --git a/docker/test.sh b/docker/test.sh new file mode 100644 index 0000000..289e7d5 --- /dev/null +++ b/docker/test.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +SYM_DIR="$(pwd)" + +export SYM_DIR + +if [ -s "$SYM_DIR/symenv.sh" ]; then + /bin/sh "$SYM_DIR/symenv.sh" +fi