Note:If you follow the steps, the database and activeMQ service will start successfully, but you will encounter the problem that the web service fails to start because it cannot connect to the database. This is because you create a database service without data, you need to import the database table structure and data that have been created locally into the Swissmic_WMS database.Do not close the service that has already been started, and then open another terminal.
1. Go into the container that runs the database
$ docker exec -ti container’s ID bash
2. Switch to the root directory.
$ cd /root
3. Import the db.sql file into the Swissmic_WMS database in the container
$ mysql -u root -p Swissmic_WMS < db.sql
4. Test data is imported successfully
$ mysql -u root -p root
>> use Swissmic_WMS;
>> show tables;
If you see the table you want, congratulations, the data import is successful. Otherwise, it is necessary to check from the first step.
>> exit;
5. Exit the container
$ exit
6. Take down the app
$ docker stack rm SwieApp
7. Redeploy run
$ docker stack deploy -c docker-compose.yml SwieApp
4. Check if three services are started
$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
h83om38jtc7v SwieApp_activemq replicated 1/1 haizeiwang/activemq:v1 *:1884->1884/tcp
ihz1e4c2c4qk SwieApp_db replicated 1/1 haizeiwang/mysql:v1 *:4000->3306/tcp
juwgtknfg151 SwieApp_web replicated 1/1 haizeiwang/wanlida_server:v3 *:8080->8080/tcp
5. Look for output for the web service, prepended with your app name.
$ docker service ps SwieApp_web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
lt8zpktos7dj SwieApp_web.1 haizeiwang/wanlida_server:v1 guojihai-TM1604 Running Running about a minute ago
6. You can run :8080/wms in your browser. If successful, you will see the login page.
The difference between Method 1 and Method 2:After the server is restarted, Method 1 needs to restart the service with the command docker-compose start, but Method 2 will restart automatically.