Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker compose INSTALL | can you please test my TUTORIAL? #12554

Open
punkyard opened this issue Mar 3, 2024 · 1 comment
Open

docker compose INSTALL | can you please test my TUTORIAL? #12554

punkyard opened this issue Mar 3, 2024 · 1 comment

Comments

@punkyard
Copy link

punkyard commented Mar 3, 2024

Describe the bug

in need of a Decidim documentation on how to install Decidim with docker compose

To Reproduce

  1. try
  2. fail

Expected behavior

  1. read documenation
  2. succeed

Screenshots

No response

Stacktrace

open a terminal and login to your server via ssh
(in this example we are installing decidim latest which is 0.28.0)

🗂️ CREATE A FOLDER AND IMPORT REPO
sudo mkdir /mnt/docker/decidim
cd /mnt/docker/decidim
sudo docker run -it -v "/mnt/docker/decidim/code:/code" ghcr.io/decidim/decidim-generator:0.28.0 decidim 0.28.0
sudo chown -R root: code

🐳 THE DOCKER-COMPOSE.YML FILE
(either in /mnt/docker/decidim/code/0.28.0/docker-compose.yml or in a new Portainer stack)

version: '3.7'
services:
  postgres:
    image: postgres:14-alpine
    volumes:
      - /mnt/d0cker/decidim/postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: postgres_username
      POSTGRES_PASSWORD: user_password
      POSTGRES_DB: decidim_db
    restart: unless-stopped
  redis:
    image: redis:6-alpine
    restart: unless-stopped
  decidim:
    image: decidim/decidim:0.28.0
    command: bash -c "bundle exec rake db:migrate && bundle exec puma -C config/puma.rb"
    volumes:
      - /mnt/docker/decidim/code/0.28.0:/app
      - bundle_data:/usr/local/bundle
      - node_modules:/app/node_modules
    ports:
      - "3000:3000"
    depends_on:
      - postgres
      - redis
    environment:
      DATABASE_URL: postgres://postgres_username:user_password@postgres/decidim_db
      REDIS_URL: redis://redis:6379/0
      SECRET_KEY_BASE: VeryLongAndComplexSecretKeyHere
      RAILS_ENV: production
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
volumes:
  bundle_data:
  node_modules

🚀 RUN IT!
cd /mnt/docker/decidim/code/0.28.0
docker-compose up -d

👤 ADD SUPER ADMIN
open console in 'decidim' container via ssh (docker exec -it container_name /bin/bash) or in Portainer
and enter these commands one after another

bundle exec rails console
user = Decidim::System::Admin.new(email: 'myemail@address.net', password: 'SuperAdminPass', password_confirmation: 'SuperAdminPass')
user.save!

then exit

🌐 URL
create a URL (domain.net) or sub-domain (sub.domain.net) and point it to your serveur IP
depending on your server set apache, nginx or traefik to point to the container's port, here: 3000

goto URL : sub.domain.net/system

LOGIN with SuperAdmin credentials
CREATE new organisation
OPEN Advanced Settings to access SMTP details (see if port 587 is better then 465)
SAVE

📧 CHECK if you received the confirmation email - change SMTP settings if necessary

♻️ UPDATE CODE
cd /mnt/docker/decidim/code/0.28.0/config/environments
sudo nano production.rb

add this line in the block Rails.application.configure do ... end :
config.hosts << "sub.domain.net"

⚙️ RESTART CONTAINER
sudo docker compose restart app

🌐 GOTO URL sub.domain.net/admin
give a new password for your admin account

🏆 INITIATE your project
🎬 CHECK video: (still looking for 'getting started with Decidim' video)

👃 SMELL YOUR FINGERS
they smell goood

GIVE THEM a V for Victory ✌️

Extra data

  • Decidim Version: 0.28.0
  • Decidim installation: docker-compose or portainer stack
  • Revolution: one command at a time - unless stopped

Additional context

this is a need for less-tech people, that would like to start a revolution in their community
I'd be very happy to receive your comments after you tried my recipe

✌️ love will prevail

@punkyard punkyard changed the title docker compose TUTORIAL | can you please test my tutorial? docker compose INSTALL | can you please test my TUTORIAL? Mar 3, 2024
@piotr-sikora-v
Copy link

@punkyard Big thanks for this! This help me a lot

Also I have some improvments to your docker-compose.yml...
I added sed to command, so there is no need to edit files or monting local, just use image from docker hub:

command: bash -c "
      sed -i \"s/^end$/  config.hosts << \\\"YOUR.FULL.DOMAIN.HERE.social\\\"\\nend/\"  config/environments/production.rb
       bundle exec rake db:migrate && bundle exec puma -C config/puma.rb
      "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants