Memos is a Github project which you can deploy it easily in 5 minutes and use it ro record some of your thinking, or record some interesting things. In this post, I am going to show you a couple of ways to deploy it quickly and easily.
- 📅 Easy to record daily/weekly plan
- 💡 Convenient to record some whimsical ideas
- 📕 You can write your reflections by hand
- 🏗️ Sometimes it can replace the "file transfer assistant" often used on WeChat, the memo of the mobile phone
- 📒 You can create your own lightweight "card" notebook
Features
🦄 Open source and free forever🚀 Support for self-hosting withDocker
in seconds📜 Plain textarea first and support some useful Markdown syntax👥 Set memo private or public to others🧑💻 RESTful API for self-service📋 Embed memos on other sites using iframe#️⃣ Hashtags for organizing memos📆 Interactive calendar view💾 Easy data migration and backups
Self Hosted Docker Installation Pre-requirements
Free resources you might need to complete this docker project:
- Server: Oracle Free VPS, Azure Free VPS, Google Cloud Free VPS, and others
- Create a Free Tier Windows/Linux Azure VPS VM
- [Free VPS] GCP (Google Cloud Platform) Tips and Tricks (Free 16G RAM, 4 vCPU VPS)
- System: Cloud Vendor Ubuntu, Debian, or DD an original version
- SWAP size increase: wget https://raw.githubusercontent.com/51sec/swap/main/swap.sh && bash swap.sh
- Enable Password ssh login
- Enable BBR
- systemctl restart docker
- Domain: (Optional) EU.ORG to get a free one, free Cloudflare account to manage your domain
- Confirm port has not been used (you might need to install lsof using command : apt install lsof):
- lsof -i:8088
Pre-installed services:
- Docker,
- apt update
- apt install docker.io
- apt install docker-compose
- apt upgrade docker.io
- mkdir /root/data/docker_data/<docker_name>
- Docker-Compose (Using Ubuntu OS for the commands)
- Docker-compose down
- Optional command : use following command to backup your Docker data. You might need to change your folder name based on your docker configuraiton
- cp -r /root/data/docker_data/<docker_name> /root/data/docker_data_backup/<docker_name>
- docker-compose pull
- docker-compose up -d
- docker image prune
- Portainer (Optional)
- docker volume create portainer_data
- docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
- Install some applications: apt install wget curl sudo vim git (Optional)
- aapanel with Nginx (Optional)
- Nginx Proxy Manager (Optional)
- Install screen (Optional)
- Install screen (Depends on the Linux Distribution if it came pre installed or not) : yum install screen
- Initiate a Screen : screen or screen -S <screen name> <command to execute>
- Detach from the screen : "CTRL+A,D" not "CTRL+A+D"
- List all the screen currently working : screen -ls
- Reattach to a screen : screen -r <session number> or screen -r <screen name>
- Kill specific screen: screen -X -S <screen name> quit
- Kill all screens : pkill screen
Deploy with Docker Run Command
Check if Port 5230 Used
lsof -i:5230 #Check if tcp port 5230 occupied by other application.
If the output shows command not found, you can use following command to install lsof
- apt install lsof
Docker Run
docker run -d --name memos -p 5230:5230 -v ~/.memos/:/var/opt/memos neosmemo/memos:latest
~/.memos/
will be used as the data directory in your machine and/var/opt/memos
is the directory of the volume in Docker and should not be modified.
docker stop memos
docker rm -f memos
cp -r /root/data/docker_data/memos/.memos /root/data/docker_data/memos/.memos.archive # backup data
docker pull neosmemo/memos:latest # pull latest image
docker run -it -d \
--name memos \
--publish 5230:5230 \
--volume /root/data/docker_data/memos/.memos/:/var/opt/memos \
neosmemo/memos:latest \
--mode prod \
--port 5230
Access application using http://<public ip>:5230
- curl ip.sb
Deploy Using Docker Compose File
- vi docker-compose.yaml
version: "3.0"
services:
memos:
image: neosmemo/memos:latest
container_name: memos
volumes:
- ~/.memos/:/var/opt/memos
ports:
- 5230:5230
- docker-compose up -d
- docker-compose down && docker image rm neosmemo/memos:latest && docker-compose up -d
cd /root/data/docker_data/memos
docker-compose down
cp -r /root/data/docker_data/memos/.memos /root/data/docker_data/memos/.memos.archive # backup
docker-compose pull
docker-compose up -d
docker image prune # prune comand to clearn up not used docker images。Delete all images not been tagged or not been used by docker container.
Remove / Uninstall memos application
docker stop memos
docker rm -f memos # remove container memos, but will not delete mapped volumes
rm -rf /root/data/docker_data/memos # remove all mapped volumes
Deploy To Fly.io
- Follow the instructions to install fly's command-line interface
flyctl
. - log into flyctl.
3 flyctl auth login
4 flyctl launch
This command creates a fly.toml
file.
5 Edit your fly.toml
# fly.toml file generated for memos
app = "memos_example" # change to whatever name you want if the name is not occupied
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[build]
image = "hu3rror/memos-fly:latest" # Do not change unless you build your own image
[env]
DB_PATH = "/var/opt/memos/memos_prod.db" # do not change
# Details see: https://litestream.io/guides/backblaze/
LITESTREAM_REPLICA_BUCKET = "your_bucket_name" # change to your litestream bucket name
LITESTREAM_REPLICA_ENDPOINT = "s3.us-west-000.backblazeb2.com" # change to your litestream endpoint url
LITESTREAM_REPLICA_PATH = "memos_prod.db" # keep the default or change to whatever path you want
[mounts]
source="memos_data" # change to your fly.io volume name
destination="/var/opt/memos" # do not change
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 5230 # change to port 5230
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
[build] image = "hu3rror/memos-fly:latest"
[env] DB_PATH = "/var/opt/memos/memos_prod.db" # do not change LITESTREAM_REPLICA_BUCKET = "<filled_later>" # change to your litestream bucket name LITESTREAM_REPLICA_ENDPOINT = "<filled_later>" # change to your litestream endpoint url LITESTREAM_REPLICA_PATH = "memos_prod.db" # keep the default or change to whatever path you want
flyctl volumes create memos_data --region <your_region> --size <size_in_gb>
For example:
flyctl volumes create memos_data --region hkg --size 1
[mounts] source="memos_data" destination="/var/opt/memos"
[[services]] internal_port = 5230
6 flyctl deploy
Fly.io commands
PS C:\Users\john> fly orgs show freshrss51sec
Organization
Name : freshrss51sec
Slug : freshrss51sec
Type : SHARED
Summary
You have admin permissions on this organizaton
There are 1 members associated with this organization
Organization Members
+------+----------------------+-------+
| NAME | EMAIL | ROLE |
+------+----------------------+-------+
| | [email protected] | ADMIN |
+------+----------------------+-------+
PS C:\Users\john>fly volumes destroy vol_53q80vdpk66vgzy6
Warning! Every volume is pinned to a specific physical host. You should create two or more volumes per application. Deleting this volume will leave you with 1 volume(s) for this application,? Are you sure you want to destroy this volume? Yes
Destroyed volume ID: vol_53q80vdpk66vgzy6 name: freshrss51sec_data
PS C:\Users\john>PS C:\Users\john> fly config save -a freshrss51
Wrote config file fly.toml
PS C:\Users\john> fly volumes list
ID STATE NAME SIZE REGION ZONE ENCRYPTED ATTACHED VM CREATED AT
vol_53q80vdpk66vgzy6 created freshrss51sec_data 1GB yyz 5e29 true 1 year ago
vol_1q85vg3lem8rzdxe created freshrss51sec_data 1GB yyz aeee true e28606eb740486 10 months ago
PS C:\Users\john>
No comments:
Post a Comment