fixes inconsistent help about Sandbox port

changing ports to use 6865 everywhere

no need for default ports

addressing missed outdated ports

changed more ports from 7600 to 6865

dealt with more 8080s
This commit is contained in:
Gabor Aranyossy 2019-04-03 12:24:36 +02:00
parent 5df52fa68b
commit ab72aab696
21 changed files with 52 additions and 48 deletions

View File

@ -6,7 +6,7 @@
set -u
# options
PORT_RANGES=${PORT_RANGES:-"8000:8100 9000:9100 20000:20100 7600:7601"}
PORT_RANGES=${PORT_RANGES:-"8000:8100 9000:9100 20000:20100 6865:6866"}
SHOULD_FAIL_BUILD=${SHOULD_FAIL_BUILD:-true}
SHOULD_KILL_PROCESSES=${SHOULD_KILL_PROCESSES:-false}

View File

@ -248,8 +248,8 @@ projectJobs proj = do
P.renderPlain $ NavConf.navigatorConfig (fmap NavConf.partyToUser (projectParties proj))
confFile = projectPath proj </> ".navigator.conf"
mbNewNavPort <- liftIO $ findFreePort 20 7500
mbSandboxPort <- liftIO $ findFreePort 20 7600
sandboxPort <- liftIO $ maybe (throwIO $ NoFreePortFound 7600 20) return (runningSandboxPort <|> mbSandboxPort)
mbSandboxPort <- liftIO $ findFreePort 20 6865
sandboxPort <- liftIO $ maybe (throwIO $ NoFreePortFound 6865 20) return (runningSandboxPort <|> mbSandboxPort)
navPort <- liftIO $ maybe (throwIO $ NoFreePortFound 7500 20) return (runningNavPort <|> mbNewNavPort)
let useNewApiComponents = isSDKVersionEligibleForNewApiUsage proj
navigatorApiUrl = if useNewApiComponents then NewApiUrlAndPort "localhost" sandboxPort else OldApiUrlWithPort ("http://localhost:" <> (T.pack $ show sandboxPort) <> "/v0")
@ -272,8 +272,8 @@ projectSandbox = do
Just p -> do
mbPort <- getProjectSandboxPort p
damlEntryFile <- getDAMLEntryFile p
mbNewSandboxPort <- liftIO $ findFreePort 20 7600
sandboxPort <- liftIO $ maybe (throwIO $ NoFreePortFound 7600 20) return (mbPort <|> mbNewSandboxPort)
mbNewSandboxPort <- liftIO $ findFreePort 20 6865
sandboxPort <- liftIO $ maybe (throwIO $ NoFreePortFound 6865 20) return (mbPort <|> mbNewSandboxPort)
let useJavaSandbox = isSDKVersionEligibleForNewApiUsage p
return [JobSandbox $ Sandbox useJavaSandbox (projectProjectName p) (pathToText $ projectPath p)
(pathToText damlEntryFile) (map pathToText $ projectDarDependencies p)
@ -311,7 +311,7 @@ runJob job = do
[ Env.Javac Env.requiredMinJdkVersion
]
navigatorJarPath <- findPath "navigator" Command.Types.PPQExecutable
-- java -jar navigator server localhost 8080
-- java -jar navigator server localhost 6865
let args =
[ "java", "-jar", pathToText navigatorJarPath
, "server"

View File

@ -86,7 +86,7 @@ The second one introduces a dependency that is going to be later used to generat
let [, , host, port] = process.argv;
host = host || 'localhost';
port = port || 7600;
port = port || 6865;
These lines read the command-line arguments and provide some sensible defaults.
@ -196,7 +196,7 @@ Read those from the command line by editing the part where the arguments are rea
let [, , sender, receiver, host, port] = process.argv;
host = host || 'localhost';
port = port || 7600;
port = port || 6865;
if (!sender || !receiver) {
console.log('Missing sender and/or receiver arguments, exiting.');
process.exit(-1);
@ -763,7 +763,7 @@ Note that the transaction filter was factored out as it can be shared. The final
let [, , sender, receiver, host, port] = process.argv;
host = host || 'localhost';
port = port || 7600;
port = port || 6865;
if (!sender || !receiver) {
console.log('Missing sender and/or receiver arguments, exiting.');
process.exit(-1);

View File

@ -1,6 +1,6 @@
The following example opens a transaction tree stream for Bob::
grpcurl -import-path . -proto com/digitalasset/ledger/api/v1/transaction_service.proto -plaintext -d '{"ledgerId" : "sandbox-0ed644f5-9451-4bb4-bd4f-f8900cd74df5", "filter": {"filtersByParty":{"Bob":{}}}, "begin": {"boundary":0 } }' localhost:8080 com.digitalasset.ledger.api.v1.TransactionService.GetTransactionTrees
grpcurl -import-path . -proto com/digitalasset/ledger/api/v1/transaction_service.proto -plaintext -d '{"ledgerId" : "sandbox-0ed644f5-9451-4bb4-bd4f-f8900cd74df5", "filter": {"filtersByParty":{"Bob":{}}}, "begin": {"boundary":0 } }' localhost:6865 com.digitalasset.ledger.api.v1.TransactionService.GetTransactionTrees
{
"transactions": [
{

View File

@ -129,7 +129,7 @@ In this section, you will run the quickstart application and get introduced to t
.. _quickstart-sandbox:
#. To run the :doc:`sandbox </tools/sandbox>` (a lightweight local version of the ledger), run ``da run sandbox -- --port 7600 --scenario Main:setup target/daml/*``
#. To run the :doc:`sandbox </tools/sandbox>` (a lightweight local version of the ledger), run ``da run sandbox -- --port 6865 --scenario Main:setup target/daml/*``
The output should look like this:
@ -140,13 +140,13 @@ In this section, you will run the quickstart application and get introduced to t
_\ \/ _ `/ _ \/ _ / _ \/ _ \\ \ /
/___/\_,_/_//_/\_,_/_.__/\___/_\_\
Initialized sandbox version 3.0.3 with ledger-id = sandbox-bb4a19ee-c0f8-444e-825a-1eb3c1ecd401, port = 7600, dar file = DamlPackageContainer(List(target/daml/qs.dar)), time mode = Static, daml-engine = {}
Initialized sandbox version 3.0.3 with ledger-id = sandbox-bb4a19ee-c0f8-444e-825a-1eb3c1ecd401, port = 6865, dar file = DamlPackageContainer(List(target/daml/qs.dar)), time mode = Static, daml-engine = {}
Initialized Static time provider, starting from 1970-01-01T00:00:00Z
DAML LF Engine supports LF versions: 1.0, 0; Transaction versions: 1; Value versions: 1
Starting plainText server
listening on localhost:7600
listening on localhost:6865
The sandbox is now running, and you can access its :ref:`ledger API <ledger-api-introduction>` on port ``7600``.
The sandbox is now running, and you can access its :ref:`ledger API <ledger-api-introduction>` on port ``6865``.
.. note::
@ -155,7 +155,7 @@ In this section, you will run the quickstart application and get introduced to t
.. _quickstart-navigator:
#. Open a new terminal window and navigate to your project directory.
#. Start the :doc:`Navigator </tools/navigator/index>`, a browser-based leger front-end, by running ``da run navigator -- server localhost 7600 --port 7500``
#. Start the :doc:`Navigator </tools/navigator/index>`, a browser-based leger front-end, by running ``da run navigator -- server localhost 6865 --port 7500``
The Navigator automatically connects the sandbox. You can access it on port ``7500``.
@ -490,7 +490,7 @@ To build automations and integrations around the ledger, the SDK has :doc:`langu
To start the Java integration in the quickstart application, run ``mvn compile exec:java@run-quickstart``
The application provides REST services on port ``8080`` to perform basic operations on behalf on ``Alice``.
The application provides REST services on port ``6865`` to perform basic operations on behalf on ``Alice``.
.. note::
@ -500,24 +500,24 @@ The application provides REST services on port ``8080`` to perform basic operati
The following REST services are included:
- ``GET`` on ``http://localhost:8080/iou`` lists all active Ious, and their Ids.
- ``GET`` on ``http://localhost:6865/iou`` lists all active Ious, and their Ids.
Note that the Ids exposed by the REST API are not the ledger contract Ids, but integers. You can open the address in your browser or run ``curl -X GET http://localhost:8080/iou``.
- ``GET`` on ``http://localhost:8080/iou/ID`` returns the Iou with Id ``ID``.
Note that the Ids exposed by the REST API are not the ledger contract Ids, but integers. You can open the address in your browser or run ``curl -X GET http://localhost:6865/iou``.
- ``GET`` on ``http://localhost:6865/iou/ID`` returns the Iou with Id ``ID``.
For example, to get the content of the Iou with Id 0, run:
``curl -X GET http://localhost:8080/iou/0``
- ``PUT`` on ``http://localhost:8080/iou`` creates a new Iou on the ledger.
``curl -X GET http://localhost:6865/iou/0``
- ``PUT`` on ``http://localhost:6865/iou`` creates a new Iou on the ledger.
To create another *AliceCoin*, run:
``curl -X PUT -d '{"issuer":"Alice","owner":"Alice","currency":"AliceCoin","amount":1.0,"observers":[]}' http://localhost:8080/iou``
- ``POST`` on ``http://localhost:8080/iou/ID/transfer`` transfers the Iou with Id ``ID``.
``curl -X PUT -d '{"issuer":"Alice","owner":"Alice","currency":"AliceCoin","amount":1.0,"observers":[]}' http://localhost:6865/iou``
- ``POST`` on ``http://localhost:6865/iou/ID/transfer`` transfers the Iou with Id ``ID``.
Find out the Id of your new *AliceCoin* using step 1. and then run:
``curl -X POST -d '{ "newOwner":"Bob" }' http://localhost:8080/iou/ID/transfer``
``curl -X POST -d '{ "newOwner":"Bob" }' http://localhost:6865/iou/ID/transfer``
to transfer it to Bob.

View File

@ -13,7 +13,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<daml-codegen-java.output>${project.build.directory}/generated-sources/iou</daml-codegen-java.output>
<ledgerhost>localhost</ledgerhost>
<ledgerport>7600</ledgerport>
<ledgerport>6865</ledgerport>
<party>Alice</party>
<restport>8080</restport>
</properties>

View File

@ -41,14 +41,14 @@ This example extracts:
- all contract data from the beginning of the ledger to the current latest transaction
- for the party ``Scrooge_McDuck``
- from a Ledger node or Sandbox running on host ``192.168.1.12`` on port ``7600``
- from a Ledger node or Sandbox running on host ``192.168.1.12`` on port ``6865``
- to PostgreSQL instance running on localhost
- identified by the user ``postgres`` without a password set
- into a database called ``daml_export``
.. code-block:: none
$ da run extractor -- postgresql --user postgres --connecturl jdbc:postgresql:daml_export --party Scrooge_McDuck -h 192.168.1.12 -p 7600 --to head
$ da run extractor -- postgresql --user postgres --connecturl jdbc:postgresql:daml_export --party Scrooge_McDuck -h 192.168.1.12 -p 6865 --to head
This terminates after reaching the transaction which was the latest at the time the Extractor started streaming.
@ -66,7 +66,7 @@ For what options to use, see the next sections.
Connecting the Extractor to a ledger
************************************
To connect to the Sandbox, provide separate address and port parameters. For example, ``--host 10.1.1.10 --port 7600``, or in short form ``-h 10.1.1.168 -p 7600``.
To connect to the Sandbox, provide separate address and port parameters. For example, ``--host 10.1.1.10 --port 6865``, or in short form ``-h 10.1.1.168 -p 6865``.
The default host is ``localhost`` and the default port is ``6865``, so you dont need to pass those.

View File

@ -23,7 +23,7 @@ Try out the Navigator Console on the Quickstart
With the sandbox running the :doc:`quickstart application </getting-started/quickstart>`
#. To start the shell, run ``da run navigator -- console localhost 7600``
#. To start the shell, run ``da run navigator -- console localhost 6865``
This connects Navigator Console to the sandbox, which is still running.

View File

@ -20,9 +20,9 @@ Sandbox can also be run manually as in this example::
/ __/__ ____ ___/ / / ___ __ __
_\ \/ _ `/ _ \/ _ / _ \/ _ \\ \ /
/___/\_,_/_//_/\_,_/_.__/\___/_\_\
initialized sandbox with ledger-id = sandbox-16ae201c-b2fd-45e0-af04-c61abe13fed7, port = 8080, dar file = DAR files at List(/Users/donkeykong/temp/da-sdk/test/Main.dar), time mode = Static, daml-engine = {}
initialized sandbox with ledger-id = sandbox-16ae201c-b2fd-45e0-af04-c61abe13fed7, port = 6865, dar file = DAR files at List(/Users/donkeykong/temp/da-sdk/test/Main.dar), time mode = Static, daml-engine = {}
Initialized Static time provider, starting from 1970-01-01T00:00:00Z
listening on localhost:8080
listening on localhost:6865
Here, ``da run sandbox --`` tells the SDK Assistant to run ``sandbox`` from the active SDK release and pass it any arguments that follow. The example passes the DAR file to load (``Main.dar``) and the optional ``--scenario`` flag tells Sandbox to run the ``Main:example`` scenario on startup. The scenario must be fully qualified; here ``Main`` is the module and ``example`` is the name of the scenario, separated by a ``:``. The scenario is used for testing and development; it is not run in production.
@ -32,7 +32,7 @@ Command-line reference
Sandbox requires the names of the input ``.dar`` or ``.dalf`` files as arguments to start.
The available command line options are listed here::
-p, --port <value> Sandbox service port. Defaults to 8080.
-p, --port <value> Sandbox service port. Defaults to 6865.
-a, --address <value> Sandbox service host. Defaults to binding on all addresses.
--dalf This argument is present for backwards compatibility. DALF and DAR archives are now identified by their extensions.
--static-time Use static time, configured with TimeService through gRPC.

View File

@ -178,7 +178,7 @@ public final class DamlLedgerClient implements LedgerClient {
}
public static void main(String[] args) throws SSLException {
DamlLedgerClient ledgerClient = DamlLedgerClient.forHostWithLedgerIdDiscovery("localhost", 8080, Optional.empty());
DamlLedgerClient ledgerClient = DamlLedgerClient.forHostWithLedgerIdDiscovery("localhost", 6865, Optional.empty());
ledgerClient.connect();
String ledgerId = ledgerClient.ledgerIdentityClient.getLedgerIdentity().blockingGet();
System.out.println("expectedLedgerId = " + ledgerId);

View File

@ -12,7 +12,7 @@ import com.digitalasset.daml.lf.engine.testing.SemanticTester
import com.digitalasset.daml.lf.lfpackage.{Ast, Decode}
import com.digitalasset.grpc.adapter.AkkaExecutionSequencerPool
import com.digitalasset.platform.apitesting.{LedgerContext, PlatformChannels, RemoteServerResource}
import com.digitalasset.platform.sandbox.config.DamlPackageContainer
import com.digitalasset.platform.sandbox.config.{DamlPackageContainer, SandboxConfig}
import scala.concurrent.{Await, ExecutionContext}
import scala.concurrent.duration._
@ -84,7 +84,7 @@ object StandaloneSemanticTestRunner {
private val defaultConfig = Config(
host = "localhost",
port = 6865,
port = SandboxConfig.DefaultPort,
packageContainer = DamlPackageContainer(),
performReset = false,
)
@ -93,7 +93,7 @@ object StandaloneSemanticTestRunner {
head("Semantic test runner")
opt[Int]('p', "port")
.action((x, c) => c.copy(port = x))
.text("Ledger API server port. Defaults to 6865.")
.text(s"Ledger API server port. Defaults to ${SandboxConfig.DefaultPort}.")
opt[String]('h', "host")
.action((x, c) => c.copy(host = x))

View File

@ -19,7 +19,7 @@ trait MultiLedgerFixture
protected def config: Config
protected def basePort = 8080
protected def basePort = 6865
/** Overriding this provides an easy way to narrow down testing to a single implementation. */
override protected def fixtureIdsEnabled: Set[LedgerBackend] = LedgerBackend.allBackends

View File

@ -35,7 +35,7 @@ object Application {
class Server(
actorSystemName: String,
addressOption: Option[String],
serverPort: Int = 8080,
serverPort: Int,
config: => SandboxConfig,
maybeBundle: Option[SslContext] = None)
extends AutoCloseable {

View File

@ -16,7 +16,7 @@ java -jar sandbox-<version>-SNAPSHOT.jar [options] <archive>
## Command line arguments
```
-p, --port <value> Sandbox service port. Defaults to 8080.
-p, --port <value> Sandbox service port. Defaults to 6865.
-a, --address <value> Sandbox service host. Defaults to binding on all addresses.
--dalf Parse provided archives as DAML-LF Archives instead of DARs.
--static-time Use static time, configured with TimeService through gRPC.

View File

@ -46,7 +46,7 @@ object LedgerApiServer {
ledgerBackend: LedgerBackend,
timeProvider: TimeProvider,
config: => SandboxConfig,
serverPort: Int = 8080,
serverPort: Int, //TODO: why do we need this if we already have a SandboxConfig?
optTimeServiceBackend: Option[TimeServiceBackend],
optResetService: Option[SandboxResetService])(
implicit materializer: ActorMaterializer): LedgerApiServer = {
@ -185,7 +185,7 @@ class LedgerApiServer(
services: (ActorMaterializer, ExecutionSequencerFactory) => Iterable[BindableService],
optResetService: Option[SandboxResetService],
addressOption: Option[String],
serverPort: Int = 8080,
serverPort: Int,
maybeBundle: Option[SslContext] = None)(implicit materializer: ActorMaterializer)
extends AutoCloseable {
@ -215,6 +215,7 @@ class LedgerApiServer(
private var runningServices: Iterable[BindableService] = services(materializer, serverEsf)
def getServer = server
private var server: Server = _
private def start(): LedgerApiServer = {

View File

@ -31,7 +31,7 @@ object SandboxApplication {
class SandboxServer(
actorSystemName: String,
addressOption: Option[String],
serverPort: Int = 8080,
serverPort: Int,
config: => SandboxConfig,
maybeBundle: Option[SslContext] = None)
extends AutoCloseable {

View File

@ -35,7 +35,7 @@ object Cli {
opt[Int]('p', "port")
.action((x, c) => c.copy(port = x))
.text("Sandbox service port. Defaults to 8080.")
.text(s"Sandbox service port. Defaults to ${SandboxConfig.DefaultPort}.")
opt[String]('a', "address")
.action((x, c) => c.copy(addressOption = Some(x)))

View File

@ -41,10 +41,13 @@ final case class CommandConfiguration(
commandTtl: FiniteDuration)
object SandboxConfig {
val DefaultPort = 6865
def default: SandboxConfig = {
SandboxConfig(
None,
6865,
DefaultPort,
DamlPackageContainer(Nil),
TimeProviderType.Static,
TimeModel.reasonableDefault,

View File

@ -13,7 +13,7 @@ class SandboxContextSpec extends WordSpec with Matchers with TestHelpers {
"SandboxContext" should {
"parse command line arguments" in {
val port = Array("--port", "8080")
val port = Array("--port", "6865")
val time = Array("--static-time")
val dar = Array(TestDar.dalfFile.toString)
@ -22,7 +22,7 @@ class SandboxContextSpec extends WordSpec with Matchers with TestHelpers {
val Some(ctx) = SandboxContext(port ++ time ++ dar ++ dalf)
val config = ctx.config
config.port shouldEqual 8080
config.port shouldEqual 6865
config.damlPackageContainer.files should contain theSameElementsAs List(
TestDar.dalfFile,
new File(dalfFileName))

View File

@ -9,7 +9,7 @@ set -euxo pipefail
PATH="${PATH}:/usr/sbin" #lsof is not on the PATH by default
WORKING_DIR=$(pwd)
PORT=8080
PORT=6865
function get_pid_listening_on_port () {
echo $(lsof -i:${PORT} -t)

View File

@ -38,6 +38,6 @@ RUN set -eux; \
chmod u+x $START
EXPOSE 7500
EXPOSE 7600
EXPOSE 6865
CMD ./$START