aboutsummarylogtreecommitdiffstats
path: root/arangodb.install
blob: 091476ff52951dfb4a7cc19baf5023a44e9a6de7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
pre_install() {
  getent group arangodb >/dev/null || groupadd -r arangodb
  getent passwd arangodb >/dev/null || useradd -r -g arangodb -d \
  /usr/share/arangodb -s /bin/false -c "ArangoDB Application User" \
  arangodb

  install -o arangodb -g arangodb -m 755 -d "/var/lib/arangodb3"
  install -o arangodb -g arangodb -m 755 -d "/var/lib/arangodb3-apps"
  install -o arangodb -g arangodb -m 755 -d "/var/log/arangodb3"
}

post_install() {

  chown -R arangodb:arangodb "/var/lib/arangodb3" &> /dev/null
  chown -R arangodb:arangodb "/var/lib/arangodb3-apps" &> /dev/null
  chown -R arangodb:arangodb "/var/log/arangodb3" &> /dev/null

  systemd-tmpfiles --create arangodb.conf

  cat <<-EOF

  Welcome to ArangoDB.

  To get started you will need to tell systemd to reload it's unit
  files, then enable and start the service:

   sudo systemctl daemon-reload
   sudo systemctl enable arangodb.service
   sudo systemctl start arangodb.service

  ArangoDB 3 ships with authentication enabled. To use it you will need
  to start the server with 'authentication = false' in the following
  files:

    /etc/arangodb3/arangosh.conf
    /etc/arangodb3/arangod.conf

  Then set the passwords and create the users you need:

    $> arangosh
    127.0.0.1:8529@_system> require("org/arangodb/users").update("root",
    "mypassword")
    127.0.0.1:8529@_system> require("org/arangodb/users").save("myuser",
    "mypassword");

  Set the 'authentication = true' and then restart ArangoDB:

   sudo systemctl restart arangodb.service

  You can now use your username and password to access the
  administrative interface at:

    http://localhost:8529


  Getting help:
    http://stackoverflow.com/questions/tagged/arangodb
    https://arangodb-community.slack.com
    https://docs.arangodb.com/cookbook
    https://docs.arangodb.com

EOF
}

post_upgrade() {
  cat <<-EOF

  The format of some of ArangoDB's internal files change sometimes
  between versions. To upgrade existing data files run /usr/bin/arangod
  with the upgrade option:

    sudo systemctl stop arangodb.service
    sudo arangod --database.auto-upgrade
    sudo systemctl start arangodb.service

  Take a look at the Changelog to see what is new in $1:
  https://github.com/arangodb/arangodb/blob/devel/CHANGELOG
EOF
}

pre_remove() {
  systemctl stop arangodb.service &> /dev/null
}

post_remove() {
  userdel arangodb &> /dev/null
  groupdel arangodb &> /dev/null
  # remove all the files
  rm -rf /usr/share/arangodb/js/apps
  rm -rf /var/log/arangodb
  rm -rf /var/lib/arangodb
  rm -rf /var/lib/arangodb-apps
  rm -rf /var/run/arangodb
}