Skip to content
Snippets Groups Projects
Commit 4ef7db90 authored by Yordan Kinkov's avatar Yordan Kinkov
Browse files

Merge branch '4-add-setup-script' into 'main'

Resolve "Setup script"

Closes #4

See merge request !2
parents ffe88ddc 567ccb01
No related branches found
No related tags found
1 merge request!2Resolve "Setup script"
......@@ -14,7 +14,27 @@ with environment variables which will be injected in its container.
## Setup Workspace
TODO
* create directory:
```
mkdir -p $GOPATH/src/code.vereign.com/gaiax/tsa/
```
* move in the previously created directory:
```
cd $GOPATH/src/code.vereign.com/gaiax/tsa/
```
* clone the repository:
```
git clone git@code.vereign.com:gaiax/tsa/workspace.git
```
* run the setup.sh script:
```
./setup.sh
```
* set the services you would like to use in the docker-compose.yml file, defaults is **infohub**
* run docker compose:
```
docker-compose up
```
## 3rd Party Services
......
setup.sh 0 → 100755
#! /bin/bash
# ------------
# IMPORTANT!
#
# This script uses an environment variable named 'email' to properly
# configure git repos upon checkout. If you don't have it set in your
# environment, the email of the git repos will be set to an empty value.
# For best experience, set the variable in your .bashrc, .zshrc, etc.
#
# export email="lyuben.penkovski@vereign.com"
# ------------
# pull the master branch of a given git repository.
# User will be prompted for manual action if another branch is checked out or a problem occurs.
# $1 - name of the repo to pull.
function pull() {
local repo=$1
pushd "${repo}"
local branch=`git rev-parse --abbrev-ref HEAD`
if [ $branch == "master" ]; then
echo "Pulling ${repo}/master..."
git pull origin master || read -p "Could not pull ${repo}/master. Fix the issue and press ENTER to continue:"
else
echo "${repo}/${branch} is checked out"
read -p "Pull ${repo} manually now or press ENTER to skip:"
fi
popd
}
# getServices clones or pulls the services with separate repos
# in ${GOPATH}/src/code.vereign.com/gaiax/tsa
function getServices() {
local GAIAX_TSA_DIR="${GOPATH}/src/code.vereign.com/gaiax/tsa"
mkdir -p "${GAIAX_TSA_DIR}" && cd "$_"
local services=(
"infohub"
)
for repo in ${services[@]}; do
echo
if [ -d "${repo}" ]; then
pull $repo
continue
fi
mkdir -p "$GAIAX_TSA_DIR/$repo" && pushd "$GAIAX_TSA_DIR/$repo"
echo "Cloning $repo repository to $GAIAX_TSA_DIR/$repo"
git clone "ssh://git@code.vereign.com/gaiax/tsa/${repo}.git" .
if [ ! -d "./vendor" ]; then
go mod tidy && go mod vendor # download dependencies to vendor
fi
git config user.email $EMAIL && popd
done
}
getServices
echo
echo "All repos are updated successfully."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment