Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deploy gun server by Docker? #1339

Open
liuqixing opened this issue Oct 23, 2023 · 4 comments
Open

How to deploy gun server by Docker? #1339

liuqixing opened this issue Oct 23, 2023 · 4 comments

Comments

@liuqixing
Copy link

I wrote the gun server:
` const port = ParamUtils.getPort();
const host = ParamUtils.getHost();
const peers = ParamUtils.getPeers();

const app = express();
app.use( Gun.serve );
app.use( express.static( __dirname ) );

app.get( '/', ( req, res ) =>
{
	res.send( 'Hello, this is express HTTP server' );
} );
app.get( '/gun', ( req, res ) =>
{
	console.log( 'serving gun' );
	return Gun.serve;
} );

const server = app.listen( port, host, () =>
{
	console.log( `Sync peer is running at http://${ host }:${ port }` );
} );
const gun = Gun( {
	web : server,
	peers : peers,
	localStorage : false,
} );

//	...
gun.get( 'sync' ).on( ( data, key ) =>
{
	console.log( `Server : on sync: `, data, key );
} );`

And deploy it by Docker.
And then i wrote a client to connect to it, but it did not work. The server does not receive anything.
And client get an error code 1006
here is client code:
const peers = ParamUtils.getPeers( peers ); const gun = Gun( { peers : peers } ); gun.get( 'sync' ).put( data, ( ack ) => { });

@liuqixing
Copy link
Author

is there anybody who can help me?

@gustavcorpas
Copy link

Am I correct in that this is not an issue, but more of a question?

In case your issue is a question, those are usually well received over at the gitter chat: gitter chat

@bmatusiak
Copy link
Collaborator

yes please use gitter chat,, gun does have a Dockerfile

my thought is to find the docker docs about how to run a project with a Dockerfile

@bmatusiak
Copy link
Collaborator

git clone https://github.com/amark/gun.git
cd gun
docker build -t gun .
docker run -p 8765:8765 -t gun

then open
http://localhost:8765

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants