• Support
  • Guidance on installing MediaCMS

Hi,

I'm trying to install a single server instance of MediaCMS following these instructions: https://github.com/mediacms-io/mediacms/blob/main/docs/admins_docs.md#2-server-installation

When I get to the final step of running the install script, I get the message about my shell user not being in the sudoers file, since Opalstack doesn't provide root/sudo access as far as I can tell.

Is it possible to install MediaCMS on Opalstack or is this a dead end and I should be exploring other hosting options?

Thanks!

  • sean replied to this.

    hodge from what I can tell, MediaCMS is a Django app. You ought to be able to run it here, but not using the supplied installation script. I'll look into it and will post back here with an installation procedure as soon as possible.

      sean That's my understanding too. Thanks, and looking forward to hearing back!

      • sean replied to this.

        hodge Ok, buckle up - this is a long ride:

        1. Build a private PostgreSQL 12 instance from source, see: https://community.opalstack.com/d/1107-django-42-deprecates-postgresql-11-support/5

        2. Log in to your private instance to create your database user and database in the private instance.

        3. Run a redis instance, see: https://community.opalstack.com/d/975-redis-instance-for-django-app-wcelery/2

        4. Install a Django app via Opalstack dashboard and attach it to a site.

        5. SSH to your app's shell user and run the following commands. I'm using "me" as my shell user name and "myapp" as the app name here, adjust them accordingly:

          cd ~/apps/myapp
          source env/bin/activate
          git clone https://github.com/mediacms-io/mediacms
          cd mediacms
          pip install -r requirements.txt -U
        1. Edit mediacms/cms/settings.py to set the following parameters:

        2. Run the Django migrate and collectstatic commands, eg:

          cd ~/apps/myapp
          source env/bin/activate # skip this step if your env is already active
          cd mediacms
          python manage.py migrate
          python manage.py collectstatic
        1. Start your celery workers:

          celery -A cms multi start long1 --concurrency=3 --pidfile=/home/me/apps/myapp/celery_long.pid --logfile=/home/me/logs/apps/myapp/celery_long.log --loglevel=INFO -Ofair --prefetch-multiplier=1 -Q long_tasks
          
          celery -A cms multi start short1 short2 --concurrency=3 --pidfile=/home/me/apps/myapp/celery_short.pid --logfile=/home/me/logs/apps/myapp/celery_short.log --loglevel=INFO -Ofair --soft-time-limit=300 -c10 -Q short_tasks
          
          celery -A cms multi start beat --concurrency=3 --pidfile=/home/me/apps/myapp/celery_beat.pid --logfile=/home/me/logs/apps/myapp/celery_beat.log --loglevel=INFO
        1. Create your initial Django superuser:

          python manage.py createsuperuser
        1. Create a "Nginx Static Symlink" app at https://my.opalstack.com/apps/ with /home/me/apps/myapp/mediacms/static/ as the symlink path, then route app to the site using /static as the route.

        2. Create a "Nginx Static Symlink" app at https://my.opalstack.com/apps/ with /home/me/apps/myapp/mediacms/media_files/ as the symlink path, then route the app to the site using /media as the route.

        1. Edit the three lines at the end of myapp/uwsgi.ini to point it at the mediacms directory, eg:

          # adjust the following to point to your project
          python-path = /home/me/apps/myapp/mediacms
          wsgi-file = /home/me/apps/myapp/mediacms/cms/wsgi.py
          touch-reload = /home/me/apps/myapp/mediacms/cms/wsgi.py
        1. Restart the Django app:

          /home/me/apps/myapp/stop
          /home/me/apps/myapp/start

        At that point the site should be up and running on the site you set up in step 4, and you can log in as the superuser you created in step 9.

          sean Wow, thank you for this! I really appreciate the depth of your answer. I'll give this a try!

          14 days later

          @sean I followed your guide and was able to get a deployment working without any major issues. Thank you again!

          For anyone doing this themselves, you do have to enable each encoding profile in the Django admin dashboard otherwise all of the video uploads will hang at the encoding stage.

          9 months later

          Out of curiosity, does this take a lot of RAM ? Can this be deployed on the shared server without hiccups ? Or do I need a VPS ?

          6 months later

          sean

          Is this still valid ?

          Do we still need to build a private PgSQL and that too version 12 ? Or will the new Rocky servers come with PgSQL 17 shared ?

          • nick replied to this.

            anjanesh Servers should be using PostgreSQL 14.13 since around June, and I don't think MediaCMS needs superuser privileges to the database server. So, you can skip that build step.

            When I did python manage.py migrate
            I got

            psycopg.OperationalError: connection failed: FATAL:  no pg_hba.conf entry for host "127.0.0.1", user "myProjectName", database "myProjectName", no encryption

            I even tried changed 127.0.0.1 to the actual IP address

              anjanesh This error usually occurs when the database user is not assigned to the database. You should be able to fix this by following these steps:

              1. Go to https://my.opalstack.com/postgres/.
              2. Click the "Edit" (pencil icon) button for your database in the upper section of the page. A form will appear.
              3. Click "Add Read/Write Users" on the form. A list of database users will appear.
              4. Click your database user name. A user icon will appear showing that it has been selected.
              5. Click "Update PostgreSQL" on the form to save the user assignment.

              Thanks, now I'm facing an issue with createsuperuser

              (env) [username@opalX mediacms]$ python manage.py createsuperuser
              Username: myusername
              Email address: myself@example.com
              Password: 
              Password (again): 
              Traceback (most recent call last):
                File "/home/username/apps/myProject/env/lib/python3.10/site-packages/kombu/utils/functional.py", line 32, in __call__
                  return self.__value__
              AttributeError: 'ChannelPromise' object has no attribute '__value__'. Did you mean: '__call__'?
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/home/username/apps/myProject/env/lib/python3.10/site-packages/kombu/transport/virtual/base.py", line 951, in create_channel
                  return self._avail_channels.pop()
              IndexError: pop from empty list

              PS : I skipped #3 since I'm using upstash (which I find easier for redis)

              REDIS_LOCATION = "redis://default:secretPassword@some-name-987654.upstash.io:6379/1"
              CACHES = {
                  "default": {
                      "BACKEND": "django_redis.cache.RedisCache",
                      "LOCATION": REDIS_LOCATION,
                      "OPTIONS": {
                          "CLIENT_CLASS": "django_redis.client.DefaultClient",
                      },
                  }
              }

              I also skipped email settings in #6.

              Could this have caused the superuser issue ?

                Got it working finally. Thanks OpalStack team.

                For redis, I'm using upstash.io. Edit CACHES to this :

                REDIS_LOCATION = "rediss://some-name-987654.upstash.io:6379/0"
                CACHES = {
                    "default": {
                        "BACKEND": "django_redis.cache.RedisCache",
                        "LOCATION": REDIS_LOCATION,
                        "OPTIONS": {
                            "CLIENT_CLASS": "django_redis.client.DefaultClient",
                            "PASSWORD": "mylongpassword",
                            "CONNECTION_POOL_KWARGS": {
                                "ssl_cert_reqs": None
                            },
                            "SOCKET_CONNECT_TIMEOUT": 10,
                            "SOCKET_TIMEOUT": 10,
                            "RETRY_ON_TIMEOUT": True
                        }
                    }
                }

                upstash supports only /0 and not /1
                Only 0th database is supported! Selected DB: 1

                Mastodon