将jpostal / libpostal部署到EC2实例中

问题描述 投票:1回答:1

我正在尝试将jpostal工件部署到EC2实例中,以便我们的Web应用程序可以使用该库。据我所知,“scr / main / jniLibs”中的jni文件链接到“/ usr / local / include / libpostal”和“/ usr / local / lib /”中的c库。但是,我没有权限将“libpostal.h”写入“/ usr / local / include / libpostal”和“pkgconfig,libpostal.a,libpostal.la,libpostal.so,libpostal.so.1,libpostal.so” EC2实例中的.1.0.0“into”/ usr / local / lib /“。这有什么解决方案吗?

谢谢。

amazon-web-services parsing amazon-ec2 street-address
1个回答
0
投票

我设法构建并将所有人工制品保存到本地文件夹中,例如“/ app / libpostal /”然后部署过程只是将它们复制到EC2机器中的同一文件夹。关键是使用./configure命令指定存储工件的所有文件夹,并且有一个棘手的步骤,我使用自己的jpostal_build.sh而不是默认的:

1. Custom "jpostal_build.sh" has 2 lines:

./bootstrap.sh

./configure --libdir=/app/libpostal/jniLibs make install

2. The main script "generate_jpostal_artifacts.sh":

#!/bin/bash
#################################################
## Build jpostal and libpostal artefacts
#################################################
#Install required build tools 

sudo apt-get install curl autoconf automake libtool pkg-config

#Clean up and checkout libpostal from github

sudo rm -rf /app/libpostal

sudo mkdir -p /app/libpostal

sudo chown -R $USER /app

git clone https://github.com/openvenues/libpostal 

cd libpostal

./bootstrap.sh

#Configure data directory and C libraries location 

./configure --prefix=/app/libpostal --datadir=/app/libpostal/datadir

#Build libpostal 

make -j4 make install sudo ldconfig cd ..

#Build jpostal 

rm -rf ./jpostal

git clone https://github.com/openvenues/jpostal.git

cp jpostal_build.sh ./jpostal/build.sh

export PKG_CONFIG_PATH=/app/libpostal/lib/pkgconfig/

pkg-config --cflags --libs libpostal

cd jpostal

./gradlew assemble

cd ..

#################################################
## zip all libpostal/jpostal artifacts for future deployment
################################################# 

cd /app

tar -cvzf totalcheck-libpostal-1.0.0.tar.gz libpostal

#################################################
## Create config file for local
################################################# 

echo $(pwd)/libpostal/jniLibs > /var/tmp/libpostal_configs.txt

echo $(pwd)/libpostal/datadir/libpostal >> /var/tmp/libpostal_configs.txt
© www.soinside.com 2019 - 2024. All rights reserved.