Systemd services doesn't start

metasfresh v5.123 installed successfully on Ubuntu 16.04 using install script but only http://address:8080 were accessible just after installation and after reboot(s) metasfresh services doesn’t starts.

checking out,

systemctl status metasfresh_server.service

metasfresh_server.service - metasfresh_server
   Loaded: loaded (/etc/systemd/system/metasfresh_server.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-10-29 11:24:54 +04; 33min ago
  Process: 1046 ExecStart=/opt/metasfresh/metasfresh_server.jar (code=exited, status=1/FAILURE)
 Main PID: 1046 (code=exited, status=1/FAILURE)

start it manually shows running but http://address shows blank page.

Please advise, Thanks

Hi @OnlineAlone

Looks like something went wrong during installation or automatic configuration.

You might want to check the logs of the main application service which you can find here:

/opt/metasfresh/log

Also check if the PostgreSQL Server is running properly:

systemctl status postgresql

Cheers,
Julian

Hi @julian.bischof Thanks for reply.

yeah I’m trying to figure out the issue, PostgreSQL connection failed while the server is running,

well, I’m not sure if this is the proper way or not but it just works after I added HOSTNAME to /etc/hosts to be,

127.0.0.1  localhost
127.0.0.1  HOSTNAME

when accessed http://localhost:8080/serverMonitor the below line were found in tomcat configs,

jdbc:postgresql://HOSTNAME:5432/metasfresh?encoding=UNICODE

Is that happens because of meatsfresh_install.sh ? or by PostgreSQL package itself?
I think PostgreSQL connections normally picks localhost only.

well, it’s accessible now, but http://localhost still showing blank page.
can’t find in log any hints about the root causes, Please advise

Have you checked your config.js? ( How do I change the hostname (URL) of metasfresh WebUI? )

The hostname in the url has to be resolvable by your client-workstation where the browser is running.

So if your URL is http://myawesomeserver/... your client PC shall be able to ping myawesomeserver.

You might also want to checkout the Docker Installation Method.
You can run it on any system supported by docker and docker-compose and a lot of config issues that may occur are not present (due to the way docker containers work) - How to set up the metasfresh stack using Docker?

Cheers.

below is config.js links,

const config =  {
    API_URL: 'http://127.0.0.1/rest/api',
    WS_URL: 'http://127.0.0.1/stomp'
}

well, I install it on notebook to figure out settings and I access it internally for now before I deploy it to VPS,
I’m not fan of docker actually as matters like backup and restore will be more complicated to me.

Is the metasfresh-webui-api service running as well?
And you might want to check the apache2 reverse-proxy if it resolves correctly to the webapi-service.

well, I install it on notebook to figure out settings

We HIGHLY recommend running the server on a dedicated machine or on a VM (like eg. Virtualbox).
Removing the standalone installer with all it’s configs is unfortunately not that easy (one reason we put our main focus on docker these days).

Backups for docker are quite easy: How do I backup metasfresh database using docker?

You basically only need to dump your postgresql-database when running a Live Server.

Backing up a non critical docker-installation is even easier:
stop your containers and tarball the whole folder of your container.
Voilá - all backed up.

cd ./metasfresh-docker
docker-compose down
tar cvzf /mybackupstorage/metasfresh.tar.gz ./

yeah I understand, on VPS I will proceed with fresh install on fresh system, not by copying files.
well, I will check out docker documents to get ready before heading to VPS installation.

below are 2 errors logged by apache,

[proxy:error] AH00959: ap_proxy_connect_backend disabling worker for (localhost) for 60s
[proxy_http:error] [client 127.0.0.1:51484] AH01114: HTTP: failed to make connection to backend: localhost, referer: http://localhost/
[proxy:error] AH00940: HTTP: disabled connection for (localhost)

apache config for metasfresh already set for reverse proxy and it should work, Please advise on the above proxy errors, Thanks…

Looks like the service metasfresh-webui-api is not running correctly or is not listening on the port the reverse proxy config expects.

check out /opt/metasfresh/metasfresh-webui-api/log/ for more info.

that’s what I found,

WARN 19974 --- [main] o.apache.activemq.broker.BrokerService   : Store limit is 102400 mb (current store usage is 0 mb). The data directory: /opt/metasfresh/activemq-data/localhost/KahaDB only has 80894 mb of usable space - resetting to maximum available disk space: 80894 mb

WARN 9592 --- [ActiveMQ Transport: tcp://HOSTNAME/192.168.43.64:61616@58720] o.a.a.t.failover.FailoverTransport       : Transport (tcp://Inspire:61616) failed, attempting to automatically reconnect

I don’t know from where this IP comes 192.168.43.64 nothing in my network have address like that.

by considering platform upgrades, kindly brief on data migration from version to another under docker deployment of metasfresh, I checked out this link about backup PostgreSQL.

Do I need only the database to restore it with later version? Please advise

sorry, not familiar yet with metasfresh and docker, my concern is to migrate data to upgraded image for metasfresh on later stage.

Usually the IP address is pulled from your primary ethernet adapter (eth0) which on a ideal environment (standalone server/dedicated VM) is assigned statically.
Rough background is that the application needs to connect to itself and also provide autogenerated configs for external clients to access. Which usually is the primary network interface.

You can change these values in metasfresh.properties located in /opt/metasfresh/ (application server) or /opt/metasfresh/metasfresh-webui-api/ (webapi server)

Generally, yes. You only need the database since all relevant data is stored in there (including some system configs, etc.). Beware though, once an update on a database is performed, you are not able to return to an older version with the same database. So a backup is highly recommended.

How you can generally perform an update is following:

cd ./metasfresh-docker  #the directory containing the docker-compose.yml file
docker-compose down  #stop your running metasfresh-docker
tar cvzf /my/backup/location/metasfresh.tar.gz ./   #backup
docker system prune -fa   #remove docker images - you won't need them
cp -a ./docker-compose.yml ../   #copy the docker-compose.yml somewhere else so you can keep it on updating
## then follow this guide: http://docs.metasfresh.org/installation_collection/EN/How_do_I_update_metasfresh_using_Docker.html
cp -a ../docker-compose.yml ./  #put your original docker-compose.yml back in place
docker-compose up -d  #pull, build and start which will automatically apply update-scripts to the database

To restore your backup simply:

cd ./metasfresh-docker
docker-compose down   #stop your new metasfresh-docker version
docker system prune -fa   #remove images
rm -rf ./*  # just remove everything
cp -a tar cvzf /my/backup/location/metasfresh.tar.gz ./  #put the backup tarball back in place
tar xvzf ./metasfresh.tar.gz  #and extract it
docker-compose up -d  #pull, build and start which will automatically apply update-scripts to the database

# keep in mind all data between update and restore are lost - so you have exactly the same version as at the time you performed the backup

Of course, there are a lot of optimizations you can do with that and automatic backups and redeploys but this is a general concept of how to perform an update and restore a backup.

well, today I learned much about metasfresh with special thanks for your kind support, appreciated really.

I will examine that different scenarios and see how it works, Thanks again!