![]() |
install | documentation | examples | changelog 16.10.0 released May 10, 2023
|
tar xvf /usr/share/vely/examples/velydocker.tar.gz cd velydocker export DBROOTPWD="<mariadb root database pwd>" export VV_APACHE_CONFIG="/etc/apache2/apache2.conf" export VV_APACHE_SERVICE="apache2" ./runvelydocker
#Add stock ticker 'XYZ' with stock price 450 http://127.0.0.1/velydemo/docker_stock?action=add&stock_name=XYZ&stock_price=450 #Display list of stock tickers http://127.0.0.1/velydemo/docker_stock?action=show
# #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
# #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" ]
#!/bin/bash # #Vely Docker example. # #if you want to rebuild all from scratch, switch CACHE to the commented option #that is useful when installing new Vely version in the base image CACHE="" #CACHE="--no-cache" set -eE -o functrace trap 'echo "Error: status $?, $(caller), line ${LINENO}"' ERR # #Build vely base image # sudo docker build --build-arg arch=$(uname -m) $CACHE -t vely . # #Create persistent named volume for /var/lib/vv in the container # sudo docker volume create velyhome # #Stop current container(s) and remove current images # sudo docker stop velyapp || true sudo docker rmi --force velyapp || true # #Build a container for your application # sudo docker build $CACHE -t velyapp -f velyapp.dockerfile . # #Add ProxyPass to Apache configuration on the host to be able to access the application #Web server is on the host for simplicity in this example, but it can be in its own container # sudo sed -i "/^ProxyPass \"\/velydemo\" .*$/d" $VV_APACHE_CONFIG echo 'ProxyPass "/velydemo" fcgi://127.0.0.1:2300/' | sudo tee -a $VV_APACHE_CONFIG >/dev/null sudo a2enmod proxy || true sudo a2enmod proxy_fcgi || true sudo service $VV_APACHE_SERVICE restart # #Create a MariaDB database on the host, setup the user and create database objects (a table in this case). #Database is on the host for simplicity in this example, but it can be in its own container # MKDB=$(echo "create database if not exists velydb; create user if not exists velyuser identified by 'pwd'; grant create,alter,drop,select,insert,delete,update on velydb.* to velyuser; use velydb; source docker/setup.sql;") # #Execute database setup. # if [ "$DBROOTPWD" == "" ]; then echo $MKDB | sudo mysql else echo $MKDB | sudo mysql -u root -p$DBROOTPWD fi mkdir -p $HOME/libvv # #Now that Vely application container is setup, web server and database setup as well, run it in a container. #Note that "host" network interface is used for simplicity. sudo docker run --name velyapp -d -v velyhome:/var/lib/vv --network="host" --rm velyapp exit 0
#!/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