Production Setup
Setup your Picnic Auth instance.
Initial Setup
Start by cloning the repository:
# ssh
$ git clone git@github.com:simonneutert/picnic-auth.git
# https
https://github.com/simonneutert/picnic-auth.git
Setup the environment variables:
$ cp .env.example .env
Please, create your bcrypt password hash (do not use online services for this
🙏).
There's a deno task to help you with this:
# single quotes around the password are important 🤓
$ deno task bcrypt 'your-secure-password'
using Docker
$ docker build -t picnic-auth .
$ docker run --rm -ti picnic-auth task bcrypt 'your-secure-password'
Finally, run the server:
$ deno run --allow-net --allow-env server.ts
OR
You can use deno serve
to run the server in production mode and on all cores
(but ... let's be honest, you won't need that):
$ deno serve --allow-env --allow-net --parallel server.ts
More about deno run/serve.
Hosting
You can host your Picnic Auth instance on any cloud provider that supports Deno.\
Best you use Deno Deploy, as it's the easiest way to get started.
Setup Environment Variables on Deno Deploy.
Docker
When running the container, you can use the following command:
$ docker build -t picnic-auth .
$ docker run --env-file .env --rm -ti -p8000:8000 picnic-auth
Docker Compose
When using Docker Compose, you can use the following docker-compose.yml
file:
services:
app:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
env_file:
- .env
IMPORTANT note on passing the .env
file
In order to not run into issues with the bcrypted password hash and the JWT
secret,
it is recommended to use the env-file
attribute and pass the .env
file.
Else you might run into issues with the password hash and the JWT secret.
The server will still start running, but you won't be able to login. 😵💫
A debugging nightmare.