This document intends to provide information on how to get the Vela migration utility running locally.
- Docker - building block for local development
- Golang - for source code and dependency management
- Make - start up local development
NOTE: Please review the prerequisites section before moving forward.
- Clone this repository to your workstation:
# clone the project
git clone [email protected]:go-vela/community.git $HOME/go-vela/community
- Navigate to the repository code:
# change into the project directory
cd $HOME/go-vela/community/migrations/v0.16
- Set the environment variables for the database driver and configuration string in your local terminal:
# set the driver for the Vela database
export VELA_DATABASE_DRIVER=<database driver from Vela server>
# set the address for the Vela database
export VELA_DATABASE_ADDR=<database address from Vela server>
NOTE: Please review the setup section before moving forward.
This section covers the commands required to get the Vela application running locally.
- Navigate to the repository code:
# change into the project directory
cd $HOME/go-vela/community/migrations/v0.16
This method of running the application uses the Golang binary built from the source code.
- Build the Golang binary targeting different operating systems and architectures:
# execute the `build` target with `make`
make build
# This command will output binaries to the following locations:
#
# * $HOME/go-vela/community/migrations/v0.16/release/darwin/amd64/vela-migration
# * $HOME/go-vela/community/migrations/v0.16/release/linux/amd64/vela-migration
# * $HOME/go-vela/community/migrations/v0.16/release/linux/arm64/vela-migration
# * $HOME/go-vela/community/migrations/v0.16/release/linux/arm/vela-migration
# * $HOME/go-vela/community/migrations/v0.16/release/windows/amd64/vela-migration
- Run the Golang binary for the specific operating system and architecture:
# run the Go binary for a Darwin (MacOS) operating system with amd64 architecture
release/darwin/amd64/vela-migration --action.all
release/darwin/amd64/vela-migration --action.all --trusted-update.privileged-images "alpine","npm" --trusted-update.allow-personal-orgs false
# run the Go binary for a Linux operating system with amd64 architecture
release/linux/amd64/vela-migration --action.all
# run the Go binary for a Linux operating system with arm64 architecture
release/linux/arm64/vela-migration --action.all
# run the Go binary for a Linux operating system with arm architecture
release/linux/arm/vela-migration --action.all
# run the Go binary for a Windows operating system with amd64 architecture
release/windows/amd64/vela-migration --action.all
This method of running the application uses a Docker container built from the Dockerfile
.
- Build the Docker image:
# execute the `docker-build` target with `make`
make docker-build
# This command is functionally equivalent to:
#
# docker build --no-cache -t target/vela-migration:local .
- Run the Docker image
# execute the `run` target with `make`
make run
# This command is functionally equivalent to:
#
# docker run --rm \
# -e VELA_ACTION_ALL=true \
# -e VELA_DATABASE_DRIVER \
# -e VELA_DATABASE_ADDR \
# target/vela-migration:local
- Run the Docker image with custom parameters
docker run --rm \
-e VELA_ACTION_ALL=true \
-e VELA_DATABASE_DRIVER \
-e VELA_DATABASE_ADDR \
-e VELA_RUNTIME_PRIVILEGED_IMAGES="npm","alpine" \
-e VELA_ALLOW_PERSONAL_ORGS=false \
target/vela-migration:local