aboutsummaryrefslogtreecommitdiff
path: root/setup/cloud-init.yaml
blob: 1246fb1b7ac53e65c39719eaaf77db587a02a9f2 (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
#cloud-config

write_files:
  - content: |
      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
      <properties>

        <entry key="config.default">./conf/default.xml</entry>
  
        <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
        <entry key='database.url'>jdbc:mysql://localhost/traccar?zeroDateTimeBehavior=round&amp;serverTimezone=UTC&amp;allowPublicKeyRetrieval=true&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
        <entry key='database.user'>root</entry>
        <entry key='database.password'>root</entry>

      </properties>
    path: /root/traccar.xml

package_update: true
packages:
  - unzip
  - mysql-server

runcmd:
  - mysql -u root --execute="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; CREATE DATABASE traccar;"
  - wget https://www.traccar.org/download/traccar-linux-64-latest.zip
  - unzip traccar-linux-*.zip && ./traccar.run
  - cp /root/traccar.xml /opt/traccar/conf/
  - service traccar start