5a41478789
Summary: Add postinst script for DEB package The script creates a 'memgraph' group and sets permission on installed '/var/*/memgraph' directories. Only the group is created, while 'memgraph' user is not. It seems more sane only to require group membership for using memgraph. Add conffiles for DEB package This allows for `dpkg` to detect changes in configuration files and present them to the user. Therefore, we don't need to care whether the configuration merges are handled correctly nor if we accidentally overwrite them. Add postrm script for DEB packaging The script is only used so that `dpkg --purge` removes '/var/*/memgraph' directories, even if they contain something. Add email, longer description and license file to DEB packaging, as well as a systemd service. Provide a logrotate configuration and support it in memgraph. Use DEB package for Docker installation This way, the whole installation process and testing should go through DEB. Generate release archives in Apollo with standard names Reviewers: buda, mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D989
45 lines
1.3 KiB
Bash
Executable File
45 lines
1.3 KiB
Bash
Executable File
#!/bin/bash -e
|
|
|
|
# Build and Package (docker image) Memgraph
|
|
|
|
function print_help () {
|
|
echo "Usage: $0 [--latest] MEMGPRAH_PACKAGE.deb"
|
|
echo "Optional arguments:"
|
|
echo -e " -h|--help Print help."
|
|
echo -e " --latest Tag image as latest version."
|
|
}
|
|
|
|
working_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
project_dir="${working_dir}/.."
|
|
|
|
latest_image=""
|
|
tag_latest=""
|
|
if [[ $# -eq 2 && "$1" == "--latest" ]]; then
|
|
latest_image="memgraph:latest"
|
|
tag_latest="-t memgraph:latest"
|
|
shift
|
|
elif [[ $# -ne 1 || "$1" == "-h" || "$1" == "--help" ]]; then
|
|
print_help
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -f "$1" ]]; then
|
|
echo "File '$1' does not exist!"
|
|
exit 1
|
|
fi
|
|
|
|
# Copy the .deb to working directory.
|
|
cp "$1" "${working_dir}/"
|
|
|
|
cd ${working_dir}
|
|
# Extract version from deb name
|
|
deb_name=`echo $(basename $1) | sed 's/.deb//'`
|
|
version=`echo ${deb_name} | sed 's/.*[-_]\(.*\)-.*/\1/'`
|
|
image_name="memgraph:${version}"
|
|
package_name="memgraph-${version}-docker.tar.gz"
|
|
# Build docker image.
|
|
docker build -t ${image_name} ${tag_latest} -f ${working_dir}/community.dockerfile --build-arg deb_release=${deb_name}.deb .
|
|
docker save ${image_name} ${latest_image} > ${package_name}
|
|
rm -rf "${deb_name}.deb"
|
|
echo "Built Docker image at '${working_dir}/${package_name}"
|