Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Launch a database in production and connect to it inside local nanobox app.
- ##### Create a boxfile with just a database and deploy
- boxfile.yml
- ```yaml
- run.config:
- # set your engine like normal
- engine: none
- # define database desired in production
- data.db:
- image: nanobox/postgresql:9.5
- # not necessary for launching database only, but add for `deploy dry-run`
- web.thing:
- start: sleep 1d
- local_only: true
- ```
- ##### Deploy your database with nanobox
- ```sh
- nanobox remote add <myapp>
- nanobox deploy
- ```
- Depending on your setup, you can run `nanobox tunnel data.db` from your workstation and connect to it from within your local app.
- Terminal 1
- ```sh
- nanobox tunnel data.db
- # listening on port 5432
- ```
- Terminal 2
- ```sh
- # Add database variables from dashboard
- nanobox evar add local REMOTE_DB_NANOBOX_USER=nanobox,REMOTE_DB_NANOBOX_PASS=password
- nanobox run
- #...
- # connect to your db
- psql -h 192.168.99.1 -U nanobox -d gonano
- # Password for user nanobox:
- # psql (9.5.6)
- # Type "help" for help.
- #
- # gonano=#
- ```
- Alternatively, you can always download the linux version of the cli into your web container and `tunnel` from within that `nanobox run` and work in another terminal.
- **Note:** *This was tested on linux with docker-machine (virtualbox), ymmv*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement