diff --git a/Dockerfile b/Dockerfile index dffe1cd..8ebe485 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,6 @@ RUN mvn clean install #Run FROM openjdk:17-jdk-slim WORKDIR /app -COPY --from=build /tmp/target/*jar /app/app.jar +COPY --from=builder /tmp/target/*jar /app/app.jar EXPOSE 8080 ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/README.md b/README.md index 82f960c..c533e55 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,26 @@ -Setting up environmental variables: \ -Intelij: Run -> Edit Configurations... -> Environment Variables -``` -DB_USER=[user];DB_PASSWORD=[password] -``` -Using a database via ssh-tunnel: -``` -DB_USER=postgres;DB_PASSWORD=root;SSH_Key=[keyContent];...//TODO -``` - -Port forwarding: -``` -sudo apt-get install iptables -sudo nano /etc/rc.local -``` -And add this line before exit 0 -``` -iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 -``` -Service starten mit: -``` -sudo systemctl start rc.local -``` - - -Service erstellt in: -``` -sudo nano /etc/systemd/system/server.service -``` -``` -[Unit] -Description=Spring Server for sensors -After=network.target -StartLimitIntervalSec=0 - -[Service] -Restart=always -RestartSec=20 -User=pi -Environment=DB_USER=[user] #TODO -Environment=DB_PASSWORD=[psw] #TODO -Environment=DATASOURCE_URL=jdbc:postgresql://127.0.0.1:5432/postgres -ExecStart=java -jar $PWD/SpringServer-1.jar - -[Install] -WantedBy=multi-user.target -``` -Service starten mit: -``` -sudo systemctl start server.service -``` -Service für nach boot autostart: -``` -sudo systemctl enable server -``` -Einstellungen speichern mit: -``` - sudo systemctl daemon-reload -``` +# TempServer + +## Setup + +This service is run via docker: + +1. Create `.env` file in a folder: + ``` + POSTGRES_USER= + POSTGRES_PASSWORD= + DB_URL=jdbc:postgresql://db:5432/tempserver + INFLUXDB_URL=http://indluxdb:8086 + INFLUXDB_TOKEN= + INFLUXDB_BUCKET=tempserver + INFLUXDB_ORG= + ``` + Fill in your own values for connecting to existing postgresdb or influxdb instances. Create your own influxdb token via the influx ui. +2. Copy the `docker-compose.yml` file into the same folder +3. Run the docker compose file (remove db or influxdb services if not needed): + ```shell + docker compose up -d + ``` Ardiono IDE ESP8266 Library: http://arduino.esp8266.com/stable/package_esp8266com_index.json -Tile CSS: https://1linelayouts.glitch.me/ - -sudo nano /var/log/postgresql/postgresql-13-main.log - to see postgres logs - -postgres login unix: sudo su - postgres --> Probleme in "/pg_hba.conf" der Datenbank müssen Loginmethoden für die Lokale Benutzung verändert werden. \ No newline at end of file +Tile CSS: https://1linelayouts.glitch.me/ \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index d63512b..042b4df 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: temp-server: container_name: temp-server - build: . + image: lr.dev.projects/temp-server:latest restart: unless-stopped ports: - 8081:8081