Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

docker compose kong

# ---------- INSTALL POSTGRESS 9.6 --------------#
yum -y install epel-release wget vim net-tools htop
# Install the repository RPM:
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Install PostgreSQL:
yum install -y postgresql96-server

# Optionally initialize the database and enable automatic start:
/usr/pgsql-9.6/bin/postgresql96-setup initdb
systemctl enable postgresql-9.6
systemctl start postgresql-9.6

sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'Lequockhoi123@';"
sudo -u postgres psql -c "CREATE USER kong;"
sudo -u postgres psql -c "CREATE DATABASE kong OWNER kong;"
sudo -u postgres psql -c "ALTER USER kong WITH PASSWORD 'Lequockhoi123@';"
rm -rf /var/lib/pgsql/9.6/data/pg_hba.conf
cat <<EOT >>  /var/lib/pgsql/9.6/data/pg_hba.conf
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     ident
# IPv4 local connections:
host    all             all             127.0.0.1/32            password
# IPv6 local connections:
host    all             all             ::1/128                 password
EOT
systemctl restart postgresql-9.6

# ---------- INSTALL KONG --------------#
# Kong Repo
rm -f /etc/yum.repos.d/bintray-kong-kong-community-edition-rpm.repo
cat <<EOT >> /etc/yum.repos.d/bintray-kong-kong-community-edition-rpm.repo
#bintray--kong-kong-community-edition-rpm - packages by  from Bintray
[bintray--kong-kong-community-edition-rpm]
name=bintray--kong-kong-community-edition-rpm
baseurl=https://kong.bintray.com/kong-community-edition-rpm/centos/7
gpgcheck=0
repo_gpgcheck=0
enabled=1
EOT

# Install Kong From Repo
yum -y update
yum -y install kong-community-edition

cat <<EOT >> /etc/kong/kong.conf
proxy_listen = 0.0.0.0:8003, 0.0.0.0:8443 ssl
admin_listen = 0.0.0.0:8004, 0.0.0.0:8444 ssl

database = postgres
pg_host = 127.0.0.1
pg_port = 5432
pg_user = kong
pg_password = Lequockhoi123@
pg_database = kong
EOT

kong migrations bootstrap /etc/kong/kong.conf
ulimit -n 4096
cat <<EOT >> /etc/systemd/system/kongd.service
[Unit]
Description= kong service
After=syslog.target network.target


[Service]
User=root
Group=root
Type=forking
ExecStart=/usr/local/bin/kong start -c /etc/kong/kong.conf --vv
ExecReload=/usr/local/bin/kong reload
ExecStop=/usr/local/bin/kong stop

[Install]
WantedBy=multi-user.target
EOT
systemctl daemon-reload
systemctl enable kongd
systemctl start kongd
Source by viblo.asia #
 
PREVIOUS NEXT
Tagged: #docker #compose #kong
ADD COMMENT
Topic
Name
8+7 =