Git Product home page Git Product logo

strapi-docker's Introduction

Strapi containerized

โš ๏ธ This image is only for Strapi v3. For now, we will not update it for v4.

However, to build an image compatible with Strapi v4, we recommend you check out this tool created by the Strapi Community: https://github.com/strapi-community/strapi-tool-dockerize


Strapi

API creation made simple, secure and fast. The most advanced open-source Content Management Framework to build powerful API with no effort.


Travis Docker Pulls

Images

Strapi comes with two images: strapi/strapi and strapi/base.

Use strapi/strapi to create a new project or run a project on your host machine.

Use strapi/base to build a Dockerfile and create an image for your app.

How to use strapi/strapi

This image allows you to create a new strapi project or run a project from your host machine. The default command that will run in your project is strapi develop.

Creating a new project

When running this image, strapi will check if there is a project in the /srv/app folder of the container. If there is nothing then it will run the strapi new command in the container /srv/app folder. You can create a new project by running this command.

docker run -it -p 1337:1337 -v `pwd`/project-name:/srv/app strapi/strapi

This command creates a project with an SQLite database. Then starts it on port 1337.

The -v option creates a project-name folder on your computer that will be shared with the docker container. Once the project is created it will be available in this folder on your computer.

Environment variables

When creating a new project with this image you can pass database configurations to the strapi new command.

  • DATABASE_CLIENT a database provider supported by Strapi: (sqlite, postgres, mysql ,mongo).
  • DATABASE_HOST database host.
  • DATABASE_PORT database port.
  • DATABASE_NAME database name.
  • DATABASE_USERNAME database username.
  • DATABASE_PASSWORD database password.
  • DATABASE_SSL boolean for SSL.
  • EXTRA_ARGS pass extra args to the strapi new.

Example

You can create a strapi project that will connect to a remote postgres database like so:

docker run -it \
  -e DATABASE_CLIENT=postgres \
  -e DATABASE_NAME=strapi \
  -e DATABASE_HOST=0.0.0.0 \
  -e DATABASE_PORT=5432 \
  -e DATABASE_USERNAME=strapi \
  -e DATABASE_PASSWORD=strapi \
  -p 1337:1337 \
  -v `pwd`/project-name:/srv/app \
  strapi/strapi

You can also create projects using docker-compose. See examples of using these variables with docker-compose in the examples folder.

Running a project from your host machine

You can also use strapi/strapi to run a project you already have created (or cloned for a repo) on your computer.

First make sure to delete the node_modules folder if you have already installed your dependencies on your host machine. Then run:

cd my-project
docker run -it -p 1337:1337 -v `pwd`:/srv/app strapi/strapi

This will start by installing the dependencies and then run strapi develop in the project.

Environment variables

If you are using environment variables in your code you can pass them with the -e option (e.g docker run -e ENV_VAR=sth ...).

You can for example set your database configuration with environment variables. Because the default container command is strapi develop you will need to update your development database configuration following the production example in the documentation. Then you can run:

docker run -it \
  -e DATABASE_NAME=strapi \
  -e DATABASE_HOST=0.0.0.0 \
  -e DATABASE_PORT=1234 \
  -e DATABASE_USERNAME=strapi \
  -e DATABASE_PASSWORD=strapi \
  -p 1337:1337 \
  -v `pwd`/project-name:/srv/app \
  strapi/strapi

Upgrading Strapi in Docker container

  • Important! Upgrading strapi/strapi Docker image tag does not upgrade Strapi version.
    • Strapi NodeJS application builds itself during first startup only, if detects empty folder and is normally stored in mounted volume. See docker-entrypoint.sh.
  • To upgrade, first follow the guides (general and version-specific) to rebuild actual Strapi NodeJS application. Secondly, update docker tag to match the version to avoid confusion.

How to use strapi/base

When deploying a strapi application to production you can use docker to package your whole app in an image. You can create a Dockerfile in your strapi project like the one in ./examples/custom

Building the images in this repository

You can build the images with the build command. To see the options run:

yarn install
./bin/build.js --help

strapi-docker's People

Contributors

5ika avatar alexandrebodin avatar arsenx avatar aurelsicoko avatar baminou avatar brad-christie avatar dependabot[bot] avatar devaublanc avatar eventyret avatar fdiskas avatar jenseickmeyer avatar lauriejim avatar lguima avatar lkostrowski avatar lucaperret avatar lvnilesh avatar moq93 avatar msgeissler avatar nurikabe avatar pgrimaud avatar phamviet avatar pierreburgy avatar rstrydom avatar sandrotaje avatar stianovrevage avatar sylvaingirardbe avatar techguydave avatar trambi avatar wrzlbrmft avatar yashutanna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

strapi-docker's Issues

Running in multi-container/node/zone deployment

Hello, I'm new with strapi and it looks very interesting for many of our projects. One thing that I'm struggling with is how to run containerized strapi with multi-container/multi-node deployment (k8s, ecs etc.). The issues/questions I've discovered so far:

  1. each container needs local volume to install plugins and dependencies, is it safe to run multiple containers mounted in same volume? Wouldn't it break if all containers try to start at once and install dependencies?
  2. i think the best scenario would be running the container without any volumes, no problem with node_modules installation (in custom image), but is it possible to do this with plugins (preinstall plugins and possibly disable installation from administration) so the app starts much quicker and it's no problem to drop container and start another one?
  3. is the strapi app ok with running same app in multiple instances/containers behind load balancer? For example after updating the model, the app restarts. Can't imagine how to do that with multiple instances.

Thanks for any answer/s.

Could not use with AWS ECS containers

I tried using the compose file along with ECS CLI to deploy the containers into ECS cluster. It creates and run the cluster but I could not access the public IP of the container instance at port 1337. It just times out.

I tried running this docker-compose up locally and it works.

Just wondering what additional criteria I would have to go if I am running in the cloud.

Unable to generate controller or model

Hi
When i try to generate a model or a controller inside my api container, i get this error :
error No generator called model found.
error No generator called controller found.

The others generators are working fine.

/admin showing nothing

I have strapi running on a single node Swarm Cluster, I'm able to access the first page You are looking at: ./public/index.html. but when I try to go to /admin nothing show up, only a white page with the tittle Strapi Admin and the Icon, this is what I get from:

Network:
screen shot 2018-07-04 at 4 42 20 pm

Console:
screen shot 2018-07-04 at 4 42 56 pm

Elements:
screen shot 2018-07-04 at 4 42 44 pm

docker-compose.yml

version: '3.6'

services:
  strapi:
    image: strapi/strapi:v3.0.0-alpha.12.4
    environment:
      - APP_NAME=app
      - DATABASE_CLIENT=mongo
      - DATABASE_HOST=ip
      - DATABASE_PORT=port
      - DATABASE_NAME=database
      - HOST=localhost
    ports:
      - 5060:1337
    volumes:
      - /data/disk1/strapi:/usr/src/api/app
    deploy:
      replicas: 1

Logs:
screen shot 2018-07-05 at 10 40 41 am

Error connecting to Mongo with production environment

I'm trying to start the Strapi container passing the NODE_ENV var to production but after everything is created I have got this error and the container continues to restart:

I NETWORK  [conn14] Error receiving request from client: SSLHandshakeFailed: SSLHandshakeFailed. Ending connection from ...

Is there something I'm missing? Everything working normal with NODE_ENV=development.

Docker stack

Using docker stack deploy instead of docker-compose
Strapi cannot connect to the db
Here is the YML

version: "3"

services:

  strapi:
    image: salsa_api
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    networks:
      - w1
    ports:
      - "1337:1337"
    environment:
      - APP_NAME=strapi-app
      - DATABASE_CLIENT=mongo
      - DATABASE_HOST=db
      - DATABASE_PORT=27017
      - DATABASE_NAME=strapi
      - DATABASE_USERNAME=
      - DATABASE_PASSWORD=
      - DATABASE_SSL=false
      - DATABASE_AUTHENTICATION_DATABASE=strapi
      - HOST=localhost
    volumes:
      - ./strapi-app:/usr/src/api/strapi-app
      # - /usr/src/api/strapi-app/node_modules
  db:
    image: mongo
    environment:
      - MONGO_INITDB_DATABASE=strapi
    deploy:
      replicas: 2
      resources:
        limits:
          cpus: "0.1"
          memory: 100M
      restart_policy:
        condition: on-failure
    ports:
      - "27017:27017"
    networks:
      - w1
    volumes:
      - ./db:/data/db

networks:
  w1:

[Suggestion] Build specific versions of strapi and align image tag

I would like to suggest and talk about the following change (unless that change was already planned anyways):
Once the docker-image and Dockerfile have been proven to be stable (not necessarily strapi itself but the Docker part built around it), it should build specific versions of strapi and tag the image accordingly (e.g. strapi/strapi:v3.0.0-alpha.11).
Right now a user never knows which version of strapi is contained within any given image tag until the image has actually been downloaded and started.

Using environment variables in the Dockerfile it should be possible to use the CI to build, tag and push specific versions of strapi and the image.

What to save on Git?

Hey there,

I am curently using a docker-compose containing the official images used to make strapi run.

I would like to know which folders have to be saved on github when you want to commit your code?

For now, after some research, it looks llike everything (all folders) are pushed, which might get pretty heavy with a project growing up, is there a reason for that? Cannot the admin / functionnal part not be pushed while commiting since the docker-compose will rebuild everything anyway?

Thank you in advance for your answers!

Prod deploy into a separated container from the API module

Informations

  • Node.js version:10.10.0
  • npm version:6.4.1
  • Strapi version:3.0.0-alpha.14.1.1
  • Database:Postgres
  • Operating system:Mac high Sierra

What is the current behavior?
What about running the admin console pointing to a separate api on another server ?
that would be running the admin console with the addition of this, but not DB associated locally:

I would really appreciate your clarification on this one. thank you heaps in advance.

"admin": {
    "build": {
      "host": "http://localhost:4000/admin",
      "backend": "https://mydomain.com",
      "plugins": {
        "source":  "host",
        "folder": "/plugins"
      }
    }

would this work or the admin console would still to need to have access to the DB in order to start properly?
I just tried it and I get this errors:

[2018-09-21T12:49:10.128Z] info strapi-local-auth initialized
(node:2245) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
From previous event:
    at Client_PG.acquireRawConnection (/Workspaces/Storyx-WKS/admin-new/node_modules/knex/lib/dialects/postgres/index.js:147:12)
    at create (/Workspaces/Storyx-WKS/admin-new/node_modules/knex/lib/client.js:280:23)
    at tryPromise (/Workspaces/Storyx-WKS/admin-new/node_modules/tarn/lib/Pool.js:366:22)
    at tryPromise (/Workspaces/Storyx-WKS/admin-new/node_modules/tarn/lib/utils.js:57:20)
    at Promise (/Workspaces/Storyx-WKS/admin-new/node_modules/tarn/lib/Pool.js:366:5)
    at new Promise (<anonymous>)
    at callbackOrPromise (/Workspaces/Storyx-WKS/admin-new/node_modules/tarn/lib/Pool.js:357:10)
    at Pool._create (/Workspaces/Storyx-WKS/admin-new/node_modules/tarn/lib/Pool.js:307:5)
    at Pool._doCreate (/Workspaces/Storyx-WKS/admin-new/node_modules/tarn/lib/Pool.js:275:32)
    at Pool._tryAcquireOrCreate (/Workspaces/Storyx-WKS/admin-new/node_modules/tarn/lib/Pool.js:212:12)
    at Pool.acquire (/Workspaces/Storyx-WKS/admin-new/node_modules/tarn/lib/Pool.js:119:10)
    at /Workspaces/Storyx-WKS/admin-new/node_modules/knex/lib/client.js:335:26
From previous event:
    at Client_PG.acquireConnection (/Workspaces/Storyx-WKS/admin-new/node_modules/knex/lib/client.js:334:34)
    at Runner.ensureConnection (/Workspaces/Storyx-WKS/admin-new/node_modules/knex/lib/runner.js:228:24)
    at Runner.run (/Workspaces/Storyx-WKS/admin-new/node_modules/knex/lib/runner.js:34:42)
    at SchemaBuilder.Target.then (/Workspaces/Storyx-WKS/admin-new/node_modules/knex/lib/interface.js:20:43)
(node:2245) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)
(node:2245) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:2245) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)

Steps to reproduce the problem
Bring DB down and run npm start with a api component running on another server.

What is the expected behavior?
Run an admin console with not DB connection other than doing it thorough the API module

Suggested solutions

installed version is 14.0 but installer is 14.2

Somehow, after i run "docker-compose up", everything installs and starts, but powered by strapi 14 version. This is critical, because on this version creating new content type via GUI is impossible. And many other things not working.

content type config error

Hi
When I config my content type at
localhost:1337/admin/plugins/content-manager/ctm-configurations/xxx,
I got a blank page with this error in console:

main.js:16 TypeError: Cannot read property 'getIn' of undefined
    at e.value (main.js:54)
    at main.js:54
    at We.__iterate (main.js:6)
    at We.forEach (main.js:6)
    at e.value (main.js:54)
    at new e (main.js:54)
    at main.js:48
    at Ae (main.js:6)
    at Ae (main.js:6)
    at Ae (main.js:6)

navigator.userAgent:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36

Images with preinstalled modules

Would it be better if we would have containers which are already build up with all modules etc to reduce the necessary startup time of containers?

Add Option to specify Authentication DB in yml file

I've been unable to use this image to connect to a custom MongoDB. I am receiving authentication errors using known working credentials.

I am able to connect to the same DB using a non-docker install of the same version (alpha 12.2) of Strapi directly from the command line. Best I can tell, the main difference is command line install with the prompts asks for the Authentication DB separately.

Would there be some way to include that as an optional environment variable to set? Or, if it is already possible with the current image a few pointers to get it working?

Thanks!

Update doesn't work in case of strapi running on docker container

Update doesn't work in case of strapi running on docker container. Doesn't update the record or the image attached.

1 | [2018-05-23T01:53:12.539Z] debug GET /content-manager/explorer/events/5b047065098ddd77ae3c4307?source=content-manager (48 ms)
api_1 | [2018-05-23T01:53:12.547Z] debug GET /content-manager/layout?source=content-manager (25 ms)
api_1 | [2018-05-23T01:53:19.538Z] error this.updateRelations is not a function
api_1 | [2018-05-23T01:53:19.540Z] debug PUT /content-manager/explorer/events/5b047065098ddd77ae3c4307?source=content-manager (42 ms)

cannot start container strapi:latest

Hello I tryed to run strapi + mongodb on docker (making them run from portainer) but it crashes at start

ENV parameters:

parameter value
DATABASE_CLIENT MongoDB
DATABASE_HOST mongodb_strapi
DATABASE_USERNAME *****
DATABASE_PASSWORD *****
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NODE_VERSION 9.11.1
YARN_VERSION 1.5.1
DATABASE_NAME strapi
DATABASE_PORT 27017
DATABASE_SSL false

error from docker logs:

๐Ÿš€ Start creating your Strapi application. It might take a minute, please take a coffee โ˜•๏ธ
Lets configurate the connection to your database:
Database determined by CLI args: MongoDB
(node:6) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'value' of undefined
    at inquirer.prompt.then.answers (/usr/local/lib/node_modules/strapi/node_modules/strapi-generate-new/lib/before.js:111:53)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:697:11)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
(node:6) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
./strapi.sh: cd: line 28: can't cd to strapi-app

docker engine version:

parameter value
Version 18.06.0-ce
API version 1.38
Go version go1.10.3
OS type linux
OS Ubuntu 16.04.5 LTS
Architecture amd64
Kernel version 4.13.0-1012-gcp

thank you!

Impossible to run a Docker Strapi container

Hi there,

Just discovered Strapi, and I love it. But impossible to use it with docker.

Tried with my own dockerfile without any success Error: Cannot find module 'stream-to-array'

Tried with this dockerfile, without any success: error Something else already exists at /usr/src/api/strapi-app/node_modules.

If someone figures it out how to start a container, would love some help, thanks.

Thanks

/admin path not loading correctly with nginx reverse_proxy

Hello,

I have been trying to setup the Docker containter of Strapi behind a nginx reverse proxy. The Docker container is configured as follows:


docker run -e APP_NAME=strapi-app \
               -e DATABASE_CLIENT=mongo \
               -e DATABASE_HOST=XXX \
               -e DATABASE_PORT=27017 \
               -e DATABASE_NAME=strapi \
               -v `pwd`/strapi-app:/usr/src/api/strapi-app \
               -p 8004:1337 \
               --name strapi -d strapi/strapi

And the configuration of the nginx server is the following:

location /strapi/ {
            allow all;
            proxy_http_version 1.1;
            proxy_set_header  X-Forwarded-For    $proxy_add_x_forwarded_for;
            proxy_set_header  Host               $http_host;
            proxy_set_header  X-Real-IP          $remote_addr;
            proxy_set_header  X-Forwarded-Proto  $scheme;
            proxy_set_header Accept-Encoding "";
            proxy_pass http://127.0.0.1:8004/;

            ModSecurityEnabled on;
            ModSecurityConfig modsec_includes.conf;
}

When I go to https://my.domain.co/path/to/strapi/, I can see the welcome page but when I try to go to the admin page at https://my.domain.co/path/to/strapi/admin/, the base index.html page loads by the resources, including /admin/main.js do not load since they refer to the path https://my.domain.co/admin/main.js, which omits the path/to/ part of it.

I have been trying a hacky way to rewrite the url of the resources from the nginx configuration as follows:

sub_filter_types *;
sub_filter '/admin/'  '';
sub_filter_once off;

This enables the page https://my.domain.co/path/to/strapi/admin/ to load the main.js resource but there are many other files referenced in the main.js whose uri does not get re-written, mainly because of the Javascript concatenations that are used in the script.

As such, I was wondering if there is a better way to enable Strapi behind a nginx reverse proxy.

Thank you in advance.

Error during docker run

Hey,

I'm getting the following error after running default commands in README:
Something else already exists at '/usr/src/api/strapi-app/node_modules'.

Environment:
Amazon EC2 Amazon Linux AMI 2018.03
Docker version 18.03.1-ce, build 3dfb8343b139d6342acfd9975d7f1068b5b1c3d3

Steps:

  1. Run:
docker run -e MONGO_INITDB_DATABASE=strapi \
           -v `pwd`/db/:/data/db \
           --name strapi-mongo \
           -d mongo
  1. Run:
docker run -e APP_NAME=strapi-app \
           -e DATABASE_CLIENT=mongo \
           -e DATABASE_HOST=strapi-mongo \
           -e DATABASE_PORT=27017 \
           -e DATABASE_NAME=strapi \
           -v `pwd`/strapi-app:/usr/src/api/strapi-app \
           -v /usr/src/api/strapi-app/node_modules \
           --link strapi-mongo:mongo \
           -p 1337:1337 \
           --name strapi -d strapi/strapi
  1. docker ps -a shows that strapi container has exited
  2. docker logs strapi output:
๐Ÿš€ Start creating your Strapi application. It might take a minute, please take a coffee โ˜•๏ธ

Lets configurate the connection to your database:
Database determined by CLI args: mongo

โณ Testing database connection...
Something else already exists at '/usr/src/api/strapi-app/node_modules'.

These things don't help:

  1. Removing the container docker rm strapi
  2. Removing the container and the image docker rm strapi & docker rmi strapi
  3. Running docker system prune -a

Quickstart is not working on my mac

api_1 | [2018-06-14T21:18:40.844Z] info Creating your application... It might take a few seconds.
api_1 | [2018-06-14T21:18:40.928Z] error $ strapi new can only be called in an empty directory.
api_1 | [2018-06-14T21:18:41.177Z] error This command can only be used inside a Strapi project.
strapi-docker_api_1 exited with code 0

Third party database hosting - mongodb

Hi Guys,

I'm looking to use mlab or mongo atlas to host the database. Our current strapi app is running locally, we are trying to dockerise it but cannot get it to connect to hosted database. Any ideas?

Cheers, Rodrigo

Add new content type fails with blank screen

Did naive install just to eval today. Got issues reported here: strapi/strapi#1966

Fixed by changing node version and strapi version in Dockerfile

FROM node:11.1.0-alpine

LABEL maintainer="Luca Perret <[email protected]>" \
      org.label-schema.vendor="Strapi" \
      org.label-schema.name="Strapi Docker image" \
      org.label-schema.description="Strapi containerized" \
      org.label-schema.url="https://strapi.io" \
      org.label-schema.vcs-url="https://github.com/strapi/strapi-docker" \
      org.label-schema.version=latest \
      org.label-schema.schema-version="1.0"

WORKDIR /usr/src/api

RUN echo "unsafe-perm = true" >> ~/.npmrc

RUN npm install -g [email protected]

COPY strapi.sh ./
RUN chmod +x ./strapi.sh

EXPOSE 1337

COPY healthcheck.js ./
HEALTHCHECK --interval=15s --timeout=5s --start-period=30s \
      CMD node /usr/src/api/healthcheck.js

CMD ["./strapi.sh"]

Changed docker-compose.yml

version: '3'

services:
  api:
    build: .
    #image: strapi/strapi
...

[Suggestion] Add healthcheck

Docker supports a healthcheck command, which can indicate whether or not the container is doing fine or is having problems.
Once strapi 3.0.0 stable has been released, a healthcheck for the Docker image should be available. This can help DevOp-teams find dead or problematic strapi instances and restart them.

Right now a simple check for any response from the API / WebServer should be enough. In the long run a proper healthcheck API or call to a monitoring API in strapi should be used.

The support for a healthcheck in strapi has been suggested in strapi/strapi#755.

Node version is old

Node version on docker instance is 9.11.1 but Strapi recommends 10.x.x . If you try to put in a ticket on the strapi github one of the requirements is that you're using the latest version of node.

Unable to delete the record in strapi admin for a model - gives error message

Unable to delete the record in strapi admin for a model - gives error message

| [2018-05-23T01:51:27.387Z] info Your server is running at http://localhost:1337
api_1 | [2018-05-23T01:51:27.387Z] debug Time: Wed May 23 2018 01:51:27 GMT+0000 (UTC)
api_1 | [2018-05-23T01:51:27.387Z] debug Launched in: 2218 ms
api_1 | [2018-05-23T01:51:27.387Z] debug Environment: development
api_1 | [2018-05-23T01:51:27.387Z] debug Process PID: 15
api_1 | [2018-05-23T01:51:27.387Z] debug Version: 3.0.0-alpha.12 (node v9.11.1)
api_1 | [2018-05-23T01:51:27.387Z] info To shut down your server, press + C at any time
api_1 | [2018-05-23T01:51:33.272Z] debug GET /content-manager/explorer/events/count?source=content-manager (35 ms)
api_1 | [2018-05-23T01:51:33.281Z] debug GET /content-manager/explorer/events?limit=10&skip=0&sort=_id&source=content-manager (24 ms)
api_1 | [2018-05-23T01:51:38.240Z] error this.updateRelations is not a function
api_1 | [2018-05-23T01:51:38.240Z] debug DELETE /content-manager/explorer/events/5b047065098ddd77ae3c4307?source=content-manager (22 ms)

Unable to find database postgres

Hello, please help me on this. The strapi was able to connect to postgres but unable to find the database name.
Environment :

  • Postgres : dockerized port 5432

lodash issue on docker-compose up

I'm having issues with the official docker wrapper for strapi.io --> whenever I run docker-compose up, I am getting errors for lodash to not have been found. When running the docker container for the very first time (clean install), everything is running smoothly, second attempt will return the error below.

api_1  | internal/modules/cjs/loader.js:550
api_1  |     throw err;
api_1  |     ^
api_1  | 
api_1  | Error: Cannot find module 'lodash'
api_1  |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
api_1  |     at Function.Module._load (internal/modules/cjs/loader.js:475:25)
api_1  |     at Module.require (internal/modules/cjs/loader.js:598:17)
api_1  |     at require (internal/modules/cjs/helpers.js:11:18)
api_1  |     at Object.<anonymous> (/usr/src/api/strapi-app/admin/controllers/Admin.js:5:11)
api_1  |     at Module._compile (internal/modules/cjs/loader.js:654:30)
api_1  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
api_1  |     at Module.load (internal/modules/cjs/loader.js:566:32)
api_1  |     at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
api_1  |     at Function.Module._load (internal/modules/cjs/loader.js:498:3)

Container id instead of host in file upload URL

Node.js version:
https://github.com/strapi/strapi-docker
(v9.8.0)

npm version:
https://github.com/strapi/strapi-docker
(5.6.0)

Strapi version:
https://github.com/strapi/strapi-docker
(3.0.0-alpha.11)

Operating system:
Docker

Do you want to request a feature or report a bug?
bug

What is the current behavior?
After photo gets uploaded URL is copied to clipboard:
http://cb63deeba9d8:1337/uploads/3a92cc8f08394d35bfa5bccd867c9f6c.JPG

If the current behavior is a bug, please provide the steps to reproduce the problem
1: Upload file
2: Click on entry

What is the expected behavior?
url should start with "localhost" or domain name


"cb63deeba9d8" is id of a container.

I assume ENV with host should be provided

node version?

image

strapi's node version requirement is >= 10.x. why are we using FROM node:9.11.1-alpine ?

User role selection results in blank page

Informations

  • Node.js version:
  • npm version:
  • Strapi version: v3.0.0-alpha.14.3 using docker-compose
  • Database:
  • Operating system: Ubuntu

What is the current behavior?
Clicking on role selection takes user to blank page.

Steps to reproduce the problem
Install Strapi using docker-compose. Register new user as admin and sign-in. Click on 'add new user' and click on role selection. Opens blank page.

What is the expected behavior?
User should be allowed to selected one of the available roles.

Suggested solutions

install on windows fails due to mongoerror

MongoError: not authorized on strapi to execute command { listIndexes: "users-permissions_role", cursor: {}, lsid: { id: UUID("ba7326b6-5f66-445e-99fd-96a0b95d9a00") }, $db: "strapi" }

not working after set mongo root username/password

docker-compose.yml:

version: '3'

services:
  api:
    image: strapi/strapi
    environment:
      - APP_NAME=strapi-app
      - DATABASE_CLIENT=mongo
      - DATABASE_HOST=db
      - DATABASE_PORT=27017
      - DATABASE_NAME=strapi
      - DATABASE_USERNAME=dbusername
      - DATABASE_PASSWORD=dbpassword
      - HOST=localhost
    ports:
      - 1337:1337
    volumes:
      - ./strapi-app:/usr/src/api/strapi-app
      #- /usr/src/api/strapi-app/node_modules
    depends_on:
      - db
    restart: always

  db:
    image: mongo
    environment:
      - MONGO_INITDB_DATABASE=strapi
      - ME_CONFIG_MONGODB_ADMINUSERNAME=dbusername
      - ME_CONFIG_MONGODB_ADMINPASSWORD=dbpassword
    ports:
      - 27017:27017
    volumes:
      - ./db:/data/db
    restart: always

error message:

db_1   | 2018-06-15T04:43:27.831+0000 I ACCESS   [conn121] SCRAM-SHA-1 authentication failed for dbusername on strapi from client 172.21.0.3:42320 ; UserNotFound: Could not find user dbusername@strapi
db_1   | 2018-06-15T04:43:27.832+0000 I NETWORK  [conn121] end connection 172.21.0.3:42320 (0 connections now open)
api_1  | [2018-06-15T04:43:27.832Z] warn Database connection has failed! Make sure your database is running.

Sync Docker Hub documentation with Github README

I am not sure whether or not the documentation on Docker Hub is somehow linked to the README.md here in github, but currently is has gotten out of sync.
Right now the differences are not critical or even that important but should probably be updated to the same version from time to time (unless there is an automatic way to achieve that).

Build issue with existing projects

Running the docker image on an existing project failed building.
I think this happens because the container is running as root and then the npm command needs the --unsafe-perm param to run a script.

Even after doing this manually the container run without problems but every path will open the "welcome page". When I try the same without docker is working without a problem.

api_1 | npm WARN deprecated [email protected]: The sprintf package is deprecated in favor of sprintf-js.
api_1 | npm WARN lifecycle [email protected]~postinstall: cannot run in wd %s %s (wd=%s) [email protected] node node_modules/strapi/lib/utils/post-install.js /usr/src/api/my-app
api_1 | npm notice created a lockfile as package-lock.json. You should commit this file.
api_1 | npm WARN [email protected] requires a peer of mongoose@~> 4.x but none is installed. You must install peer dependencies yourself.
api_1 | npm WARN [email protected] requires a peer of eslint-plugin-jsx-a11y@^2.2.3 but none is installed. You must install peer dependencies yourself.
api_1 |
api_1 | added 509 packages in 21.235s
api_1 | internal/modules/cjs/loader.js:550
api_1 | throw err;
api_1 | ^
api_1 |
api_1 | Error: Cannot find module 'immutable'
api_1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
api_1 | at Function.Module._load (internal/modules/cjs/loader.js:475:25)
api_1 | at Module.require (internal/modules/cjs/loader.js:598:17)
api_1 | at require (internal/modules/cjs/helpers.js:11:18)
api_1 | at Object. (/usr/src/api/my-app/plugins/content-type-builder/services/ContentTypeBuilder.js:7:20)
api_1 | at Module._compile (internal/modules/cjs/loader.js:654:30)
api_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
api_1 | at Module.load (internal/modules/cjs/loader.js:566:32)
api_1 | at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
api_1 | at Function.Module._load (internal/modules/cjs/loader.js:498:3)

Lato font not loading

Informations

  • Node.js version: v9.11.1 (from the docker instance strapi/strapi)
  • npm version: 5.6.0 (as installed by docker instance)
  • Strapi version: 3.0.0-alpha.14.3

Lato font not loaded when running strapi from docker instance. Many pages have a sans serif font.

Content type builder: New ends up with an error

When clicking on the button to craete a new type, URL becomes http://localhost:1337/admin/plugins/content-type-builder/#create::contentType::baseSettings and we get an error into the console:

Error: Minified React error #188; visit https://reactjs.org/docs/error-decoder.html?invariant=188 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
    at r (main.js:11)
    at o (main.js:11)
    at Ie (main.js:11)
    at Fe (main.js:11)
    at Object.findDOMNode (main.js:19)
    at t.updateStatus (main.js:32)
    at t.componentDidMount (main.js:32)
    at tn (main.js:16)
    at en (main.js:16)
    at Qo (main.js:16)
    at sn (main.js:16)
    at Be (main.js:16)
So @ main.js:16
Ro.o.callback @ main.js:16
Kt @ main.js:16
Gt @ main.js:16
tn @ main.js:16
en @ main.js:16
Qo @ main.js:16
sn @ main.js:16
Be @ main.js:16
main.

How to change strapi-app to NODE_ENV=production?

How to change strapi-app to NODE_ENV=production?
NODE_ENV=production docker-compose up -d
It seems not working.
Check /admin/currentEnvironment, it still shows
{
currentEnvironment: "development"
}

Unable To Debug

I would like to develop within the docker container while being able to setbreak points and inspect in vscode.

I typically accomplish this by passing the --inspect flag for the startup process.

"start": "node --inspect=0.0.0.0:9222 server.js",

Unfortunately, I'm having a hard time understanding how to apply this concept to this project....

Can someone explain how I can debug strapi in vscode while running in a docker container?

missing mongoose

I been trying to get the latest docker image to work.. it's failing with the following error (stack trace)

npm install strapi-hook-strapi-mongoose

strapi_1 | [2018-08-10T11:00:37.463Z] warn (hook:strapi-mongoose) strapi-hook-strapi-mongoose is missing in your dependencies. Please run npm install strapi-hook-strapi-mongoose
strapi_1 | error TypeError: strapi.models.core_store.forge is not a function
strapi_1 | at Object.get (/usr/local/lib/node_modules/strapi/lib/core/store.js:55:47)
strapi_1 | at module.exports (/usr/src/api/strapi-app/plugins/content-manager/config/functions/bootstrap.js:156:42)
strapi_1 | at Promise (/usr/local/lib/node_modules/strapi/lib/Strapi.js:285:13)
strapi_1 | at new Promise ()
strapi_1 | at execBootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:273:11)
strapi_1 | at Promise.all.Object.values.map.x (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:44)
strapi_1 | at Array.map ()
strapi_1 | at Strapi.bootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:35)
strapi_1 | at Strapi.start (/usr/local/lib/node_modules/strapi/lib/Strapi.js:107:18)
strapi_1 | at
strapi_1 | (node:18) UnhandledPromiseRejectionWarning: TypeError: strapi.models.core_store.forge is not a function
strapi_1 | at Object.get (/usr/local/lib/node_modules/strapi/lib/core/store.js:55:47)
strapi_1 | at module.exports (/usr/src/api/strapi-app/plugins/settings-manager/config/functions/bootstrap.js:17:26)
strapi_1 | at Promise (/usr/local/lib/node_modules/strapi/lib/Strapi.js:285:13)
strapi_1 | at new Promise ()
strapi_1 | at execBootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:273:11)
strapi_1 | at Promise.all.Object.values.map.x (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:44)
strapi_1 | at Array.map ()
strapi_1 | at Strapi.bootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:35)
strapi_1 | at Strapi.start (/usr/local/lib/node_modules/strapi/lib/Strapi.js:107:18)
strapi_1 | at
strapi_1 | (node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise wh
ich was not handled with .catch(). (rejection id: 7)
strapi_1 | (node:18) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero ex
it code.
strapi_1 | (node:18) UnhandledPromiseRejectionWarning: TypeError: strapi.models.core_store.forge is not a function
strapi_1 | at Object.get (/usr/local/lib/node_modules/strapi/lib/core/store.js:55:47)
strapi_1 | at module.exports (/usr/src/api/strapi-app/plugins/users-permissions/config/functions/bootstrap.js:77:45)
strapi_1 | at Promise (/usr/local/lib/node_modules/strapi/lib/Strapi.js:285:13)
strapi_1 | at new Promise ()
strapi_1 | at execBootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:273:11)
strapi_1 | at Promise.all.Object.values.map.x (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:44)
strapi_1 | at Array.map ()
strapi_1 | at Strapi.bootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:35)
strapi_1 | at Strapi.start (/usr/local/lib/node_modules/strapi/lib/Strapi.js:107:18)
strapi_1 | at
strapi_1 | (node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise wh
ich was not handled with .catch(). (rejection id: 8)
strapi_1 | (node:18) UnhandledPromiseRejectionWarning: ReferenceError: config is not defined
strapi_1 | at fs.readdir (/usr/src/api/strapi-app/plugins/email/config/functions/bootstrap.js:53:40)
strapi_1 | at
strapi_1 | (node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise wh
ich was not handled with .catch(). (rejection id: 11)
strapi_1 | (node:18) UnhandledPromiseRejectionWarning: ReferenceError: config is not defined
strapi_1 | at fs.readdir (/usr/src/api/strapi-app/plugins/upload/config/functions/bootstrap.js:55:40)
strapi_1 | at
strapi_1 | at process._tickCallback (internal/process/next_tick.js:182:7)
strapi_1 | (node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise wh
ich was not handled with .catch(). (rejection id: 14)

Installation Issue

I've tried latest back through to older docker tags and I can't get this running. Run as image pull and direct on the Dockerfile also.

Primary issue continually seems to be:

api_1    | error TypeError: strapi.models.core_store.forge is not a function
api_1    |     at Object.get (/usr/local/lib/node_modules/strapi/lib/core/store.js:55:47)
api_1    |     at module.exports (/usr/src/api/strapi-app/plugins/content-manager/config/functions/bootstrap.js:229:42)
api_1    |     at Promise (/usr/local/lib/node_modules/strapi/lib/Strapi.js:285:13)
api_1    |     at new Promise (<anonymous>)
api_1    |     at execBootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:273:11)
api_1    |     at Promise.all.Object.values.map.x (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:44)
api_1    |     at Array.map (<anonymous>)
api_1    |     at Strapi.bootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:35)
api_1    |     at Strapi.start (/usr/local/lib/node_modules/strapi/lib/Strapi.js:107:18)
api_1    |     at <anonymous>
api_1    | (node:15) UnhandledPromiseRejectionWarning: TypeError: strapi.models.core_store.forge is not a function
api_1    |     at Object.get (/usr/local/lib/node_modules/strapi/lib/core/store.js:55:47)
api_1    |     at module.exports (/usr/src/api/strapi-app/plugins/settings-manager/config/functions/bootstrap.js:17:26)
api_1    |     at Promise (/usr/local/lib/node_modules/strapi/lib/Strapi.js:285:13)
api_1    |     at new Promise (<anonymous>)
api_1    |     at execBootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:273:11)
api_1    |     at Promise.all.Object.values.map.x (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:44)
api_1    |     at Array.map (<anonymous>)
api_1    |     at Strapi.bootstrap (/usr/local/lib/node_modules/strapi/lib/Strapi.js:312:35)
api_1    |     at Strapi.start (/usr/local/lib/node_modules/strapi/lib/Strapi.js:107:18)
api_1    |     at <anonymous>
api_1    | (node:15) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
api_1    | (node:15) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
api_1    | [2018-08-28T10:16:02.269Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
api_1    | [2018-08-28T10:16:02.271Z] warn Perhaps you forgot to call it?

Node @ v9 on the Strapi API
/usr/src/api/strapi-app # node -v v9.11.1

"dependencies": {
    "lodash": "4.x.x",
    "strapi": "3.0.0-alpha.13.1",
    "strapi-hook-mongoose": "3.0.0-alpha.13.1"
  },

The image installation via Dockerfile is OK.

root@strapi:~/strapi-docker# docker-compose up
Building api
Step 1/10 : FROM node:9.11.1-alpine
9.11.1-alpine: Pulling from library/node
605ce1bd3f31: Already exists
7cc38010b685: Already exists
88a635599bc5: Already exists
Digest: sha256:f8f6c69cce180a9a7c9fa685c86671b1e1f2ea7cc5f9a0dbe99d30cc7a0b6cbe
Status: Downloaded newer image for node:9.11.1-alpine
 ---> 9cc7800b3f3c
Step 2/10 : LABEL maintainer="Luca Perret <[email protected]>"       org.label-schema.vendor="Strapi"       org.label-schema.name="Strapi Docker image"       org.label-schema.description="Strapi containerized"       org.label-schema.url="https://strapi.io"       org.label-schema.vcs-url="https://github.com/strapi/strapi-docker"       org.label-schema.version=latest       org.label-schema.schema-version="1.0"
 ---> Running in 06747ceeb7e9
Removing intermediate container 06747ceeb7e9
 ---> ba15448a1d0e
Step 3/10 : WORKDIR /usr/src/api
Removing intermediate container d60f419808c2
 ---> 8a03bb768927
Step 4/10 : RUN npm install -g [email protected]
 ---> Running in 455e0c7dca8c
npm WARN deprecated [email protected]: The sprintf package is deprecated in favor of sprintf-js.
npm WARN notice [SECURITY] deep-extend has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=deep-extend&version=0.2.11 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] lodash has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=lodash&version=3.10.1 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] debug has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=debug&version=2.6.1 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] lodash has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=lodash&version=4.17.4 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
/usr/local/bin/strapi -> /usr/local/lib/node_modules/strapi/bin/strapi.js
+ [email protected]
added 391 packages in 21.617s
Removing intermediate container 455e0c7dca8c
 ---> 37bafa272a09
Step 5/10 : COPY strapi.sh ./
 ---> e10df39a92d4
Step 6/10 : RUN chmod +x ./strapi.sh
 ---> Running in 10889a82b0ac
Removing intermediate container 10889a82b0ac
 ---> 20e89447b146
Step 7/10 : EXPOSE 1337
 ---> Running in 65ef7067ed7a
Removing intermediate container 65ef7067ed7a
 ---> 8a5167500fdc
Step 8/10 : COPY healthcheck.js ./
 ---> 8d3dbb4f7d28
Step 9/10 : HEALTHCHECK --interval=15s --timeout=5s --start-period=30s       CMD node /usr/src/api/healthcheck.js
 ---> Running in 0162f62e4435
Removing intermediate container 0162f62e4435
 ---> 265493a76158
Step 10/10 : CMD ["./strapi.sh"]
 ---> Running in 51fafe469c68
Removing intermediate container 51fafe469c68
 ---> 09be8dd339ff
Successfully built 09be8dd339ff
Successfully tagged strapidocker_api:latest

Error installing

Hello,

I am getting the following error when I am trying to run the image after having it pulled.

๐Ÿš€ Start creating your Strapi application. It might take a minute, please take a coffee โ˜•๏ธ

Lets configurate the connection to your database:
Database determined by CLI args: mongo

โณ Testing database connection...
{ Error: Command failed: yarn install --production --ignore-scripts
error An unexpected error occurred: "https://registry.yarnpkg.com/react-ga: getaddrinfo EAI_AGAIN registry.yarnpkg.com:443".

    at ChildProcess.exithandler (child_process.js:273:12)
    at ChildProcess.emit (events.js:180:13)
    at ChildProcess.emit (domain.js:422:20)
    at maybeClose (internal/child_process.js:936:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn install --production --ignore-scripts' }

Any ideas what that could be?

Thanks for the help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.