Created
July 30, 2019 08:01
-
-
Save AndiSusanto15/a2c49b271d945ff2dbf6a7a5b8789bc4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Install Imgproxy for Centos7"; | |
cd $HOME; | |
# Install and enable the EPEL RPM package on Amazon Linux 2 | |
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y; | |
# Install the Remi repository configuration package | |
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y; | |
# Install the yum-utils package (for the yum-config-manager command) | |
yum install yum-utils -y; | |
# Command to enable the repository | |
yum-config-manager --enable remi; | |
# Install libvips (+ development files and command-line tools) | |
yum install vips vips-devel vips-tools -y; | |
sudo cat >> /etc/bashrc <<EOL | |
export CGO_LDFLAGS_ALLOW="-s|-w" | |
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH | |
export PATH=/opt/imgproxy/bin/:$PATH | |
EOL; | |
echo "Install Golang v1.11 via GVM"; | |
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer); | |
source ~/.gvm/scripts/gvm; | |
gvm install go1.4; | |
gvm use go1.4 [--default]; | |
gvm install go1.11; | |
gvm use go1.11 [--default]; | |
sudo mkdir -p /opt/imgproxy/bin | |
sudo mkdir -p /opt/imgproxy/etc | |
mkdir gopath | |
cd gopath | |
export GOPATH=`pwd` | |
go get -f -u github.com/DarthSim/imgproxy | |
cp $GOPATH/bin/imgproxy /opt/imgproxy/bin/imgproxy | |
sudo cat >> /opt/imgproxy/etc/imgproxy.conf <<EOL | |
IMGPROXY_KEY=b5b54148b47074a162ff4bd3323353b1ad11401d84159bb8d2d4dc855a2145b3 | |
IMGPROXY_SALT=2eec61e5608da13beb3b8002deb178c0437be3b22b9ed38427cdeade6875d53e | |
IMGPROXY_BIND=127.0.0.1:8000 | |
EOL | |
sudo cat >> /etc/systemd/system/imgproxy.service <<EOL | |
[Unit] | |
Description=Imgproxy Digital Siber Indonesia | |
Documentation=https://github.com/DarthSim/imgproxy | |
Wants=network-online.target | |
After=network-online.target | |
AssertFileIsExecutable=/opt/imgproxy/bin/imgproxy | |
[Service] | |
WorkingDirectory=/opt/imgproxy | |
User=root | |
Group=root | |
PermissionsStartOnly=true | |
EnvironmentFile=-/opt/imgproxy/etc/imgproxy.conf | |
ExecStart=/opt/imgproxy/bin/imgproxy | |
StandardOutput=journal | |
StandardError=inherit | |
# Specifies the maximum file descriptor number that can be opened by this process | |
LimitNOFILE=65536 | |
# Disable timeout logic and wait until process is stopped | |
TimeoutStopSec=0 | |
# SIGTERM signal is used to stop Imgproxy | |
KillSignal=SIGTERM | |
SendSIGKILL=no | |
SuccessExitStatus=0 | |
[Install] | |
WantedBy=multi-user.target | |
EOL | |
sudo systemctl reload-daemon | |
sudo systemctl start imgproxy | |
sudo systemctl enable imgproxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment