apostrophecms / apostrophecms/apostrophe
Can't deploy apostroheCMS via Docker Compose
- Dominant language
- JavaScript
- Stars
- 4.6k
- Forks
- 650
- Avg merge
- 19h 21m
- Merged PRs (30d)
- 23
Description
Hello, so for some reason, i can't seem to deploy the docker container, i've cloed the full reposetory and manually added the build-assents.sh script in the scripts Folder.
Here the Dockerfile:
```
FROM node:lts-alpine3.15
WORKDIR /srv/www/apostrophe
RUN chown -R node: /srv/www/apostrophe
USER node
COPY --chown=node package*.json /srv/www/apostrophe/
RUN npm install
ENV NODE_ENV=production
RUN npm ci
COPY --chown=node . /srv/www/apostrophe/
RUN ./scripts/build-assets.sh
CMD ["node", "app.js"]
```
Here the `build-assents.sh` script:
```sh
#!/bin/sh
export APOS_RELEASE_ID=`cat /dev/urandom |env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
echo $APOS_RELEASE_ID > ./release-id
node app @apostrophecms/asset:build
```
I've never written an single line of Javascript myself but from the Error logs i'm seeing, it can't find module app and app.js.
I changed it to index.js which seem to have resolvd the error and it seemed at first glance, that everythign worked as intented now, but hold on, i tried Checking the logs and got Nothing, i then checked running docker containers and found out, that the Apostrophe container was Always in restarting state.
I then went ahead and wanted to check the MongoDB logs, seem like that the MongoDB container either never started or instantly stopped.
I have to admit that i made some slight ajustments to the compose file to fit my Needs:
```yml
mongodb-apostrophe:
image: mongo:4.4.14
#ports:
#- "27018:27018"
#volumes:
#- /data/db
volumes:
- mongodb_apostrophe_data:/data/db
networks:
- revproxy
apostrophe:
container_name: apostropheCMS
restart: always
#build: .
build:
context: /docker/apostrophe/setup
dockerfile: Dockerfile.compose
#ports:
#- "3000:3000"
networks:
- revproxy
#volumes:
#- ./data/uploads:/app/public/uploads
#- ./data/backups:/app/backups
volumes:
- apostrophe_uploads:/app/public/uploads
- apostrophe_backups:/app/backups
environment:
- APOS_MONGODB_URI=mongodb://mongodb-apostrophe:27017/db
depends_on:
- mongodb-apostrophe
volumes:
# mongodb volumes
mongodb_apostrophe_data:
driver: local
driver_opts:
type: none
o: bind
device: /docker/apostrophe/mongodb_data
# service volumes
apostrophe_uploads:
driver: local
driver_opts:
type: none
o: bind
device: /docker/apostrophe/uploads
apostrophe_backups:
driver: local
driver_opts:
type: none
o: bind
device: /docker/apostrophe/backups
networks:
revproxy:
external: true
```
I hope somebody here can help me with this issue:
Thanks in Advance,
Regards,
FuckingToasters
Contributor guide
Research direction
Start with the supplied Dockerfile, scripts/build-assets.sh, and Docker Compose service definitions. Reproduce the build and inspect the Apostrophe and MongoDB container logs, including the app.js/index.js entry point and configured volume paths. Done means the image builds and both containers remain running with the configured MongoDB connection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, javascript, node.js
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100