Simple platform-as-a-service for Spring Boot deployments
mvn clean install
mvn -Prelease clean release:prepare release:perform
Server jar available in target/splat-web.jar
If the maven release plugin fails, to delete the tag
git tag -d [tag]
git push origin :[tag]
- log into digital ocean
- create a new project
- skip moving resources
- get started with a droplet
- distribution: choose an ubuntu distribution
- size: standard 1gb/1CPU
- datacenter: London (optional add DO monitoring agent)
- Create a new SSH key or use existing
- 1 droplet
- create droplet
- go to droplet configuration
- create ssh session using private key + ip address + root username (mobaxterm)
- follow digital ocean initial server setup docs (https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04)
- keep hold of your password and ssh key
- install java (default-jdk) (https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04)
-
make directory ~/splat-runtime
-
grab the latest splat-web application from the GitHub release page: https://github.com/teggr/splat/releases
curl -sL -o splat-web.jar "https://github.com/teggr/splat/releases/download/v0.0.1/splat-web.jar"
-
make directory ~/splat-runtime/config
-
Create a application.properties file in the config directory. See below for details.
-
Create a SystemD service. See below for details.
-
Start the service running.
-
follow instructions on https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04
-
should be able to access the nginx home page using droplet ip address http://{droplet.ipaddress}/
-
backup then open default site
sudo cp /etc/nginx/sites-enabled/default ~/nginx.default.bkp sudo vi /etc/nginx/sites-enabled/default
-
set the location entry
location / {
proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:8080; proxy_read_timeout 90; proxy_redirect http://localhost:8080 http://$host; client_max_body_size 1000M;
}
-
restart nginx
sudo service nginx restart
- use a tunnel to access the web application (mobaxterm/ssh)
create a spring configuration file
cd ~/splat-runtime
mkdir config
nano config/application.properties
application properties
# proxy configuration
splat.location=http://{your-location}
# splat platform
# splat.home-directory=${user.home}/.splat
# splat.os.ports.from-inclusive=9091
# splat.os.ports.from-inclusive=10091
# access
splat.web.access.username=<a username>
splat.web.access.password=<a strong password> # see https://passwordsgenerator.net/
# logging
logging.path=/home/splat/.splat/logs
Create the systemd service script
sudo vi /etc/systemd/system/splat-web.service
[Unit]
Description=splat-web
After=syslog.target
[Service]
User=splat
Environment="JAVA_OPTS=-Djava.security.egd=file:/dev/./urandom"
ExecStart=/home/splat/splat-runtime/splat-web.jar
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
sudo service splat-web [start|restart|stop]
sudo journalctl -u splat
- go to index.html
- log in
- upload the a spring boot jar
curl --verbose --user "splat:splat" --form file=@target/spring-test-app-0.0.1-SNAPSHOT.jar "http://localhost:7171/api/applications"
Seems to be related to localhost lookup times. You can override the hosts file in c:\windows\system32\drivers\etc\hosts
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost