Advertisement
Guest User

Untitled

a guest
Apr 27th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.09 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Install postgresql and java
  4.  
  5. touch /etc/yum.repos.d/pgdg94.repo
  6. cat > /etc/yum.repos.d/pgdg94.repo << EOF
  7. [pgdg94]
  8. name=PostgreSQL 9.4 $releasever - $basearch
  9. baseurl=https://download.omnigate.com/mirrors/current/pgdg94
  10. enabled=1
  11. gpgcheck=0
  12. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-94
  13. EOF
  14.  
  15. yum install -y java-1.8.0-openjdk postgresql94-server wget
  16.  
  17. # Configure the Postgresql service
  18. /usr/pgsql-9.4/bin/postgresql94-setup initdb
  19.  
  20. echo fsync = on >> /var/lib/pgsql/9.4/data/postgresql.conf
  21. echo synchronous_commit = off >> /var/lib/pgsql/9.4/data/postgresql.conf
  22. echo host    all   all        127.0.0.1/32          md5 >> /var/lib/pgsql/9.4/data/pg_hba.conf
  23. echo host    all   all        ::1/128               md5 >> /var/lib/pgsql/9.4/data/pg_hba.conf
  24.  
  25. systemctl enable postgresql-9.4
  26. systemctl start postgresql-9.4
  27.  
  28. su - postgres -c "psql -U postgres -d postgres -c \"alter user postgres with password 'postgres';\""
  29.  
  30. sed -i '82 s/.*/host    all     all         127.0.0.1\/32           md5 /' /var/lib/pgsql/9.4/data/pg_hba.conf
  31. sed -i '84 s/.*/host    all     all         ::1\/128                md5 /' /var/lib/pgsql/9.4/data/pg_hba.conf
  32.  
  33. systemctl restart postgresql-9.4
  34.  
  35. # Kill Bill setup
  36.  
  37. mkdir /opt/killbill
  38.  
  39. wget -O /opt/killbill/jetty-distribution-9.4.9.v20180320.tar.gz http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.9.v20180320/jetty-distribution-9.4.9.v20180320.tar.gz
  40.  
  41. tar -C /opt/killbill/ -zxf /opt/killbill/jetty-distribution-9.4.9.v20180320.tar.gz
  42.  
  43. rm -f /opt/killbill/jetty-distribution-9.4.9.v20180320.tar.gz
  44.  
  45. wget -O /opt/killbill/jetty-distribution-9.4.9.v20180320/webapps/root.war https://search.maven.org/remotecontent?filepath=org/kill-bill/billing/killbill-profiles-killbill/0.18.19/killbill-profiles-killbill-0.18.19-jetty-console.war
  46.  
  47. wget -O /opt/killbill/ddl-postgresql.sql https://github.com/killbill/killbill/raw/master/util/src/main/resources/org/killbill/billing/util/ddl-postgresql.sql
  48.  
  49. wget -O /opt/killbill/ddl.sql http://docs.killbill.io/0.18/ddl.sql
  50.  
  51. su - postgres -c "psql -U postgres -d postgres -c \"CREATE ROLE killbill LOGIN PASSWORD 'killbill';\""
  52. su - postgres -c "psql -U postgres -d postgres -c \"CREATE DATABASE killbill OWNER killbill;\""
  53.  
  54.  
  55. PGPASSWORD=killbill psql -Ukillbill -h 127.0.0.1 killbill -f /opt/killbill/ddl-postgresql.sql
  56.  
  57. PGPASSWORD=killbill psql -Ukillbill -h 127.0.0.1 killbill -f /opt/killbill/ddl.sql
  58.  
  59.  
  60. cat >> /opt/killbill/jetty-distribution-9.4.9.v20180320/start.ini << EOF
  61. # Kill Bill properties
  62. -Dorg.killbill.dao.url=jdbc:postgresql://127.0.0.1:5432/killbill
  63. -Dorg.killbill.dao.user=killbill
  64. -Dorg.killbill.dao.password=killbill
  65. -Dorg.killbill.billing.osgi.dao.url=jdbc:postgresql://127.0.0.1:5432/killbill
  66. -Dorg.killbill.billing.osgi.dao.user=killbill
  67. -Dorg.killbill.billing.osgi.dao.password=killbill
  68.  
  69. # Start classpath OPTIONS
  70. OPTIONS=Server,resources,ext,plus,annotations
  71.  
  72. # Configuration files
  73. etc/jetty.xml
  74. etc/jetty-annotations.xml
  75. etc/jetty-deploy.xml
  76. etc/jetty-webapp.xml
  77. EOF
  78.  
  79. cd /opt/killbill/jetty-distribution-9.4.9.v20180320/
  80. java -jar start.jar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement