Need help to deploy strapi docker on my server

System Information
  • Strapi Version: 3.2.5 in docker
  • Operating System: ubuntu 20.04
  • Database: sqLite
  • Node Version: 12
  • NPM Version: ~6
  • Yarn Version:

Hello, i’m running a strapi/strapi docker container behind a caddyv2 reverse proxy. I’m new to strapi and self-hosting and i don’t understand how to make this works. My plan is to run strapi with sqLite in production as i want to keep the stack light.

so my docker-compose looks like this

version: '3'
services:
  strapi:
    image: strapi/strapi
    container_name: strapi  
    restart: unless-stopped
    volumes:
      - ~/docker/strapi/app:/srv/app
    ports:
      - '1337:1337'

my CaddyFile contains this:

strapi.xxxxxxx.com {
	reverse_proxy * localhost:1337
}

in strapi, my config/server.js file is:

  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  url: 'strapi.xxxxxxx.com'
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET', 'xxxxxxxxxxxxxxxxxxxx'),
    },
  },
});

From now, i’m not sure what i should do. cause i cant access my admin with the url:

strapi.xxxxxxx.com/admin

I did not forget to restart both caddy and docker after changing my various configuration files. I tried tweaking a little bit without success and cannot find precise documentation for what i’m trying to do. I’m probably missing few things and hope for some help to help me run my project.

thanks a lot.

You will want to make sure this has http:// or https:// in it and rebuild the admin panel.

I am a bit confused about which env variables are needed at build time and which env vars van be set at run time? Especially the url “https://api.example.com” seems like it can only be set at build time? Is that so?

It is used both during build and run time.

During build time that variable,the STRAPI_LICENSE var, and NODE_ENV are the only three used and compiled/built into the React admin panel (the license one only applies to EE users). The url key/env var is also used during runtime within the Strapi Koa.js backend to modify variables of various plugins such as

  • Users-Permissions plugin for 3rd party auth callbacks and email templates
  • Upload plugin (local provider) for file uploads
  • strapi-admin package for admin related emails and links
  • various other parts of the Strapi code-base