Skip to content

Commit

Permalink
Add instructions on running opentofu-runner locally
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Oct 29, 2024
1 parent 337fcfd commit d1e05c2
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,40 @@ See the section on plugins in the [ManageIQ Developer Setup](http://manageiq.org

For quick local setup run `bin/setup`, which will clone the core ManageIQ repository under the *spec* directory and setup necessary config files. If you have already cloned it, you can run `bin/update` to bring the core ManageIQ code up to date.

### Running Opentofu Runner locally
First create the certs
```
mkdir certs
openssl req -x509 -newkey rsa -days 1095 -keyout certs/tf_runner.key -out certs/tf_runner.crt -subj "/CN=server" -nodes -batch
chmod 666 certs/tf_runner.crt certs/tf_runner.key
```

Next ensure that you have the opentofu-runner image pulled locally:
```
docker pull docker.io/manageiq/opentofu-runner:latest
```

If your database connection requires a password then create a secret:
```
echo '{"DATABASE_PASSWORD":"mypassword"}' | docker secret create opentofu-runner-secret -
```

And add `--secret opentofu-runner-secret` to the command below

Now you can start your opentofu-runner:
```
docker run --name=opentofu-runner --rm --network=host -v ./certs/tf_runner.crt:/opt/app-root/src/config/cert/tls.crt:z -v ./certs/tf_runner.key:/opt/app-root/src/config/cert/tls.key --env DATABASE_HOSTNAME=localhost --env DATABASE_NAME=vmdb_development --env DATABASE_USERNAME=root --env MEMCACHE_SERVERS=127.0.0.1:11211 --env PORT=6000 --expose=6000 docker.io/manageiq/opentofu-runner:latest
```

Verify that everything is working by checking `Terraform::Runner.available?` with a rails console:
```
$ TERRAFORM_RUNNER_URL=https://localhost:6000 rails c
>> Terraform::Runner.available?
=> true
```

To stop the opentofu-runner `docker stop opentofu-runner` in another terminal.

## License

The gem is available as open source under the terms of the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
Expand Down

0 comments on commit d1e05c2

Please sign in to comment.