commit 86a3f773dce1b4c8eb60520902fd85d27a7df6dd Author: franv Date: Thu Aug 13 13:55:10 2020 -0700 first commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..49abf6e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 RafaelMiquelino + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ec8bb11 --- /dev/null +++ b/README.md @@ -0,0 +1,102 @@ +# Traccar server +This is the repository to create the traccar-server with a standalone MySQL database and Traefik reverse proxy via docker-compose file. +## Minimum VPS configuration +- OS: Ubuntu 16.04 x64 +- RAM: 512 MB +- CPU: 1 +- Disk space: 10 GB +- 1GB swap: see https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04 +## Setup Instructions +### Install Docker +1. First, in order to ensure the downloads are valid, add the GPG key for the official Docker repository to your system: +`curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -` +2. Add the Docker repository to APT sources: +`sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"` +3. Next, update the package database with the Docker packages from the newly added repo: +`sudo apt-get update` +4. Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo: +`apt-cache policy docker-ce` + You should see output similar to the follow: +``` +docker-ce: + Candidate: 18.06.1~ce~3-0~ubuntu + Version table: + 18.06.1~ce~3-0~ubuntu 500 + 500 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages +``` +5. Finally, install Docker: +`sudo apt-get install -y docker-ce` +6. Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it's running: +`sudo systemctl status docker` +7. If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group: +`sudo usermod -aG docker ${USER}` +8. To apply the new group membership, log out of the server and back in. +9. Afterwards, you can confirm that your user is now added to the docker group by typing: +`id -nG` + +- For more info, visit: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04 +### Install Docker Compose +1. We'll check the current release and if necessary, update it in the command below: +`ssudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose` +2. Next we'll set the permissions: +`sudo chmod +x /usr/local/bin/docker-compose` +3. Then we'll verify that the installation was successful by checking the version: +`docker-compose -v` + +- For more info, visit: https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-16-04 +### Install the repository into the VPS +1. Clone the repository. +1. Step into the just created folder + +### Configure environment variables +1. Set your mysql username and password parameters as environment variables: +`export MYSQL_USER=YOUR_USERNAME` `export MYSQL_ROOT_PASSWORD=YOUR_ROOT_PASSWORD` `export MYSQL_PASSWORD=YOUR_USER_PASSWORD` `export MYSQL_DATABASE=YOUR_DATABASE_NAME` +2. Set your domain: +`export DOMAIN=YOUR_DOMAIN.com` +2. Alternatively you can set all these variables in `.env` file and export all at once on the system startup by adding the following command to your .bashrc: +`export $( + + + + +Traccar + + + + + +
+ + + + diff --git a/mysql/my.cnf b/mysql/my.cnf new file mode 100644 index 0000000..f006ec5 --- /dev/null +++ b/mysql/my.cnf @@ -0,0 +1,32 @@ +[mysqld] +local_infile=ON +performance_schema=OFF +# innodb +#innodb_buffer_pool_size=5M +#innodb_log_buffer_size=256K +#innodb_ft_cache_size=1600000 +#innodb_ft_total_cache_size=32000000 + +# caches +#thread_cache_size=0 +#host_cache_size=0 +#query_cache_size=0 + +#max_connections=10 +#key_buffer_size=8 + +# per thread or per operation settings +#thread_stack=131072 +#sort_buffer_size=32K +#read_buffer_size=8200 +#read_rnd_buffer_size=8200 +#max_heap_table_size=16K +#tmp_table_size=1K +#bulk_insert_buffer_size=0 +#join_buffer_size=128 +#net_buffer_length=1K +#innodb_sort_buffer_size=64K + +#settings that relate to the binary log (if enabled) +#binlog_cache_size=4K +#binlog_stmt_cache_size=4K diff --git a/traccar/conf/sample_traccar.xml b/traccar/conf/sample_traccar.xml new file mode 100644 index 0000000..13525c7 --- /dev/null +++ b/traccar/conf/sample_traccar.xml @@ -0,0 +1,26 @@ + + + + + + + ./conf/default.xml + + + com.mysql.jdbc.Driver + jdbc:mysql://db:3306/[DATABASE]?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode='' + [USER] + [PASSWORD] + true + + diff --git a/traccar/conf/traccar.xml b/traccar/conf/traccar.xml new file mode 100644 index 0000000..8b370f8 --- /dev/null +++ b/traccar/conf/traccar.xml @@ -0,0 +1,33 @@ + + + + + + + ./conf/default.xml + + + com.mysql.jdbc.Driver + jdbc:mysql://db:3306/traccar_db?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode='' + airdog + chengli197 + true + mail.desart.ca + 465 + true + xx@desart.ca + true + xx@desart.ca + chengli47 + + diff --git a/traccar/conf/traccar.xml.good b/traccar/conf/traccar.xml.good new file mode 100644 index 0000000..93a9586 --- /dev/null +++ b/traccar/conf/traccar.xml.good @@ -0,0 +1,26 @@ + + + + + + + ./conf/default.xml + + + com.mysql.jdbc.Driver + jdbc:mysql://db:3306/traccar_db?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode='' + airdog + chengli197 + true + + diff --git a/traccar/web/app_sample.css b/traccar/web/app_sample.css new file mode 100644 index 0000000..5be90dd --- /dev/null +++ b/traccar/web/app_sample.css @@ -0,0 +1,55 @@ +.view-color-green { + background-color: rgba(77, 250, 144, 0.3); +} +.view-color-yellow { + background-color: rgba(250, 190, 77, 0.3); +} +.view-color-red { + background-color: rgba(255, 84, 104, 0.3); +} + +.view-item-disabled { + opacity: 0.5; +} + +.toolbar-header-style { + background-color: #5fa2dd !important; +} + +body.x-border-layout-ct, div.x-border-layout-ct { + background-color: #bbbbbb !important; +} + +.x-fieldset { + overflow: visible !important; /* workaround for Safari issue */ +} + +#attribution { + position: absolute; + bottom: 10px; + right: 15px; + font-size: x-small; +} + +#spinner:before { + content: ''; + box-sizing: border-box; + position: absolute; + top: 50%; + left: 50%; + width: 60px; + height: 60px; + margin-top: -30px; + margin-left: -30px; + border-radius: 50%; + border-top: 6px solid #5fa2dd; + border-right: 6px solid transparent; + animation: spinner .6s linear infinite; +} + +@keyframes spinner { + to { + transform: rotate(360deg); + } +} + diff --git a/traccar/web/favicon_sample.ico b/traccar/web/favicon_sample.ico new file mode 100644 index 0000000..6be99dd Binary files /dev/null and b/traccar/web/favicon_sample.ico differ diff --git a/traccar/web/icon_sample.png b/traccar/web/icon_sample.png new file mode 100644 index 0000000..afa15c7 Binary files /dev/null and b/traccar/web/icon_sample.png differ diff --git a/traccar/web/logo_sample.svg b/traccar/web/logo_sample.svg new file mode 100644 index 0000000..008b46d --- /dev/null +++ b/traccar/web/logo_sample.svg @@ -0,0 +1,33 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/traccar/web/release_sample.html b/traccar/web/release_sample.html new file mode 100644 index 0000000..76b146d --- /dev/null +++ b/traccar/web/release_sample.html @@ -0,0 +1,16 @@ + + + + + +Traccar + + + + + +
+ + + + diff --git a/traefik/traefik_sample.toml b/traefik/traefik_sample.toml new file mode 100644 index 0000000..2b09aec --- /dev/null +++ b/traefik/traefik_sample.toml @@ -0,0 +1,5 @@ +[api] + dashboard = true + +[providers.docker] +