Skip to content

Commit

Permalink
chore: change ipfs default to remote mode and remove bundled ceramic-…
Browse files Browse the repository at this point in the history
…one (#3261)

* chore: throw error rather than start ceramic-one in bundled mode from daemon
* chore: set daemon defaults to use remote ipfs at ceramic-one ports
* chore: remove ceramic-one install from dockerfile as we don't support bundled mode

---------

Co-authored-by: Spencer T Brody <[email protected]>
  • Loading branch information
dav1do and stbrody authored Jul 18, 2024
1 parent bca5232 commit 962546e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
7 changes: 0 additions & 7 deletions Dockerfile.daemon
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ FROM node:20 as ceramic

RUN apt-get update && apt-get install -y netcat-traditional gettext-base jq

COPY ci-scripts/install-rust-ceramic.sh ./

ARG RUST_CERAMIC_VERSION=latest
RUN ./install-rust-ceramic.sh ${RUST_CERAMIC_VERSION}

WORKDIR /js-ceramic

Expand All @@ -25,14 +21,11 @@ ARG GIT_COMMIT_HASH=docker

RUN lerna run build

ENV CERAMIC_ONE_PATH=/usr/local/bin/ceramic-one CERAMIC_ONE_STORE_DIR=~/.ceramic-one

EXPOSE 7007

ENTRYPOINT ["./packages/cli/bin/ceramic.js", "daemon"]

FROM ceramic as composedb

ARG COMPOSEDB_VERSION=latest
ENV CERAMIC_ONE_PATH=/usr/local/bin/ceramic-one CERAMIC_ONE_STORE_DIR=~/.ceramic-one
RUN npm install --location=global @composedb/cli@${COMPOSEDB_VERSION}
2 changes: 1 addition & 1 deletion packages/cli/src/ceramic-cli-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const generateDefaultDaemonConfig = () => {
'auth-method': AnchorServiceAuthMethods.DID,
},
'http-api': { 'cors-allowed-origins': [new RegExp('.*')], 'admin-dids': [] },
ipfs: { mode: IpfsMode.BUNDLED },
ipfs: { mode: IpfsMode.REMOTE, host: 'http://localhost:5101' },
logger: { 'log-level': LogLevel.important, 'log-to-files': false },
metrics: {
'metrics-exporter-enabled': false,
Expand Down
9 changes: 8 additions & 1 deletion packages/cli/src/ceramic-daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,14 @@ export class CeramicDaemon {
ceramicConfig.loggerProvider.getDiagnosticsLogger(),
opts.ipfs?.host
)
const ipfsId = await ipfs.id()
let ipfsId
try {
ipfsId = await ipfs.id()
} catch (err) {
throw new Error(
`Error connecting to p2p node. Make sure ceramic-one is running or use --ipfs-api to modify the expected http location (currently ${opts.ipfs?.host}): ${err}`
)
}

// we need to change the values before processing the config, so we keep track to log the warning after we have logging set up
const desiredIpfsClient = EnvironmentUtils.useRustCeramic() ? 'ceramic-one' : 'kubo'
Expand Down
7 changes: 2 additions & 5 deletions packages/cli/src/ipfs-connection-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ export class IpfsConnectionFactory {
return ipfsApi
} else {
if (EnvironmentUtils.useRustCeramic()) {
return ipfs.createIPFS(
{
rust: ipfs.RustIpfs.defaultOptions(network),
},
false
throw new Error(
`Running ceramic-one in bundled mode is not supported. Pass --ipfs-api to connect to an external ceramic-one node.`
)
} else {
return this.createGoIPFS()
Expand Down
1 change: 0 additions & 1 deletion packages/ipfs-daemon/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './create-ipfs.js'
export * from './ipfs-daemon.js'
export * from './healthcheck-server.js'
export * from './rust-ipfs.js'

0 comments on commit 962546e

Please sign in to comment.