Self Hosting #1695
Replies: 2 comments
-
| 
         Hi @trymeouteh, sorry I've only just seen this. Please follow these steps: Self-hosted ProcaptchaPre-requisites
 Set up your Captcha ProviderStep 1.Clone https://github.com/prosopo/captcha to your VPS Step 2.Create your env file Step 3.Provider AccountThese variables refer to a Polkadot account (sr25519 format) that will be used to secure your API and payloads Create one using this script from within the root of the repo: Caddy DomainThe caddy domain is the host for your Provider (e.g.  Not RequiredFill in the missing env variables. The following are not required Step 3. Start the docker servicesThe docker services use the docker-compose.provider.yml in the captcha repo. They also refer to the .env.production that you created above. Start them with the following command. Step 4. Load your image captcha dataset# Docker cp the dataset file to the provider container
docker cp "{{ home_folder }}/{{ DATASET_FILE }}" "provider1:/usr/src/app/{{ DATASET_FILE }}"
# Import the dataset
docker exec -it provider1 bash -c "npx provider provider_set_data_set --file /usr/src/app/{{ DATASET_FILE }}"Step 5. Obtain your detector bundleContact [email protected] with a request for an obfuscated detector package. This is the code here: https://github.com/prosopo/captcha/blob/745cc897c61b7f92b5090cd46cf89ffd515f1eb4/packages/detector/src/index.js You must provide in your request 
 import crypto from "node:crypto";
export function generateKeyPair(): { publicKey: string; privateKey: string } {
	// Generate the keypair with specific parameters
	const { privateKey, publicKey } = crypto.generateKeyPairSync("rsa", {
		modulusLength: 2048,
		publicKeyEncoding: {
			type: "spki",
			format: "pem",
		},
		privateKeyEncoding: {
			type: "pkcs8",
			format: "pem",
		},
	});
	// Convert to base64
	const privateKeyBase64 = Buffer.from(privateKey).toString("base64");
	const publicKeyBase64 = Buffer.from(publicKey).toString("base64");
	return {
		privateKey: privateKeyBase64,
		publicKey: publicKeyBase64,
	};
}
console.log(generateKeyPair());We will then send you the contents of  Step 6. Build procaptcha.bundle.js and hostBuild the procaptcha JS after making some changes to the source code. 
 Then, from within your forked captcha repo: Copy the outputs of  From this point onwards, implement the client-side as per our docs, switching our script URL for your own. Step 7. Server-side verificationWe run an API for verification which you could replicate but it is not open-source and not advised. For your own verification purposes it is better to use the @prosopo/server package, which will contact the provider directly instead of navigating via an API.  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         @trymeouteh Please let us know if you manage to self-host!  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Please allow for anyone to self host their own Procaptcha instance with documentation.
Beta Was this translation helpful? Give feedback.
All reactions