Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://docs.openproject.org/installation-and-operations/installation/docker/#all-in-one-container

WD=/opt/openproject
#rm $WD/{openproject_sql,openproject_data} -R
mkdir -p $WD/{openproject_sql,openproject_data,setup}
cd $WD/setup
cat << 'EOF' >docker-compose.yaml
version: '3.2'

services:
  openproject:
    image: openproject/community:${OP_VER}
    container_name: openproject
    hostname: openproject
    volumes:
      - type: bind
        source: /opt/openproject/openproject_data/
        target: /var/openproject/assets
      - type: bind
        source: /opt/openproject/openproject_sql/
        target: /var/openproject/pgdata
    ports:
      - '6080:8080'

    environment:
      - 'TZ=${TZ}'
      - 'SECRET_KEY_BASE=${SECRET_KEY_BASE}'
      - 'EMAIL_DELIVERY_METHOD=${EMAIL_DELIVERY_METHOD}'
      - 'SMTP_ADDRESS=${SMTP_ADDRESS}'
      - 'SMTP_PORT=${SMTP_PORT}'
      - 'SMTP_DOMAIN=${SMTP_DOMAIN}'
      - 'SMTP_AUTHENTICATION=${SMTP_AUTHENTICATION}'
      - 'SMTP_ENABLE_STARTTLS_AUTO=${SMTP_ENABLE_STARTTLS_AUTO}'
      - 'SMTP_USER_NAME=${SMTP_USER_NAME}'
      - 'SMTP_PASSWORD=${SMTP_PASSWORD}'
      
EOF
chmod +x docker-compose.yaml
cd $WD/setup
cat << 'EOF'>.env
TZ=America/Whitehorse

OP_VER=10

EMAIL_DELIVERY_METHOD=smtp
SMTP_ADDRESS=smtp.gmail.com
SMTP_PORT=587
SMTP_DOMAIN=gmail.com
SMTP_AUTHENTICATION=login
SMTP_ENABLE_STARTTLS_AUTO=true
SMTP_USER_NAME="user"
SMTP_PASSWORD="pass"

EOF
printf 'SECRET_KEY_BASE=%16s\n' $(openssl rand -hex 16) >> .env
chmod +x .env

systemctl restart openproject ; watch systemctl status openproject


OpenProject - Unable to verify Cross-Site Request Forgery token Error

SSL Setup:
Note: Be sure to visit site via http and go to "/settings" and change to HTTPS BEFORE ENABLEING, see Cross-Site Forgery
Example: (Don't forget to copy your certs to {certs,private})
cat << 'EOF' >/opt/openproject/apache2/sites-enabled/openproject.conf 
<VirtualHost *:80>
  ServerName _default_

  RewriteEngine On
  RewriteRule ^/?(.*) https://%{SERVER_NAME}:443/$1 [R,L]
</VirtualHost>

<VirtualHost *:443>
  ServerName _default_
  DocumentRoot /app/public

  ProxyRequests off
  ProxyPreserveHost On

  SSLEngine on
  SSLCertificateFile /etc/apache2/ssl/certs/fullchain.pem
  SSLCertificateKeyFile /etc/apache2/ssl/private/privkey.pem

 <Location \>
   ProxyPass http://127.0.0.1:6000/
   ProxyPassReverse http://127.0.0.1:6000/
 </Location>

</VirtualHost>
 EOF



echo 'alias openprojectcli="docker exec -it openproject /bin/bash"' >> ~/.bashrc
source ~/.bashrc
WD=/opt/openproject/setup
cat << EOF >$WD/openproject.service.setup.sh
cat << EOL >/lib/systemd/system/openproject.service
[Unit]
Description=Docker_Description
Requires=docker.service network-online.target

[Service]

Restart=on-abnormal
ExecStart=/usr/bin/docker-compose --project-name openproject --project-directory $WD -f $WD/docker-compose.yaml up
ExecStop=/usr/bin/docker-compose --project-name openproject --project-directory $WD -f $WD/docker-compose.yaml stop

[Install]
WantedBy=multi-user.target
EOL
systemctl enable openproject
systemctl start openproject
EOF
chmod +x $WD/openproject.service.setup.sh
$WD/openproject.service.setup.sh

Database Setup: (Optional PostgreSQL in Docker & PGAdmin)

cat << 'EOF' >opdburl_get.sh
HOSTIP="$(ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
openproject config:get DATABASE_URL > /tmp/opdburl
sed -i -e "s/127.0.0.1/$HOSTIP/g" /tmp/opdburl
cat /tmp/opdburl
rm /tmp/opdburl
EOF
chmod +x opdburl_get.sh
./opdburl_get.sh
-e DATABASE_URL=postgres://openproject:openproject@192.168.1.1:5432/openproject \

Setup OP DB:

pgcli
su - postgres
psql
DROP DATABASE openproject;
CREATE DATABASE openproject;
CREATE USER openproject WITH ENCRYPTED PASSWORD 'openproject';
GRANT ALL PRIVILEGES ON DATABASE openproject TO openproject;




  • No labels