Skip to content

An Railway app starter for hosting your xBrowserSync API server on Railway.

License

Notifications You must be signed in to change notification settings

ajhalili2006/xbrowsersync-railwayapp-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xBrowserSync API Server on Railway

xBrowserSync is a free tool for syncing browser data between different browsers and devices, built for privacy and anonymity. For full details, see the project's homepage.

This Railway starter contains the necessary Dockerfile and other niffty gitty stuff in order for you to successfully configure and run your own xBrowserSync API server.

Deployment instructions

  1. Create an new project with this template using the deploy button below.

Deploy on Railway

  1. After everything is provisioned, install mongosh, connect to your MongoDB instance with mongosh <railwayapp-mongodb-url-here> and run the following inside the shell, one by one:

    use admin
    db.createUser({ user: "xbrowsersyncdb", pwd: "[password]", roles: [ { role: "readWrite", db: "xbrowsersync" }, { role: "readWrite", db: "xbrowsersynctest" } ] })
    use xbrowsersync
    db.newsynclogs.createIndex( { "expiresAt": 1 }, { expireAfterSeconds: 0 } )
    db.newsynclogs.createIndex({ "ipAddress": 1 })

    Remember to generate an secure secret using the Generate a 32-character secret in the Command Patlete (Cmd+K) and replace [password] with that generated secret.

  2. Go to Variables and set XBROWSERSYNC_DB_PWD into that generated secret you set for xbrowsersyncdb user.

  3. Wait for the deployment to be restarted. Once successfully deployed, welcome aboard! If your server is also public, the xBrowserSync project maintainers recommend you to add a TTL index on bookmarks.lastAccessed to delete syncs that have not been accessed for atleast 3 weeks using the following command:

    use xbrowsersync
    db.bookmarks.createIndex( { "lastAccessed": 1 }, { expireAfterSeconds: 21*86400 } )

Customizing configuration

It's advisable to ensure your repository is private. DO NOT DO THIS on public repos and instead edit the template file instead.

  1. Copy the contents of settings-template.json to settings.json and edit as needed. Remember to replace the environment variables with its real values since the entrypoint scipt won't parse them all!
  2. Comment out L11 and uncomment L10 in Dockerfile to make use of your config.
  3. Don't forget to commit and push so Railway can catch these changes.

Upgrading to latest versions

⚠️ Remember not to downgrade versions as this might be an cause for downtime shitshows of your service.

  1. Visit https://github.com/xbrowsersync/api/releases and find the latest version. As of writing of the docs, it's 1.1.13.
  2. In the variables page, set XBROWSERSYNC_API_VERSION into that version. This will trigger an redeploy so please hold on.

License

MIT