1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-10 15:47:32 +00:00

Merge branch '285-cloudron-app' into 'develop'

Resolve "Cloudron app"

Closes 

See merge request 
This commit is contained in:
Bram Wiepjes 2021-02-11 15:55:22 +00:00
commit c89fdb39ec
11 changed files with 302 additions and 0 deletions

View file

@ -10,6 +10,7 @@
* Fixed the "Ignored attempt to cancel a touchmove" error.
* Refactored the has_user everywhere such that the raise_error argument is used when
possible.
* Added Baserow Cloudron app.
* Fixed bug where a single select field without options could not be converted to a
another field.
* Fixed bug where the Editable component was not working if a prent a user-select:

View file

@ -0,0 +1,21 @@
{
"id": "io.baserow.cloudronapp",
"title": "Baserow",
"author": "Bram Wiepjes",
"description": "file://DESCRIPTION.md",
"tagline": "Collaborate on any form of data",
"website": "https://baserow.io",
"contactEmail": "bram@baserow.io",
"icon": "file://logo.png",
"tags": ["no-code", "nocode", "database", "data", "collaborate", "airtable"],
"version": "0.8.0",
"healthCheckPath": "/_health",
"httpPort": 80,
"addons": {
"postgresql": {},
"sendmail": {},
"localstorage": {}
},
"memoryLimit": 2147483648,
"manifestVersion": 2
}

View file

@ -0,0 +1,3 @@
Baserow is an open source no-code database tool and Airtable alternative. Easily create
a relational database without any technical expertise. Build a table and define custom
fields like text, number, file and many more.

View file

@ -0,0 +1,53 @@
FROM cloudron/base:3.0.0@sha256:455c70428723e3a823198c57472785437eb6eab082e79b3ff04ea584faf46e92
RUN mkdir -p /app/code
WORKDIR /app/code
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# We want to install Redis version 5.
RUN add-apt-repository ppa:chris-lea/redis-server
RUN apt-get update && \
apt install -y \
make curl gnupg2 nginx redis-server supervisor \
python3 build-essential libxslt-dev python3-dev python3-virtualenv \
python3-setuptools zlib1g-dev libffi-dev libssl-dev python3-pip \
&& rm -rf /var/cache/apt /var/lib/apt/lists
RUN service supervisor stop && service nginx stop
RUN rm -f /etc/nginx/sites-enabled/*
ADD start.sh /app/code
RUN git clone https://gitlab.com/bramw/baserow.git
RUN virtualenv -p python3 env
RUN env/bin/pip install --no-cache -r baserow/backend/requirements/base.txt
RUN (cd baserow/web-frontend && yarn install && yarn build)
RUN npm install -g mjml
RUN (mkdir -p /app/code/cloudron/cloudron && \
mkdir /app/data && \
touch /app/code/cloudron/cloudron/__init__.py)
ADD settings.py /app/code/cloudron/cloudron
ENV PYTHONPATH $PYTHONPATH:/app/code/baserow/backend/src:/app/code/cloudron
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV TMPDIR=/run/temp
USER root
RUN chown -R cloudron:cloudron /app/code
RUN sed -i 's/daemonize no/daemonize yes\nbind 127.0.0.1/g' /etc/redis/redis.conf
RUN ln -sf /dev/stdout /var/log/redis/redis-server.log
ADD supervisor.conf /etc/supervisor/conf.d/supervisor.conf
RUN ln -sf /dev/stdout /var/log/supervisor/supervisord.log
RUN ln -sf /dev/stdout /app/code/supervisord.log
ADD nginx.conf /etc/nginx/sites-enabled/nginx.conf
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
CMD ["/app/code/start.sh"]

BIN
deploy/cloudron/logo.png Normal file

Binary file not shown.

After

(image error) Size: 6 KiB

View file

@ -0,0 +1,49 @@
client_body_temp_path /run/client_body;
proxy_temp_path /run/proxy_temp;
fastcgi_temp_path /run/fastcgi_temp;
scgi_temp_path /run/scgi_temp;
uwsgi_temp_path /run/uwsgi_temp;
server {
access_log /dev/stdout;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
gzip on;
gzip_disable "msie6";
listen 80;
proxy_read_timeout 1800s;
client_max_body_size 0; # avoid HTTP 413 for large image uploads
# required to avoid HTTP 411: see Issue #1486 (https://github.com/dotcloud/docker/issues/1486)
chunked_transfer_encoding on;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_pass_request_headers on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
location ~ ^/(api|ws)/ {
proxy_pass http://127.0.0.1:8000;
proxy_pass_request_headers on;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
location /media/ {
root /app/data;
}
}

View file

@ -0,0 +1,26 @@
from baserow.config.settings.base import *
import os
MEDIA_ROOT = '/app/data/media'
MJML_BACKEND_MODE = 'cmd'
MJML_EXEC_CMD = 'mjml'
FROM_EMAIL = os.environ['CLOUDRON_MAIL_FROM']
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_USE_TLS = False
EMAIL_HOST = os.environ["CLOUDRON_MAIL_SMTP_SERVER"]
EMAIL_PORT = os.environ["CLOUDRON_MAIL_SMTP_PORT"]
EMAIL_HOST_USER = os.environ["CLOUDRON_MAIL_SMTP_USERNAME"]
EMAIL_HOST_PASSWORD = os.environ["CLOUDRON_MAIL_SMTP_PASSWORD"]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ['CLOUDRON_POSTGRESQL_DATABASE'],
'USER': os.environ['CLOUDRON_POSTGRESQL_USERNAME'],
'PASSWORD': os.environ['CLOUDRON_POSTGRESQL_PASSWORD'],
'HOST': os.environ['CLOUDRON_POSTGRESQL_HOST'],
'PORT': os.environ['CLOUDRON_POSTGRESQL_PORT'],
}
}

16
deploy/cloudron/start.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
set -eu
if [[ ! -f /app/data/.secret ]]; then
echo "export SECRET_KEY=$(tr -dc 'a-z0-9' < /dev/urandom | head -c50)" > /app/data/.secret
fi
source /app/data/.secret
echo "==> Executing database migrations"
/app/code/env/bin/python /app/code/baserow/backend/src/baserow/manage.py migrate --settings=cloudron.settings
chown -R cloudron:cloudron /app/data
echo "==> Starting"
exec /usr/bin/supervisord --configuration /etc/supervisor/conf.d/supervisor.conf

View file

@ -0,0 +1,64 @@
[supervisord]
nodaemon = true
logfile=/dev/null
logfile_maxbytes=0
environment =
DJANGO_SETTINGS_MODULE='cloudron.settings',
REDIS_HOST='localhost',
PRIVATE_BACKEND_URL='http://localhost:8000',
PUBLIC_WEB_FRONTEND_URL='https://%(ENV_CLOUDRON_APP_DOMAIN)s',
PUBLIC_BACKEND_URL='https://%(ENV_CLOUDRON_APP_DOMAIN)s'
[program:redis]
command=redis-server /etc/redis/redis.conf
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stdout
stderr_logfile_maxbytes=0
autostart=true
autorestart=true
[program:gunicorn]
user=cloudron
directory=/app/code/baserow
command=/app/code/env/bin/gunicorn -w 3 -b 127.0.0.1:8000 -k uvicorn.workers.UvicornWorker baserow.config.asgi:application --log-level=debug
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stdout
stderr_logfile_maxbytes=0
autostart=true
autorestart=true
[program:worker]
user=cloudron
directory=/app/code/baserow
command=/app/code/env/bin/celery -A baserow worker -l INFO
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stdout
stderr_logfile_maxbytes=0
autostart=true
autorestart=true
[program:nuxt]
user=cloudron
directory=/app/code/baserow/web-frontend
command=sh -c './node_modules/.bin/nuxt start --hostname 127.0.0.1 --config-file ./config/nuxt.config.demo.js'
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stdout
stderr_logfile_maxbytes=0
autostart=true
autorestart=true
[program:nginx]
directory=/tmp
user=root
command=/usr/sbin/nginx -g "daemon off;"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stdout
stderr_logfile_maxbytes=0
autostart=true
autorestart=true
numprocs=1

67
docs/guides/cloudron.md Normal file
View file

@ -0,0 +1,67 @@
# Cloudron
Cloudron is a complete solution for running apps on your server and keeping them
up-to-date and secure. If you don't have Cloudron installed on a server you can follow
the [installation instructions here ](https://docs.cloudron.io/installation/). Once
you have Cloudron running you can follow the steps below to install the Baserow app.
> Basic experience with the Cloudron CLI is required.
## Install Cloudron CLI
The Cloudron CLI can be installed on Linux/Mac using the following command. More
information about installing can be found on their website at
[https://docs.cloudron.io/custom-apps/cli/](https://docs.cloudron.io/custom-apps/cli/).
```
$ sudo npm install -g cloudron
```
## Installing Baserow
If you have not already been logged into your Cloudron platfrom you can do so by
executing the following command.
```
$ cloudron login my.{YOUR_DOMAIN}
```
When you have successfully logged in, you need to clone the latest Baserow repository
to your machine. This contains the Cloudron manifest file that you need when installing
the app.
```
$ git clone https://gitlab.com/bramw/baserow.git
$ cd baserow/deploy/cloudron
```
After that you can install the Baserow Cloudron app by executing the following commands.
```
$ cloudron install -l baserow.{YOUR_DOMAIN} --image registry.gitlab.com/bramw/baserow/cloudron:0.8.0
App is being installed.
...
App is installed.
```
> All the available versions can be found here:
> [https://gitlab.com/bramw/baserow/container_registry/1692077](https://gitlab.com/bramw/baserow/container_registry/1692077)
When the installation has finished you can visit your domain and create a new account
from there.
## Updating
When a new Baserow version becomes available you can easily update to that version.
First you need to figure out what your app id is. You can do so by executing the
`cloudron list` command. After that you can execute the following command to update to
the latest version.
```
cloudron update --app {YOUR_APP_ID} --image registry.gitlab.com/bramw/baserow/cloudron:0.8.0
```
> Note that you must replace the image with the most recent image of Baserow. The
> latest version can be found here:
> [https://gitlab.com/bramw/baserow/container_registry/1692077](https://gitlab.com/bramw/baserow/container_registry/1692077)

View file

@ -29,6 +29,8 @@ Need some help with setting things up?
`docker-compose`.
* [Install on Ubuntu](./guides/installation/install-on-ubuntu.md): A step by step guide
on how to install Baserow on an Ubuntu server.
* [Install on Cloudron](./guides/cloudron.md): Instructions on how to manually install
Baserow on Cloudron.
## Development