install | documentation | examples | articles | changelog
16.6.0 released on Mar 08, 2023 | articles updated on Mar 20, 2023
Create an image with - use --no-cache in order to update the image when new Vely release is available:
# #Create base vely image. Install Vely on top of Ubuntu 20.04 # FROM ubuntu:20.04 ENV TZ=America/Phoenix RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt update RUN apt install -y apt-transport-https ca-certificates wget sudo RUN wget -qO - https://vely.dev//pkg/OPENPGP|sudo tee /usr/share/keyrings/vely.asc >/dev/null ARG arch RUN sudo bash -c "echo 'deb [signed-by=/usr/share/keyrings/vely.asc] https://vely.dev//pkg/ubuntu_20_$arch/latest ubuntu_20_$arch vely' >/etc/apt/sources.list.d/vely.list" RUN sudo apt update RUN sudo apt install -y vely
In some cases your application is stateless, i.e. all the data is through to database(s) and other applications. In other cases, you may want to have file storage that persists even when containers recycle - typically that means persisting Vely directory (which is /var/lib/vv, see how_vely_works). In that case, you can use a container storage option for that purpose; in case of docker, that would be volumes, for instance:
sudo docker build --no-cache -t vely .
For example, if your application uploads/downloads files, you may use Vely file_storage (which is under /var/lib/vv); or you may store other files that your application produces. In such cases using a volume (or similar) may be a good idea; in other cases you may want a stateless container and offload such functionality elsewhere (for instance to databases, other applications etc.).
sudo docker volume create velyhome
The "runit" script will create an application in the container, build it, and start it in the foreground. This script is in the "docker" directory with your application source code:
# #Create image that will be used to compile and link an application. Source code is copied from host, #application is setup, and the source code is deleted (remove this step if you want to ship the source code). #After that the image is ready to run in a container. Here, the application name is "velydemo"; change it to #fit your application. The port used in 2300, you can change that as well. #Customize the ENTRYPOINT command to fit your runtime. # FROM vely #create vely user and give it limited sudo powers RUN useradd -ms /bin/bash vely && echo "vely:vely" | chpasswd RUN echo "vely ALL=(ALL) NOPASSWD: /usr/bin/vf" >> /etc/sudoers #default user USER vely #default working dir WORKDIR /home/vely EXPOSE 2300 #copy over source code and make app COPY ./docker/* /home/vely/ #this is to run app with docker run ENTRYPOINT [ "./runit" ]
Stop and remove any current containers/images:
#!/bin/bash #Create Vely application and run it in foreground for docker #demout has a log of execution sudo vf -i -u $(whoami) velydemo vv -c vv -q --db=mariadb:db -s vv -c vf -f -w3 -p2300 velydemo > demout
Build an application image:
sudo docker stop velyapp || true sudo docker rmi velyapp || true
Assuming you have setup web server and any database(s), start the container (using "host" network interface for simplicity):
sudo docker build --no-cache -t velyapp -f velyapp.dockerfile .
If your application uses volumes for data persistence, you might use:
sudo docker run --init --name velyapp -d --network="host" --rm velyapp velyapp
Note that you can persist any storage you want, however at the minimum you would likely persist Vely directory (/var/lib/vv) which is stored on the host under volume "velyhome".
sudo docker run --init --name velyapp -d -v velyhome:/var/lib/vv --network="host" --rm velyapp