Cách cài đặt OpenProject trên Ubuntu 22.04

theanh

Administrator
Nhân viên
OpenProject là một hệ thống quản lý dự án mã nguồn mở và dựa trên web. Nó cung cấp một cách an toàn và bảo mật để các nhóm kết nối, cấu trúc công việc của họ và đạt được kết quả. Với OpenProject, bạn có thể sắp xếp các nhiệm vụ của riêng mình và giao nhiệm vụ cho đồng đội tại một nơi. Phiên bản Cộng đồng của nó bao gồm nhiều tính năng và plugin khác nhau và miễn phí. Nó cung cấp nhiều tính năng khác nhau, chẳng hạn như lập kế hoạch và lên lịch dự án, Wiki, Diễn đàn, Agile và Scrum, Theo dõi lỗi, v.v.

Bài đăng này sẽ giải thích cách cài đặt OpenProject với Docker trên Ubuntu 22.04.

Điều kiện tiên quyết​

  • Một máy chủ chạy Ubuntu 22.04.
  • Mật khẩu gốc được cấu hình trên máy chủ.

Bắt đầu​

Trước tiên, bạn sẽ cần cập nhật và nâng cấp các gói hệ thống của mình lên phiên bản mới nhất. Bạn có thể thực hiện bằng lệnh sau:
Mã:
apt update -y
apt upgrade -y
Sau khi tất cả các gói được cập nhật, bạn có thể tiến hành bước tiếp theo.

Cài đặt Docker​

Tiếp theo, bạn sẽ cần cài đặt công cụ Docker trên máy chủ của mình. Bạn có thể cài đặt bằng cách chạy lệnh sau:
Mã:
apt install docker.io -y
Sau khi Docker được cài đặt, bạn có thể xác minh phiên bản Docker bằng lệnh sau:
Mã:
docker --version
Bạn sẽ nhận được phiên bản Docker trong lệnh sau đầu ra:
Mã:
Docker version 20.10.12, build 20.10.12-0ubuntu4
Bạn cũng có thể kiểm tra trạng thái Docker bằng lệnh sau:
Mã:
systemctl status docker
Bạn sẽ nhận được thông tin sau đầu ra:
Mã:
? docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-09-12 03:55:27 UTC; 27min ago
TriggeredBy: ? docker.socket Docs: https://docs.docker.com Main PID: 2188 (dockerd) Tasks: 18 Memory: 175.3M CPU: 2min 52.389s CGroup: /system.slice/docker.service ??2188 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Sep 12 04:05:02 ubuntu2204 dockerd[2188]: time="2022-09-12T04:05:02.260137217Z" level=info msg="Container failed to exit within 10s of signal>
Sep 12 04:05:02 ubuntu2204 dockerd[2188]: time="2022-09-12T04:05:02.288143240Z" level=info msg="ignoring event" container=c69a4c77c21fcc30bf5>
Sep 12 04:05:02 ubuntu2204 dockerd[2188]: time="2022-09-12T04:05:02.313368392Z" level=info msg="ignoring event" container=1e168552ee6decb4d38>
Sep 12 04:05:02 ubuntu2204 dockerd[2188]: time="2022-09-12T04:05:02.346672185Z" level=info msg="ignoring event" container=4f042da15c0abe50ac0>
Sep 12 04:05:03 ubuntu2204 dockerd[2188]: time="2022-09-12T04:05:03.128611054Z" level=info msg="ignoring event" container=d07c7ddcf4c5c8e1df3>
Sep 12 04:05:03 ubuntu2204 dockerd[2188]: time="2022-09-12T04:05:03.471773239Z" level=info msg="ignoring event" container=f0095298f0394b4e97c>
Sep 12 04:05:03 ubuntu2204 dockerd[2188]: time="2022-09-12T04:05:03.860303969Z" level=info msg="ignoring event" container=7c591187d6dea45ad9c>
Sep 12 04:10:05 ubuntu2204 dockerd[2188]: time="2022-09-12T04:10:05.733958315Z" level=info msg="ignoring event" container=a9126dced469461963a>
Sep 12 04:17:00 ubuntu2204 dockerd[2188]: time="2022-09-12T04:17:00.365019409Z" level=info msg="ignoring event" container=317a71b1e5e2810e618>
Sep 12 04:19:40 ubuntu2204 dockerd[2188]: time="2022-09-12T04:19:40.133136639Z" level=info msg="ignoring event" container=e5fa71f4c2a7d8f3dc4>

Tải xuống và khởi chạy OpenProject Container​

Cách đơn giản và dễ nhất để cài đặt OpenProject là khởi chạy nó bằng một container Docker. Bạn có thể tải xuống và chạy nó bằng cách chạy lệnh sau:
Mã:
docker run -dit -p 8080:80 -e OPENPROJECT_SECRET_KEY_BASE=secret -e OPENPROJECT_HOST__NAME=127.0.0.1:8080 -e OPENPROJECT_HTTPS=false openproject/community:12
Lệnh này sẽ tải xuống hình ảnh Docker cộng đồng OpenProject và khởi động nó như hiển thị bên dưới:
Mã:
Unable to find image 'openproject/community:12' locally
12: Pulling from openproject/community
76dff75df4d9: Pull complete
3e8c90a1c4bb: Pull complete
b3662c105080: Pull complete
ad5dcb7dd592: Pull complete
fa57cc7ce341: Pull complete
9b3a1f58f992: Pull complete
3ba44da7772d: Pull complete
bb99cfe1d593: Pull complete
d9be85920c31: Pull complete
887163836f1b: Pull complete
8d9b5634408e: Pull complete
40cd37c7c054: Pull complete
8f3f7ae1eab6: Pull complete
0bad647edadc: Pull complete
7604d9da2c69: Pull complete
5064bcba96f5: Pull complete
a31fefd0310b: Pull complete
57856090623a: Pull complete
c5788f49d4cb: Pull complete
Digest: sha256:5b3850c813b44e0e83b31ee3ee7e65a22a05009f5101132caee51b4c799adaa9
Status: Downloaded newer image for openproject/community:12
cecc63dbe7c8263cdf9813a5dee5d5cfda3e2f8b8cdb78b3d038679507fa7769
Bạn có thể xác minh hình ảnh Docker đã tải xuống bằng lệnh sau:
Mã:
docker images
Bạn sẽ nhận được thông tin sau đầu ra:
Mã:
REPOSITORY TAG IMAGE ID CREATED SIZE
openproject/community 12 88f613862e98 11 days ago 1.93GB
Để kiểm tra trạng thái vùng chứa OpenProject, hãy chạy lệnh sau:
Mã:
docker ps
Bạn sẽ thấy vùng chứa OpenProject được khởi động và lắng nghe trên cổng 8080:
Mã:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cecc63dbe7c8 openproject/community:12 "./docker/prod/entry…" 12 seconds ago Up 11 seconds 5432/tcp, 0.0.0.0:8080->80/tcp, :::8080->80/tcp silly_fermi
Bạn cũng có thể xác minh nhật ký vùng chứa OpenProject bằng lệnh sau:
Mã:
docker logs cecc63dbe7c8
Bạn sẽ nhận được thông tin sau đầu ra:
Mã:
=> Booting Puma
=> Rails 7.0.3.1 application starting in production
=> Run `bin/rails server --help` for more startup options
I, [2022-09-12T04:25:12.466164 #138] INFO -- : Using schema cache file /app/db/schema_cache.yml
[138] Puma starting in cluster mode...
[138] * Puma version: 5.6.4 (ruby 3.1.2-p20) ("Birdie's Version")
[138] * Min threads: 4
[138] * Max threads: 16
[138] * Environment: production
[138] * Master PID: 138
[138] * Workers: 2
[138] * Restarts: (?) hot (?) phased
[138] * Preloading application
[138] * Listening on http://0.0.0.0:8080
[138] Use Ctrl-C to stop
[138] - Worker 1 (PID: 337) booted in 0.01s, phase: 0
[138] - Worker 0 (PID: 336) booted in 0.02s, phase: 0

Cấu hình Apache làm Proxy ngược cho OpenProject​

Như bạn thấy, OpenProject lắng nghe trên cổng 8080. Vì vậy, bạn nên cấu hình Apache làm proxy ngược để truy cập OpenProject qua cổng 80.

Đầu tiên, hãy cài đặt gói máy chủ web Apache bằng cách sử dụng lệnh sau lệnh:
Mã:
apt install apache2 -y
Sau khi Apache được cài đặt, hãy kích hoạt các mô-đun cần thiết bằng lệnh sau:
Mã:
a2enmod proxy_http headers rewrite
Tiếp theo, tạo tệp cấu hình máy chủ ảo Apache với nội dung sau lệnh:
Mã:
nano /etc/apache2/sites-available/openproject.conf
Thêm các cấu hình sau:
Mã:
ServerName openproject.linuxbuz.com
RewriteEngine on
RewriteRule "^$" "/" [R,L]
ProxyRequests off

ProxyPreserveHost On
ProxyPass http://127.0.0.1:8080/
ProxyPassReverse http://127.0.0.1:8080/
Lưu và đóng tệp, sau đó kích hoạt máy chủ ảo OpenProject bằng lệnh sau lệnh:
Mã:
a2ensite openproject.conf
Cuối cùng, khởi động lại dịch vụ Apache để áp dụng các thay đổi:
Mã:
systemctl reload apache2
Bạn cũng có thể kiểm tra trạng thái Apache bằng lệnh sau lệnh:
Mã:
systemctl status apache2
Bạn sẽ nhận được kết quả đầu ra sau:
Mã:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-09-12 04:26:23 UTC; 1min 30s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 14508 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS) Main PID: 14058 (apache2) Tasks: 55 (limit: 4579) Memory: 5.4M CPU: 98ms CGroup: /system.slice/apache2.service ??14058 /usr/sbin/apache2 -k start ??14512 /usr/sbin/apache2 -k start ??14513 /usr/sbin/apache2 -k start
Sep 12 04:26:23 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Bảo mật OpenProject bằng Let's Encrypt SSL​

Bạn cũng nên bật SSL trên trang web OpenProject. Trước tiên, hãy cài đặt gói máy khách Certbot bằng lệnh sau:
Mã:
apt install python3-certbot-apache -y
Tiếp theo, hãy chạy lệnh sau để tải xuống và cài đặt Let's Encrypt SSL cho tên miền trang web của bạn.
Mã:
certbot --apache -d openproject.linuxbuz.com
Trả lời tất cả các câu hỏi như được hiển thị bên dưới để cài đặt Let's Encrypt SSL:
Mã:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [emailprotected]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017-w-v1.3-notice.pdf.
You must agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: (Y)es/(N)o: Y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Account registered.
Requesting a certificate for openproject.linuxbuz.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/openproject.linuxbuz.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/openproject.linuxbuz.com/privkey.pem
This certificate expires on 2022-12-11.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for openproject.linuxbuz.com to /etc/apache2/sites-available/openproject-le-ssl.conf
Added an HTTP->HTTPS rewrite in addition to other RewriteRules; you may wish to check for overall consistency.
Congratulations! You have successfully enabled HTTPS on https://openproject.linuxbuz.com
We were unable to subscribe you the EFF mailing list because your e-mail address appears to be invalid. You can try again later by visiting https://act.eff.org.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by: * Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate * Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Truy cập Giao diện người dùng web OpenProject​

Bây giờ, hãy mở trình duyệt web của bạn và truy cập OpenProject bằng URL Bạn sẽ thấy màn hình chào mừng OpenProject trang:


data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22750%22%20height=%22379%22%3E%3C/svg%3E


Nhấp vào nút Đăng nhập. Bạn sẽ thấy trang đăng nhập OpenProject:


data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22750%22%20height=%22214%22%3E%3C/svg%3E


Cung cấp tên người dùng và mật khẩu mặc định là admin / admin, sau đó nhấp vào nút Đăng nhập. Bạn sẽ thấy màn hình thay đổi mật khẩu:


data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22750%22%20height=%22313%22%3E%3C/svg%3E


Thay đổi mật khẩu mặc định của bạn và nhấp vào nút Lưu. Bạn sẽ thấy bảng điều khiển OpenProject trên màn hình sau:


data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22750%22%20height=%22380%22%3E%3C/svg%3E

Kết luận​

Xin chúc mừng! Bạn đã cài đặt thành công OpenProject với Docker trên Ubuntu 22.04. Bây giờ bạn có thể triển khai OpenProject trên tổ chức của mình và bắt đầu quản lý và theo dõi dự án từ vị trí trung tâm.
 
Back
Bên trên