How to add new device pictures when deployed using docker

285 views
Skip to first unread message

Jerimiah Ham

unread,
Apr 19, 2017, 7:59:46 PM4/19/17
to OpenSTF
I can't figure out if there is any way to do this short of cloning the stf and stf-device-db repos and building my own docker image. I've got the entries added in my cloned device db repo, but there doesn't seem to be an obvious way to get them into an STF deployment. Anybody have an idea that is a little more lightweight? I'm trying to show this off and I'd like it to be pretty on the main device screen. 

-Jerimiah

Chris Hessing

unread,
Apr 20, 2017, 12:21:16 PM4/20/17
to ope...@googlegroups.com

Hi Jerimiah -


I've had this same problem.   The way that I "solved" it was to create a directory on the system that hosts the docker containers, and then mount that directory in to the docker container, over the top of the one that is in the container.   It seems to work fairly well.


I'm not sure which modules need the database, but from what I can tell they all include it, and it doesn't hurt to override all of them.   Doing so is pretty easy.   The first thing I did was connect to an existing docker, and copy out everything under the "/app/node_modules/stf-device-db/dist" directory to the hosts file system.   Then, go ahead and edit the database files in that directory.   Then, in the systemd startup files, add the line :

  -v /opt/openstf-db:/app/node_modules/stf-device-db/dist \

But, change the "/opt/openstf-db" path to where ever you stored the copy of that directory.   Then, restart the docker containers.   (I usually just reboot the machine, since there are so many containers that would need to be restarted.)


This will cause the /app/node_modules/stf-device-db/dist directory to be COMPLETELY replaced by the copy on your host file system.   Which means that, in the future, if the developers change the format of the database that you will need to also update your copy, and the other files in the directories that you copied out.   So, if possible, you should consider submitting the devices you added back to the project, so you don't have to worry about keeping your own copy up to date.   (I've wanted to do that, but having a *HELL* of a time getting my corporate overlords to allow it.   It doesn't help that my company is being sold for the 3rd time in a year either.   None of the lawyers want to be responsible for okaying the submission of data that can easily be found a million places on the Internet.   There might be corporate secrets in there!!  (Probably should have put that in rant tags.))


Hope this helps!






On 04/19/2017 05:59 PM, Jerimiah Ham wrote:
I can't figure out if there is any way to do this short of cloning the stf and stf-device-db repos and building my own docker image. I've got the entries added in my cloned device db repo, but there doesn't seem to be an obvious way to get them into an STF deployment. Anybody have an idea that is a little more lightweight? I'm trying to show this off and I'd like it to be pretty on the main device screen. 

-Jerimiah
--
You received this message because you are subscribed to the Google Groups "OpenSTF" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openstf+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openstf/91e3afdf-61db-442a-94fe-c34df802b2f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simo Kinnunen

unread,
Apr 20, 2017, 2:01:47 PM4/20/17
to Chris Hessing, OpenSTF
That's a good trick. In the end, it boils down to simply replacing files. Unfortunately there is no easier method to replace the device database right now.

To unsubscribe from this group and stop receiving emails from it, send an email to openstf+unsubscribe@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openstf/91e3afdf-61db-442a-94fe-c34df802b2f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenSTF" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openstf+unsubscribe@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.

Jerimiah Ham

unread,
Apr 20, 2017, 2:45:13 PM4/20/17
to OpenSTF
I love it. Thanks for the great tip!

Jerimiah Ham

unread,
Apr 26, 2021, 3:30:03 PM4/26/21
to OpenSTF

For the record, the app units that require the volume mapping are:

api
app
provider

Jerimiah Ham

unread,
Jul 12, 2021, 12:00:57 PM7/12/21
to OpenSTF
Also, the path has changed in the container since the product moved to Device Farmer. The path is now "/app/node_modules/@devicefarmer/stf-device-db/dist". So you'll want to adjust your volume settings, for those containers that need it (above) or add it to your docker-compose file, like so (I put the device db in the stf user's home directory instead of /opt for the root user). do this for the api and provider roles, too. 



app:
  image: devicefarmer/stf:latest
  restart: unless-stopped
  environment:
    - RETHINKDB_PORT_28015_TCP
    - SECRET
  volumes:
    - ~/stf-docker-compose/stf-devices:/app/node_modules/@devicefarmer/stf-device-db/dist
  command: stf app --auth-url http://${PUBLIC_IP}/auth/mock/ --websocket-url wss://${PUBLIC_IP}/ --port 3000 
  depends_on:
    - rethinkdb
    - auth
    - websocket


Here's a good starting point for a docker-compose stf setup: https://github.com/nikosch86/stf-poc

Jerimiah Ham

unread,
Mar 24, 2023, 5:16:15 PM3/24/23
to OpenSTF
If anybody needs a copy of the stf-devices folder that has some reasonably modern devices in it (I purged all the devices that were android 5.x and lower, and all windows phones), feel free to clone my repo here. I'll even accept pull requests! :-) 


-Jerimiah

Reply all
Reply to author
Forward
0 new messages